Changeset 12065


Ignore:
Timestamp:
2006-07-07T11:21:10+12:00 (18 years ago)
Author:
kjdon
Message:

moved disableRename to GUIUtils

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java

    r11625 r12065  
    5757    static final private ImageIcon LOCKED_COLLECTION_ICON = JarTools.getImage("lcolicn.gif");
    5858    static final private ImageIcon NORMAL_COLLECTION_ICON = JarTools.getImage("ncolicn.gif");
    59     /** The name of the mouse listener that initiates editing on a double click. */
    60     static final private String SINGLE_CLICK_LISTENER = "SingleClickListener";
    6159
    6260    /** Constructor */
     
    7270    setSize(400,300);
    7371    // Stop the annoying renaming
    74     disableRename(this);
     72    GUIUtils.disableRename(this);
    7573    // Description accessory
    7674    DescriptionPreview accessory = new DescriptionPreview(this);
     
    10199    }
    102100
    103     /** Neat method to disable file renaming in filechooser.
    104      * Thanks to: vladi21 from www.experts-exchange.com
    105      */
    106     static public void disableRename(Component c) {
    107     if (c instanceof JList){
    108         EventListener[] listeners=c.getListeners(MouseListener.class);
    109         for(int i=0; listeners != null && i < listeners.length; i++) {
    110         if (listeners[i].toString().indexOf(SINGLE_CLICK_LISTENER) != -1) {
    111             c.removeMouseListener((MouseListener)listeners[i]);
    112         }
    113         }
    114         return;
    115     }
    116     if (c instanceof Container) {
    117         Component[] children = null;
    118         children = ((Container)c).getComponents();
    119         if (children != null) {
    120         for(int i = 0; children != null && i < children.length; i++) {
    121             disableRename(children[i]);
    122         }
    123         }
    124     }
    125     }
    126101
    127102
Note: See TracChangeset for help on using the changeset viewer.