- Timestamp:
- 2012-02-22T19:54:15+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r4999 r5018 66 66 private SideButton downButton; 67 67 68 private EnableFilterAction enableFilterAction; 69 private HidingFilterAction hidingFilterAction; 68 70 69 71 public FilterDialog(){ … … 72 74 KeyEvent.VK_F, Shortcut.ALT_SHIFT), 162); 73 75 build(); 74 75 MultikeyActionsHandler.getInstance().addAction(new EnableFilterAction()); 76 MultikeyActionsHandler.getInstance().addAction(new HidingFilterAction()); 76 enableFilterAction = new EnableFilterAction(); 77 hidingFilterAction = new HidingFilterAction(); 78 MultikeyActionsHandler.getInstance().addAction(enableFilterAction); 79 MultikeyActionsHandler.getInstance().addAction(hidingFilterAction); 77 80 } 78 81 … … 195 198 } 196 199 200 @Override 201 public void destroy() { 202 MultikeyActionsHandler.getInstance().removeAction(enableFilterAction); 203 MultikeyActionsHandler.getInstance().removeAction(hidingFilterAction); 204 super.destroy(); 205 } 206 197 207 static class StringRenderer extends DefaultTableCellRenderer { 198 208 @Override -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r4999 r5018 90 90 instance = new LayerListDialog(mapFrame); 91 91 92 MultikeyActionsHandler.getInstance().addAction(instance.new ShowHideLayerAction(false));93 MultikeyActionsHandler.getInstance().addAction(instance.new ActivateLayerAction());94 JumpToMarkerActions.initialize();95 92 } 96 93 … … 120 117 121 118 ActivateLayerAction activateLayerAction; 122 119 ShowHideLayerAction showHideLayerAction; 120 123 121 //TODO This duplicates ShowHide actions functionality 124 122 /** stores which layer index to toggle and executes the ShowHide action if the layer is present */ … … 240 238 activateLayerAction = new ActivateLayerAction(); 241 239 activateLayerAction.updateEnabledState(); 240 MultikeyActionsHandler.getInstance().addAction(activateLayerAction); 242 241 adaptTo(activateLayerAction, selectionModel); 242 243 JumpToMarkerActions.initialize(); 243 244 244 245 // -- show hide action 245 ShowHideLayerAction showHideLayerAction = new ShowHideLayerAction(); 246 showHideLayerAction = new ShowHideLayerAction(); 247 MultikeyActionsHandler.getInstance().addAction(showHideLayerAction); 246 248 adaptTo(showHideLayerAction, selectionModel); 247 249 … … 345 347 Main.unregisterActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]); 346 348 } 349 MultikeyActionsHandler.getInstance().removeAction(activateLayerAction); 350 MultikeyActionsHandler.getInstance().removeAction(showHideLayerAction); 351 JumpToMarkerActions.unregisterActions(); 347 352 super.destroy(); 348 353 instance = null; -
trunk/src/org/openstreetmap/josm/gui/layer/JumpToMarkerActions.java
r4999 r5018 23 23 } 24 24 25 private static JumpToNextMarker jumpToNextMarkerAction; 26 private static JumpToPreviousMarker jumpToPreviousMarkerAction; 27 25 28 public static void initialize() { 26 MultikeyActionsHandler.getInstance().addAction(new JumpToNextMarker(null)); 27 MultikeyActionsHandler.getInstance().addAction(new JumpToPreviousMarker(null)); 29 jumpToNextMarkerAction = new JumpToNextMarker(null); 30 jumpToPreviousMarkerAction = new JumpToPreviousMarker(null); 31 MultikeyActionsHandler.getInstance().addAction(jumpToNextMarkerAction); 32 MultikeyActionsHandler.getInstance().addAction(jumpToPreviousMarkerAction); 33 } 34 35 public static void unregisterActions() { 36 MultikeyActionsHandler.getInstance().removeAction(jumpToNextMarkerAction); 37 MultikeyActionsHandler.getInstance().removeAction(jumpToPreviousMarkerAction); 28 38 } 29 39 -
trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java
r4999 r5018 9 9 import java.awt.event.ActionListener; 10 10 import java.awt.event.KeyEvent; 11 import java.util.HashMap; 12 import java.util.Map; 11 13 import java.util.Timer; 12 14 import java.util.TimerTask; … … 31 33 private static final String STATUS_BAR_ID = new String("multikeyShortcut"); 32 34 35 private Map<MultikeyShortcutAction, MyAction> myActions = new HashMap<MultikeyShortcutAction,MyAction>(); 36 33 37 private class MyKeyEventDispatcher implements KeyEventDispatcher { 34 38 @Override … … 203 207 if(action.getMultikeyShortcut() != null) { 204 208 MyAction myAction = new MyAction(action); 209 myActions.put(action, myAction); 205 210 Main.registerActionShortcut(myAction, myAction.shortcut); 206 211 } 207 212 } 213 214 // unregister action and its shortcut completely 215 public void removeAction(MultikeyShortcutAction action) { 216 MyAction a = myActions.get(action); 217 if (a!=null) { 218 Main.unregisterActionShortcut(a, a.shortcut); 219 myActions.remove(a); 220 } 221 } 208 222 }
Note:
See TracChangeset
for help on using the changeset viewer.