Changeset 12065
- Timestamp:
- 2006-07-07T11:21:10+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java
r11625 r12065 57 57 static final private ImageIcon LOCKED_COLLECTION_ICON = JarTools.getImage("lcolicn.gif"); 58 58 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";61 59 62 60 /** Constructor */ … … 72 70 setSize(400,300); 73 71 // Stop the annoying renaming 74 disableRename(this);72 GUIUtils.disableRename(this); 75 73 // Description accessory 76 74 DescriptionPreview accessory = new DescriptionPreview(this); … … 101 99 } 102 100 103 /** Neat method to disable file renaming in filechooser.104 * Thanks to: vladi21 from www.experts-exchange.com105 */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 }126 101 127 102
Note:
See TracChangeset
for help on using the changeset viewer.