- Timestamp:
- 2025-02-16T12:38:10+01:00 (8 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java
r16420 r19324 8 8 import java.awt.event.KeyEvent; 9 9 import java.beans.PropertyChangeListener; 10 import java.util.Optional; 10 11 11 12 import javax.swing.AbstractAction; … … 26 27 import org.openstreetmap.josm.tools.Logging; 27 28 import org.openstreetmap.josm.tools.PlatformManager; 29 import org.openstreetmap.josm.tools.Shortcut; 28 30 29 31 /** … … 98 100 component.getDocument().addUndoableEditListener(undoEditListener); 99 101 if (!GraphicsEnvironment.isHeadless()) { 100 component.getInputMap().put( 101 KeyStroke.getKeyStroke(KeyEvent.VK_Z, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), undoAction); 102 component.getInputMap().put( 103 KeyStroke.getKeyStroke(KeyEvent.VK_Y, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), redoAction); 102 final Optional<Shortcut> undoShortcut = Shortcut.listAll().stream() 103 .filter(shortcut -> "system:undo".equals(shortcut.getShortText())).findFirst(); 104 final Optional<Shortcut> redoShortcut = Shortcut.listAll().stream() 105 .filter(shortcut -> "system:redo".equals(shortcut.getShortText())).findFirst(); 106 if (undoShortcut.isPresent()) { 107 component.getInputMap().put(undoShortcut.get().getKeyStroke(), undoAction); 108 } else { 109 component.getInputMap().put( 110 KeyStroke.getKeyStroke(KeyEvent.VK_Z, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), undoAction); 111 } 112 if (redoShortcut.isPresent()) { 113 component.getInputMap().put(redoShortcut.get().getKeyStroke(), redoAction); 114 } else { 115 component.getInputMap().put( 116 KeyStroke.getKeyStroke(KeyEvent.VK_Y, PlatformManager.getPlatform().getMenuShortcutKeyMaskEx()), redoAction); 117 } 104 118 } 105 119 undoRedo = true;
Note:
See TracChangeset
for help on using the changeset viewer.