Changeset 12639 in josm for trunk/src/org
- Timestamp:
- 2017-08-25T01:37:31+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r12638 r12639 28 28 29 29 import javax.swing.Action; 30 import javax.swing.InputMap;31 import javax.swing.JComponent;32 import javax.swing.KeyStroke;33 30 34 31 import org.openstreetmap.josm.actions.JosmAction; … … 156 153 157 154 /** 158 * The same main panel, required to be static for {@code MapFrameListener} handling.159 */160 protected static MainPanel mainPanel;161 162 /**163 * The private content pane of {@code MainFrame}, required to be static for shortcut handling.164 */165 protected static JComponent contentPanePrivate;166 167 /**168 155 * The file watcher service. 169 156 */ … … 649 636 * Registers a {@code JosmAction} and its shortcut. 650 637 * @param action action defining its own shortcut 651 */ 638 * @deprecated use {@link MainApplication#registerActionShortcut(JosmAction)} instead 639 */ 640 @Deprecated 652 641 public static void registerActionShortcut(JosmAction action) { 653 registerActionShortcut(action, action.getShortcut());642 MainApplication.registerActionShortcut(action); 654 643 } 655 644 … … 658 647 * @param action action to register 659 648 * @param shortcut shortcut to associate to {@code action} 660 */ 649 * @deprecated use {@link MainApplication#registerActionShortcut(Action, Shortcut)} instead 650 */ 651 @Deprecated 661 652 public static void registerActionShortcut(Action action, Shortcut shortcut) { 662 KeyStroke keyStroke = shortcut.getKeyStroke(); 663 if (keyStroke == null) 664 return; 665 666 InputMap inputMap = contentPanePrivate.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); 667 Object existing = inputMap.get(keyStroke); 668 if (existing != null && !existing.equals(action)) { 669 Logging.info(String.format("Keystroke %s is already assigned to %s, will be overridden by %s", keyStroke, existing, action)); 670 } 671 inputMap.put(keyStroke, action); 672 673 contentPanePrivate.getActionMap().put(action, action); 653 MainApplication.registerActionShortcut(action, shortcut); 674 654 } 675 655 … … 677 657 * Unregisters a shortcut. 678 658 * @param shortcut shortcut to unregister 679 */ 659 * @deprecated use {@link MainApplication#unregisterShortcut(Shortcut)} instead 660 */ 661 @Deprecated 680 662 public static void unregisterShortcut(Shortcut shortcut) { 681 contentPanePrivate.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(shortcut.getKeyStroke());663 MainApplication.unregisterShortcut(shortcut); 682 664 } 683 665 … … 685 667 * Unregisters a {@code JosmAction} and its shortcut. 686 668 * @param action action to unregister 687 */ 669 * @deprecated use {@link MainApplication#unregisterActionShortcut(JosmAction)} instead 670 */ 671 @Deprecated 688 672 public static void unregisterActionShortcut(JosmAction action) { 689 unregisterActionShortcut(action, action.getShortcut());673 MainApplication.unregisterActionShortcut(action); 690 674 } 691 675 … … 694 678 * @param action action to unregister 695 679 * @param shortcut shortcut to unregister 696 */ 680 * @deprecated use {@link MainApplication#unregisterActionShortcut(Action, Shortcut)} instead 681 */ 682 @Deprecated 697 683 public static void unregisterActionShortcut(Action action, Shortcut shortcut) { 698 unregisterShortcut(shortcut); 699 contentPanePrivate.getActionMap().remove(action); 684 MainApplication.unregisterActionShortcut(action, shortcut); 700 685 } 701 686 … … 704 689 * @param shortcut The shortcut to look for 705 690 * @return the registered action for the given shortcut 691 * @deprecated use {@link MainApplication#getRegisteredActionShortcut(Shortcut)} instead 706 692 * @since 5696 707 693 */ 694 @Deprecated 708 695 public static Action getRegisteredActionShortcut(Shortcut shortcut) { 709 KeyStroke keyStroke = shortcut.getKeyStroke(); 710 if (keyStroke == null) 711 return null; 712 Object action = contentPanePrivate.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(keyStroke); 713 if (action instanceof Action) 714 return (Action) action; 715 return null; 696 return MainApplication.getRegisteredActionShortcut(shortcut); 716 697 } 717 698 … … 936 917 * @return {@code true} if the listeners collection changed as a result of the call 937 918 * @see #addMapFrameListener 919 * @deprecated use {@link MainApplication#addAndFireMapFrameListener} instead 938 920 * @since 11904 939 921 */ 922 @Deprecated 940 923 public static boolean addAndFireMapFrameListener(MapFrameListener listener) { 941 return mainPanel != null && mainPanel.addAndFireMapFrameListener(listener);924 return MainApplication.addAndFireMapFrameListener(listener); 942 925 } 943 926 … … 947 930 * @return {@code true} if the listeners collection changed as a result of the call 948 931 * @see #addAndFireMapFrameListener 932 * @deprecated use {@link MainApplication#addMapFrameListener} instead 949 933 * @since 5957 950 934 */ 935 @Deprecated 951 936 public static boolean addMapFrameListener(MapFrameListener listener) { 952 return mainPanel != null && mainPanel.addMapFrameListener(listener);937 return MainApplication.addMapFrameListener(listener); 953 938 } 954 939 … … 957 942 * @param listener The MapFrameListener 958 943 * @return {@code true} if the listeners collection changed as a result of the call 944 * @deprecated use {@link MainApplication#removeMapFrameListener} instead 959 945 * @since 5957 960 946 */ 947 @Deprecated 961 948 public static boolean removeMapFrameListener(MapFrameListener listener) { 962 return mainPanel != null && mainPanel.removeMapFrameListener(listener);949 return MainApplication.removeMapFrameListener(listener); 963 950 } 964 951 -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r12636 r12639 394 394 // 395 395 MapView.addZoomChangeListener(new ZoomChangeAdapter()); 396 Main .addMapFrameListener(new MapFrameAdapter());396 MainApplication.addMapFrameListener(new MapFrameAdapter()); 397 397 initEnabledState(); 398 398 } -
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r10605 r12639 16 16 import org.openstreetmap.josm.data.osm.DataSet; 17 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.gui.MainApplication; 18 19 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 19 20 import org.openstreetmap.josm.gui.datatransfer.PrimitiveTransferable; … … 36 37 putValue("help", ht("/Action/Copy")); 37 38 // CUA shortcut for copy (https://en.wikipedia.org/wiki/IBM_Common_User_Access#Description) 38 Main .registerActionShortcut(this,39 MainApplication.registerActionShortcut(this, 39 40 Shortcut.registerShortcut("system:copy:cua", tr("Edit: {0}", tr("Copy")), KeyEvent.VK_INSERT, Shortcut.CTRL)); 40 41 } -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r12637 r12639 79 79 sc = shortcut; 80 80 if (sc != null && !sc.isAutomatic()) { 81 Main .registerActionShortcut(this, sc);81 MainApplication.registerActionShortcut(this, sc); 82 82 } 83 83 setTooltip(tooltip); … … 218 218 public void destroy() { 219 219 if (sc != null && !sc.isAutomatic()) { 220 Main .unregisterActionShortcut(this);220 MainApplication.unregisterActionShortcut(this); 221 221 } 222 222 if (layerChangeAdapter != null) { -
trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
r12630 r12639 216 216 super.installAdapters(); 217 217 // make this action listen to mapframe change events 218 Main .addMapFrameListener((o, n) -> updateEnabledState());218 MainApplication.addMapFrameListener((o, n) -> updateEnabledState()); 219 219 } 220 220 } -
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r10766 r12639 8 8 import java.awt.event.KeyEvent; 9 9 10 import org.openstreetmap.josm. Main;10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.tools.Shortcut; 12 12 … … 25 25 putValue("help", ht("/Action/Paste")); 26 26 // CUA shortcut for paste (https://en.wikipedia.org/wiki/IBM_Common_User_Access#Description) 27 Main .registerActionShortcut(this,27 MainApplication.registerActionShortcut(this, 28 28 Shortcut.registerShortcut("system:paste:cua", tr("Edit: {0}", tr("Paste")), KeyEvent.VK_INSERT, Shortcut.SHIFT)); 29 29 } -
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r12636 r12639 75 75 null, toolbar, "save_as-session", installAdapters); 76 76 putValue("help", ht("/Action/SessionSaveAs")); 77 Main .addMapFrameListener(this);77 MainApplication.addMapFrameListener(this); 78 78 } 79 79 -
trunk/src/org/openstreetmap/josm/actions/ZoomInAction.java
r12636 r12639 8 8 import java.awt.event.KeyEvent; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.gui.MainApplication; 12 11 import org.openstreetmap.josm.tools.Shortcut; … … 32 31 putValue("help", ht("/Action/ZoomIn")); 33 32 // On standard QWERTY, AZERTY and other common layouts the '+' key is obtained with Shift+EQUALS 34 Main .registerActionShortcut(this,33 MainApplication.registerActionShortcut(this, 35 34 Shortcut.registerShortcut("view:zoominbis", tr("View: {0}", tr("Zoom In")), 36 35 KeyEvent.VK_EQUALS, Shortcut.SHIFT)); 37 36 // But on some systems (Belgian keyboard under Ubuntu) it seems not to work, so use also EQUALS 38 Main .registerActionShortcut(this,37 MainApplication.registerActionShortcut(this, 39 38 Shortcut.registerShortcut("view:zoominter", tr("View: {0}", tr("Zoom In")), 40 39 KeyEvent.VK_EQUALS, Shortcut.DIRECT)); 41 40 // make numpad + behave like + 42 Main .registerActionShortcut(this,41 MainApplication.registerActionShortcut(this, 43 42 Shortcut.registerShortcut("view:zoominkeypad", tr("View: {0}", tr("Zoom In (Keypad)")), 44 43 KeyEvent.VK_ADD, Shortcut.DIRECT)); -
trunk/src/org/openstreetmap/josm/actions/ZoomOutAction.java
r12636 r12639 8 8 import java.awt.event.KeyEvent; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.gui.MainApplication; 12 11 import org.openstreetmap.josm.tools.Shortcut; … … 26 25 putValue("help", ht("/Action/ZoomOut")); 27 26 // make numpad - behave like - 28 Main .registerActionShortcut(this,27 MainApplication.registerActionShortcut(this, 29 28 Shortcut.registerShortcut("view:zoomoutkeypad", tr("View: {0}", tr("Zoom Out (Keypad)")), 30 29 KeyEvent.VK_SUBTRACT, Shortcut.DIRECT)); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r12636 r12639 274 274 MapFrame map = MainApplication.getMap(); 275 275 map.statusLine.getAnglePanel().addMouseListener(snapHelper.anglePopupListener); 276 Main .registerActionShortcut(backspaceAction, backspaceShortcut);276 MainApplication.registerActionShortcut(backspaceAction, backspaceShortcut); 277 277 278 278 map.mapView.addMouseListener(this); … … 294 294 map.mapView.removeTemporaryLayer(this); 295 295 SelectionEventManager.getInstance().removeSelectionListener(this); 296 Main .unregisterActionShortcut(backspaceAction, backspaceShortcut);296 MainApplication.unregisterActionShortcut(backspaceAction, backspaceShortcut); 297 297 snapHelper.unsetFixedMode(); 298 298 snapCheckboxMenuItem.getAction().setEnabled(false); -
trunk/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java
r12636 r12639 59 59 ); 60 60 launchAction = new LaunchEditorAction(); 61 Main .registerActionShortcut(launchAction, shortcut);61 MainApplication.registerActionShortcut(launchAction, shortcut); 62 62 } 63 63 … … 115 115 @Override 116 116 public void destroy() { 117 Main .unregisterActionShortcut(launchAction, shortcut);117 MainApplication.unregisterActionShortcut(launchAction, shortcut); 118 118 super.destroy(); 119 119 } -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r12638 r12639 44 44 45 45 import javax.net.ssl.SSLSocketFactory; 46 import javax.swing.Action; 47 import javax.swing.InputMap; 46 48 import javax.swing.JComponent; 47 49 import javax.swing.JOptionPane; 50 import javax.swing.KeyStroke; 48 51 import javax.swing.LookAndFeel; 49 52 import javax.swing.RepaintManager; … … 55 58 import org.openstreetmap.gui.jmapviewer.FeatureAdapter; 56 59 import org.openstreetmap.josm.Main; 60 import org.openstreetmap.josm.actions.JosmAction; 57 61 import org.openstreetmap.josm.actions.OpenFileAction; 58 62 import org.openstreetmap.josm.actions.PreferencesAction; … … 131 135 132 136 /** 137 * The same panel as {@link Main#panel}, required to be static for {@link MapFrameListener} handling. 138 */ 139 static MainPanel mainPanel; 140 141 /** 142 * The private content pane of {@link MainFrame}, required to be static for shortcut handling. 143 */ 144 static JComponent contentPanePrivate; 145 146 /** 133 147 * The MapFrame. 134 148 */ … … 390 404 public static void redirectToMainContentPane(JComponent source) { 391 405 RedirectInputMap.redirect(source, contentPanePrivate); 406 } 407 408 /** 409 * Registers a new {@code MapFrameListener} that will be notified of MapFrame changes. 410 * <p> 411 * It will fire an initial mapFrameInitialized event when the MapFrame is present. 412 * Otherwise will only fire when the MapFrame is created or destroyed. 413 * @param listener The MapFrameListener 414 * @return {@code true} if the listeners collection changed as a result of the call 415 * @see #addMapFrameListener 416 * @since 12639 (as a replacement to {@code Main.addAndFireMapFrameListener}) 417 */ 418 @SuppressWarnings("deprecation") 419 public static boolean addAndFireMapFrameListener(MapFrameListener listener) { 420 return mainPanel != null && mainPanel.addAndFireMapFrameListener(listener); 421 } 422 423 /** 424 * Registers a new {@code MapFrameListener} that will be notified of MapFrame changes 425 * @param listener The MapFrameListener 426 * @return {@code true} if the listeners collection changed as a result of the call 427 * @see #addAndFireMapFrameListener 428 * @since 12639 (as a replacement to {@code Main.addMapFrameListener}) 429 */ 430 @SuppressWarnings("deprecation") 431 public static boolean addMapFrameListener(MapFrameListener listener) { 432 return mainPanel != null && mainPanel.addMapFrameListener(listener); 433 } 434 435 /** 436 * Unregisters the given {@code MapFrameListener} from MapFrame changes 437 * @param listener The MapFrameListener 438 * @return {@code true} if the listeners collection changed as a result of the call 439 * @since 12639 (as a replacement to {@code Main.removeMapFrameListener}) 440 */ 441 @SuppressWarnings("deprecation") 442 public static boolean removeMapFrameListener(MapFrameListener listener) { 443 return mainPanel != null && mainPanel.removeMapFrameListener(listener); 444 } 445 446 /** 447 * Registers a {@code JosmAction} and its shortcut. 448 * @param action action defining its own shortcut 449 * @since 12639 (as a replacement to {@code Main.registerActionShortcut}) 450 */ 451 @SuppressWarnings("deprecation") 452 public static void registerActionShortcut(JosmAction action) { 453 registerActionShortcut(action, action.getShortcut()); 454 } 455 456 /** 457 * Registers an action and its shortcut. 458 * @param action action to register 459 * @param shortcut shortcut to associate to {@code action} 460 * @since 12639 (as a replacement to {@code Main.registerActionShortcut}) 461 */ 462 @SuppressWarnings("deprecation") 463 public static void registerActionShortcut(Action action, Shortcut shortcut) { 464 KeyStroke keyStroke = shortcut.getKeyStroke(); 465 if (keyStroke == null) 466 return; 467 468 InputMap inputMap = contentPanePrivate.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); 469 Object existing = inputMap.get(keyStroke); 470 if (existing != null && !existing.equals(action)) { 471 Logging.info(String.format("Keystroke %s is already assigned to %s, will be overridden by %s", keyStroke, existing, action)); 472 } 473 inputMap.put(keyStroke, action); 474 475 contentPanePrivate.getActionMap().put(action, action); 476 } 477 478 /** 479 * Unregisters a shortcut. 480 * @param shortcut shortcut to unregister 481 * @since 12639 (as a replacement to {@code Main.unregisterShortcut}) 482 */ 483 @SuppressWarnings("deprecation") 484 public static void unregisterShortcut(Shortcut shortcut) { 485 contentPanePrivate.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).remove(shortcut.getKeyStroke()); 486 } 487 488 /** 489 * Unregisters a {@code JosmAction} and its shortcut. 490 * @param action action to unregister 491 * @since 12639 (as a replacement to {@code Main.unregisterActionShortcut}) 492 */ 493 @SuppressWarnings("deprecation") 494 public static void unregisterActionShortcut(JosmAction action) { 495 unregisterActionShortcut(action, action.getShortcut()); 496 } 497 498 /** 499 * Unregisters an action and its shortcut. 500 * @param action action to unregister 501 * @param shortcut shortcut to unregister 502 * @since 12639 (as a replacement to {@code Main.unregisterActionShortcut}) 503 */ 504 @SuppressWarnings("deprecation") 505 public static void unregisterActionShortcut(Action action, Shortcut shortcut) { 506 unregisterShortcut(shortcut); 507 contentPanePrivate.getActionMap().remove(action); 508 } 509 510 /** 511 * Replies the registered action for the given shortcut 512 * @param shortcut The shortcut to look for 513 * @return the registered action for the given shortcut 514 * @since 12639 (as a replacement to {@code Main.getRegisteredActionShortcut}) 515 */ 516 @SuppressWarnings("deprecation") 517 public static Action getRegisteredActionShortcut(Shortcut shortcut) { 518 KeyStroke keyStroke = shortcut.getKeyStroke(); 519 if (keyStroke == null) 520 return null; 521 Object action = contentPanePrivate.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(keyStroke); 522 if (action instanceof Action) 523 return (Action) action; 524 return null; 392 525 } 393 526 … … 551 684 final MainFrame mainFrame = new MainFrame(geometry); 552 685 if (mainFrame.getContentPane() instanceof JComponent) { 553 Main.contentPanePrivate = (JComponent) mainFrame.getContentPane();554 } 555 Main.mainPanel = mainFrame.getPanel();686 contentPanePrivate = (JComponent) mainFrame.getContentPane(); 687 } 688 mainPanel = mainFrame.getPanel(); 556 689 Main.parent = mainFrame; 557 690 -
trunk/src/org/openstreetmap/josm/gui/MapMover.java
r12630 r12639 153 153 154 154 private void registerActionShortcut(ZoomerAction action, Shortcut shortcut) { 155 Main .registerActionShortcut(action, shortcut);155 MainApplication.registerActionShortcut(action, shortcut); 156 156 registeredShortcuts.add(new Pair<>(action, shortcut)); 157 157 } … … 271 271 public void destroy() { 272 272 for (Pair<ZoomerAction, Shortcut> shortcut : registeredShortcuts) { 273 Main .unregisterActionShortcut(shortcut.a, shortcut.b);273 MainApplication.unregisterActionShortcut(shortcut.a, shortcut.b); 274 274 } 275 275 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r12630 r12639 672 672 final boolean activeLayerSupported = mode.layerIsSupported(layerManager.getActiveLayer()); 673 673 if (activeLayerSupported) { 674 Main .registerActionShortcut(mode, mode.getShortcut()); //fix #6876674 MainApplication.registerActionShortcut(mode, mode.getShortcut()); //fix #6876 675 675 } else { 676 Main .unregisterShortcut(mode.getShortcut());676 MainApplication.unregisterShortcut(mode.getShortcut()); 677 677 } 678 678 b.setEnabled(activeLayerSupported); -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r12636 r12639 161 161 tr("Toggle visibility of layer: {0}", i1), KeyEvent.VK_0 + (i1 % 10), Shortcut.ALT); 162 162 visibilityToggleActions[i] = new ToggleLayerIndexVisibility(i); 163 Main .registerActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]);163 MainApplication.registerActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]); 164 164 } 165 165 } … … 372 372 public void destroy() { 373 373 for (int i = 0; i < 10; i++) { 374 Main .unregisterActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]);374 MainApplication.unregisterActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]); 375 375 } 376 376 MultikeyActionsHandler.getInstance().removeAction(activateLayerAction); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r12636 r12639 515 515 MainApplication.getLayerManager().addActiveLayerChangeListener(this); 516 516 for (JosmAction action : josmActions) { 517 Main .registerActionShortcut(action);517 MainApplication.registerActionShortcut(action); 518 518 } 519 519 updateSelection(); … … 526 526 MainApplication.getLayerManager().removeActiveLayerChangeListener(this); 527 527 for (JosmAction action : josmActions) { 528 Main .unregisterActionShortcut(action);528 MainApplication.unregisterActionShortcut(action); 529 529 } 530 530 } … … 1335 1335 putValue(SHORT_DESCRIPTION, tr("Copy the key and value of all the tags to clipboard")); 1336 1336 Shortcut sc = Shortcut.registerShortcut("system:copytags", tr("Edit: {0}", tr("Copy Tags")), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE); 1337 Main .registerActionShortcut(this, sc);1337 MainApplication.registerActionShortcut(this, sc); 1338 1338 sc.setAccelerator(this); 1339 1339 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r12636 r12639 22 22 import javax.swing.JToggleButton; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.gui.MainApplication; 26 25 import org.openstreetmap.josm.gui.dialogs.DialogsPanel.Action; … … 101 100 "geoimage:previous", tr("Geoimage: {0}", tr("Show previous Image")), KeyEvent.VK_PAGE_UP, Shortcut.DIRECT); 102 101 final String previousImage = "Previous Image"; 103 Main .registerActionShortcut(prevAction, scPrev);102 MainApplication.registerActionShortcut(prevAction, scPrev); 104 103 btnPrevious.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scPrev.getKeyStroke(), previousImage); 105 104 btnPrevious.getActionMap().put(previousImage, prevAction); … … 112 111 Shortcut scDelete = Shortcut.registerShortcut( 113 112 "geoimage:deleteimagefromlayer", tr("Geoimage: {0}", tr("Remove photo from layer")), KeyEvent.VK_DELETE, Shortcut.SHIFT); 114 Main .registerActionShortcut(delAction, scDelete);113 MainApplication.registerActionShortcut(delAction, scDelete); 115 114 btnDelete.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scDelete.getKeyStroke(), removePhoto); 116 115 btnDelete.getActionMap().put(removePhoto, delAction); … … 123 122 "geoimage:deletefilefromdisk", tr("Geoimage: {0}", tr("Delete File from disk")), KeyEvent.VK_DELETE, Shortcut.CTRL_SHIFT); 124 123 final String deleteImage = "Delete image file from disk"; 125 Main .registerActionShortcut(delFromDiskAction, scDeleteFromDisk);124 MainApplication.registerActionShortcut(delFromDiskAction, scDeleteFromDisk); 126 125 btnDeleteFromDisk.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scDeleteFromDisk.getKeyStroke(), deleteImage); 127 126 btnDeleteFromDisk.getActionMap().put(deleteImage, delFromDiskAction); … … 133 132 "geoimage:copypath", tr("Geoimage: {0}", tr("Copy image path")), KeyEvent.VK_C, Shortcut.ALT_CTRL_SHIFT); 134 133 final String copyImage = "Copy image path"; 135 Main .registerActionShortcut(copyPathAction, scCopyPath);134 MainApplication.registerActionShortcut(copyPathAction, scCopyPath); 136 135 btnCopyPath.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scCopyPath.getKeyStroke(), copyImage); 137 136 btnCopyPath.getActionMap().put(copyImage, copyPathAction); … … 143 142 "geoimage:next", tr("Geoimage: {0}", tr("Show next Image")), KeyEvent.VK_PAGE_DOWN, Shortcut.DIRECT); 144 143 final String nextImage = "Next Image"; 145 Main .registerActionShortcut(nextAction, scNext);144 MainApplication.registerActionShortcut(nextAction, scNext); 146 145 btnNext.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(scNext.getKeyStroke(), nextImage); 147 146 btnNext.getActionMap().put(nextImage, nextAction); 148 147 btnNext.setEnabled(false); 149 148 150 Main .registerActionShortcut(149 MainApplication.registerActionShortcut( 151 150 new ImageAction(COMMAND_FIRST, null, null), 152 151 Shortcut.registerShortcut( 153 152 "geoimage:first", tr("Geoimage: {0}", tr("Show first Image")), KeyEvent.VK_HOME, Shortcut.DIRECT) 154 153 ); 155 Main .registerActionShortcut(154 MainApplication.registerActionShortcut( 156 155 new ImageAction(COMMAND_LAST, null, null), 157 156 Shortcut.registerShortcut( -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r12637 r12639 1245 1245 sc = Shortcut.registerShortcut("toolbar:"+name, tr("Toolbar: {0}", desc), 1246 1246 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE); 1247 Main .unregisterShortcut(sc);1248 Main .registerActionShortcut(act, sc);1247 MainApplication.unregisterShortcut(sc); 1248 MainApplication.registerActionShortcut(act, sc); 1249 1249 1250 1250 // add shortcut info to the tooltip if needed -
trunk/src/org/openstreetmap/josm/gui/widgets/DisableShortcutsOnFocusGainedTextField.java
r8929 r12639 17 17 import org.openstreetmap.josm.Main; 18 18 import org.openstreetmap.josm.actions.JosmAction; 19 import org.openstreetmap.josm.gui.MainApplication; 19 20 import org.openstreetmap.josm.tools.Pair; 20 21 import org.openstreetmap.josm.tools.Shortcut; … … 147 148 KeyStroke ks = shortcut.getKeyStroke(); 148 149 if (hasToBeDisabled(ks)) { 149 Action action = Main .getRegisteredActionShortcut(shortcut);150 Action action = MainApplication.getRegisteredActionShortcut(shortcut); 150 151 if (action != null) { 151 Main .unregisterActionShortcut(action, shortcut);152 MainApplication.unregisterActionShortcut(action, shortcut); 152 153 unregisteredActionShortcuts.add(new Pair<>(action, shortcut)); 153 154 } … … 182 183 protected void restoreActionShortcuts() { 183 184 for (Pair<Action, Shortcut> p : unregisteredActionShortcuts) { 184 Main .registerActionShortcut(p.a, p.b);185 MainApplication.registerActionShortcut(p.a, p.b); 185 186 } 186 187 unregisteredActionShortcuts.clear(); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r12634 r12639 781 781 PluginProxy pluginProxy = plugin.load(klass, pluginClassLoader); 782 782 pluginList.add(pluginProxy); 783 Main .addAndFireMapFrameListener(pluginProxy);783 MainApplication.addAndFireMapFrameListener(pluginProxy); 784 784 } 785 785 msg = null; -
trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java
r12630 r12639 212 212 MyAction myAction = new MyAction(action); 213 213 myActions.put(action, myAction); 214 Main .registerActionShortcut(myAction, myAction.shortcut);214 MainApplication.registerActionShortcut(myAction, myAction.shortcut); 215 215 } 216 216 } … … 223 223 MyAction a = myActions.get(action); 224 224 if (a != null) { 225 Main .unregisterActionShortcut(a, a.shortcut);225 MainApplication.unregisterActionShortcut(a, a.shortcut); 226 226 myActions.remove(action); 227 227 }
Note:
See TracChangeset
for help on using the changeset viewer.