Changeset 9988 in josm for trunk/src


Ignore:
Timestamp:
2016-03-14T01:29:53+01:00 (9 years ago)
Author:
Don-vip
Message:

sonar - remove useless dynamic class loading

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/FileDrop.java

    r9249 r9988  
    129129            final Listener listener) {
    130130
    131         if (supportsDnD()) {
    132             // Make a drop listener
    133             dropListener = new DropListener(listener, dragBorder, c);
    134 
    135             // Make the component (and possibly children) drop targets
    136             makeDropTarget(c, recursive);
    137         } else {
    138             Main.info("FileDrop: Drag and drop is not supported with this JVM");
    139         }
    140     }
    141 
    142     private static synchronized boolean supportsDnD() {
    143         if (supportsDnD == null) {
    144             boolean support = false;
    145             try {
    146                 Class.forName("java.awt.dnd.DnDConstants");
    147                 support = true;
    148             } catch (Exception e) {
    149                 support = false;
    150             }
    151             supportsDnD = support;
    152         }
    153         return supportsDnD.booleanValue();
     131        // Make a drop listener
     132        dropListener = new DropListener(listener, dragBorder, c);
     133
     134        // Make the component (and possibly children) drop targets
     135        makeDropTarget(c, recursive);
    154136    }
    155137
     
    286268     */
    287269    public static boolean remove(Component c, boolean recursive) {
    288         // Make sure we support dnd.
    289         if (supportsDnD()) {
    290             Main.trace("FileDrop: Removing drag-and-drop hooks.");
    291             c.setDropTarget(null);
    292             if (recursive && (c instanceof Container)) {
    293                 for (Component comp : ((Container) c).getComponents()) {
    294                     remove(comp, recursive);
    295                 }
    296                 return true;
    297             } else
    298                 return false;
     270        Main.trace("FileDrop: Removing drag-and-drop hooks.");
     271        c.setDropTarget(null);
     272        if (recursive && (c instanceof Container)) {
     273            for (Component comp : ((Container) c).getComponents()) {
     274                remove(comp, recursive);
     275            }
     276            return true;
    299277        } else
    300278            return false;
Note: See TracChangeset for help on using the changeset viewer.