- Timestamp:
- 2012-04-18T12:18:56+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
r4816 r5200 18 18 import org.openstreetmap.josm.gui.help.HelpUtil; 19 19 import org.openstreetmap.josm.tools.ImageProvider; 20 import org.openstreetmap.josm.tools.InputMapUtils; 20 21 import org.openstreetmap.josm.tools.WindowGeometry; 21 22 … … 108 109 }; 109 110 b.addActionListener(a); 110 b.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "enter"); 111 b.getActionMap().put("enter", a); 111 InputMapUtils.enableEnter(b); 112 112 return b; 113 113 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r4982 r5200 20 20 import javax.swing.AbstractAction; 21 21 import javax.swing.Box; 22 import javax.swing.JComponent; 22 23 import javax.swing.JLabel; 23 24 import javax.swing.JPanel; … … 48 49 import org.openstreetmap.josm.tools.GBC; 49 50 import org.openstreetmap.josm.tools.ImageProvider; 51 import org.openstreetmap.josm.tools.InputMapUtils; 50 52 import org.openstreetmap.josm.tools.Predicate; 51 53 import org.openstreetmap.josm.tools.Shortcut; … … 83 85 undoSelectionListener = new UndoRedoSelectionListener(undoTree); 84 86 undoTree.getSelectionModel().addTreeSelectionListener(undoSelectionListener); 85 87 InputMapUtils.unassignCtrlShiftUpDown(undoTree, JComponent.WHEN_FOCUSED); 88 86 89 redoTree.addMouseListener(new PopupMenuHandler()); 87 90 redoTree.setRootVisible(false); … … 119 122 new SideButton(redoAction) 120 123 })); 124 125 InputMapUtils.addEnterAction(undoTree, selectAction); 126 InputMapUtils.addEnterAction(redoTree, selectAction); 121 127 } 122 128 -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r5028 r5200 48 48 import org.openstreetmap.josm.gui.SideButton; 49 49 import org.openstreetmap.josm.tools.ImageProvider; 50 import org.openstreetmap.josm.tools.InputMapUtils; 50 51 import org.openstreetmap.josm.tools.MultikeyActionsHandler; 51 52 import org.openstreetmap.josm.tools.MultikeyShortcutAction; … … 213 214 } 214 215 }); 216 217 // Toggle filter "enabled" on Enter 218 InputMapUtils.addEnterAction(userTable, new AbstractAction() { 219 public void actionPerformed(ActionEvent e) { 220 int index = userTable.getSelectedRow(); 221 if (index<0) return; 222 Filter filter = filterModel.getFilter(index); 223 filterModel.setValueAt(!filter.enable, index, FilterTableModel.COL_ENABLED); 224 } 225 }); 226 227 // Toggle filter "hiding" on Spacebar 228 InputMapUtils.addSpacebarAction(userTable, new AbstractAction() { 229 public void actionPerformed(ActionEvent e) { 230 int index = userTable.getSelectedRow(); 231 if (index<0) return; 232 Filter filter = filterModel.getFilter(index); 233 filterModel.setValueAt(!filter.hiding, index, FilterTableModel.COL_HIDING); 234 } 235 }); 215 236 216 237 createLayout(userTable, true, Arrays.asList(new SideButton[] { -
trunk/src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java
r4982 r5200 43 43 import org.openstreetmap.josm.gui.history.HistoryLoadTask; 44 44 import org.openstreetmap.josm.tools.ImageProvider; 45 import org.openstreetmap.josm.tools.InputMapUtils; 45 46 import org.openstreetmap.josm.tools.Shortcut; 46 47 … … 107 108 historyTable.getSelectionModel().addListSelectionListener(showHistoryAction); 108 109 historyTable.getSelectionModel().addListSelectionListener(reloadAction); 110 111 // Show history dialog on Enter/Spacebar 112 InputMapUtils.addEnterAction(historyTable, showHistoryAction); 113 InputMapUtils.addSpacebarAction(historyTable, showHistoryAction); 109 114 } 110 115 -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r5127 r5200 65 65 import org.openstreetmap.josm.tools.CheckParameterUtil; 66 66 import org.openstreetmap.josm.tools.ImageProvider; 67 import org.openstreetmap.josm.tools.InputMapUtils; 67 68 import org.openstreetmap.josm.tools.MultikeyActionsHandler; 68 69 import org.openstreetmap.josm.tools.MultikeyShortcutAction; … … 271 272 ); 272 273 getActionMap().put("delete", deleteLayerAction); 273 274 274 275 // Activate layer on Enter key press 276 InputMapUtils.addEnterAction(layerList, new AbstractAction() { 277 public void actionPerformed(ActionEvent e) { 278 activateLayerAction.actionPerformed(null); 279 layerList.requestFocus(); 280 } 281 }); 282 283 // Show/Activate layer on Enter key press 284 InputMapUtils.addSpacebarAction(layerList, showHideLayerAction); 285 275 286 createLayout(layerList, true, Arrays.asList(new SideButton[] { 276 287 new SideButton(moveUpAction, false), -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r5088 r5200 69 69 import org.openstreetmap.josm.tools.GBC; 70 70 import org.openstreetmap.josm.tools.ImageProvider; 71 import org.openstreetmap.josm.tools.InputMapUtils; 71 72 import org.openstreetmap.josm.tools.Shortcut; 72 73 import org.openstreetmap.josm.tools.Utils; … … 142 143 selectionModel.addListSelectionListener(upAction); 143 144 selectionModel.addListSelectionListener(downAction); 144 145 146 // Toggle style on Enter and Spacebar 147 InputMapUtils.addEnterAction(tblStyles, onoffAction); 148 InputMapUtils.addSpacebarAction(tblStyles, onoffAction); 149 145 150 createLayout(p, true, Arrays.asList(new SideButton[] { 146 151 new SideButton(onoffAction, false), -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r5082 r5200 25 25 import javax.swing.Action; 26 26 import javax.swing.DefaultListSelectionModel; 27 import javax.swing.JComponent; 27 28 import javax.swing.JList; 28 29 import javax.swing.JMenuItem; 30 import javax.swing.KeyStroke; 29 31 import javax.swing.ListSelectionModel; 30 32 import javax.swing.SwingUtilities; … … 65 67 import org.openstreetmap.josm.gui.widgets.ListPopupMenu; 66 68 import org.openstreetmap.josm.tools.ImageProvider; 69 import org.openstreetmap.josm.tools.InputMapUtils; 67 70 import org.openstreetmap.josm.tools.Shortcut; 68 71 … … 151 154 //displaylist.getActionMap().put("deleteRelation", deleteAction); 152 155 156 InputMapUtils.unassignCtrlShiftUpDown(displaylist, JComponent.WHEN_FOCUSED); 157 158 // Select relation on Ctrl-Enter 159 InputMapUtils.addEnterAction(displaylist, selectAction); 160 153 161 addToRelation = new AddToRelation(); 154 162 popupMenu = new RelationDialogPopupMenu(displaylist); 163 164 // Edit relation on Ctrl-Enter 165 displaylist.getActionMap().put("edit", editAction); 166 displaylist.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_MASK), "edit"); 155 167 } 156 168 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r5036 r5200 72 72 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 73 73 import org.openstreetmap.josm.tools.ImageProvider; 74 import org.openstreetmap.josm.tools.InputMapUtils; 74 75 import org.openstreetmap.josm.tools.Shortcut; 75 76 … … 148 149 149 150 popupMenu = new SelectionPopup(lstPrimitives); 151 InputMapUtils.addEnterAction(lstPrimitives, actZoomToListSelection); 150 152 } 151 153 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r5037 r5200 21 21 22 22 import javax.swing.AbstractAction; 23 import javax.swing.JComponent; 23 24 import javax.swing.JMenuItem; 24 25 import javax.swing.JOptionPane; 25 26 import javax.swing.JPopupMenu; 27 import javax.swing.KeyStroke; 26 28 import javax.swing.SwingUtilities; 27 29 import javax.swing.event.TreeSelectionEvent; … … 53 55 import org.openstreetmap.josm.io.OsmTransferException; 54 56 import org.openstreetmap.josm.tools.ImageProvider; 57 import org.openstreetmap.josm.tools.InputMapUtils; 55 58 import org.openstreetmap.josm.tools.Shortcut; 56 59 import org.xml.sax.SAXException; … … 105 108 tree.addMouseListener(new ClickWatch()); 106 109 tree.addTreeSelectionListener(new SelectionWatch()); 107 110 InputMapUtils.unassignCtrlShiftUpDown(tree, JComponent.WHEN_FOCUSED); 111 108 112 List<SideButton> buttons = new LinkedList<SideButton>(); 109 113 … … 119 123 } 120 124 }); 125 InputMapUtils.addEnterAction(tree, selectButton.getAction()); 126 121 127 selectButton.setEnabled(false); 122 128 buttons.add(selectButton); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r5155 r5200 112 112 import org.openstreetmap.josm.tools.GBC; 113 113 import org.openstreetmap.josm.tools.ImageProvider; 114 import org.openstreetmap.josm.tools.InputMapUtils; 114 115 import org.openstreetmap.josm.tools.LanguageInfo; 115 116 import org.openstreetmap.josm.tools.OpenBrowser; … … 846 847 847 848 // unassign some standard shortcuts for JTable to allow upload / download 848 InputMap inputMap=SwingUtilities.getUIInputMap(propertyTable,JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 849 inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_UP,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); 850 inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,InputEvent.CTRL_MASK|InputEvent.SHIFT_MASK)); 851 inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_UP,InputEvent.ALT_MASK|InputEvent.SHIFT_MASK)); 852 inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,InputEvent.ALT_MASK|InputEvent.SHIFT_MASK)); 853 SwingUtilities.replaceUIInputMap(propertyTable,JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,inputMap); 849 InputMapUtils.unassignCtrlShiftUpDown(propertyTable, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 854 850 855 851 // -- add action and shortcut 856 852 this.btnAdd = new SideButton(addAction); 857 btnAdd.setFocusable(true); 858 btnAdd.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter"); 859 btnAdd.getActionMap().put("onEnter", addAction); 853 InputMapUtils.enableEnter(this.btnAdd); 860 854 861 855 // -- edit action -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r5113 r5200 42 42 import org.openstreetmap.josm.tools.GBC; 43 43 import org.openstreetmap.josm.tools.ImageProvider; 44 import org.openstreetmap.josm.tools.InputMapUtils; 44 45 import org.openstreetmap.josm.tools.OsmUrlToBounds; 45 46 import org.openstreetmap.josm.tools.Utils; … … 163 164 // -- download button 164 165 pnl.add(btnDownload = new SideButton(actDownload = new DownloadAction())); 165 btnDownload.setFocusable(true); 166 btnDownload.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "download"); 167 btnDownload.getActionMap().put("download",actDownload); 166 InputMapUtils.enableEnter(btnDownload); 167 168 168 makeCheckBoxRespondToEnter(cbDownloadGpxData); 169 169 makeCheckBoxRespondToEnter(cbDownloadOsmData); … … 174 174 CancelAction actCancel = new CancelAction(); 175 175 pnl.add(btnCancel = new SideButton(actCancel)); 176 btnCancel.setFocusable(true); 177 btnCancel.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "enter"); 178 btnCancel.getActionMap().put("enter",actCancel); 176 InputMapUtils.enableEnter(btnCancel); 179 177 180 178 // -- cancel on ESC … … 185 183 SideButton btnHelp; 186 184 pnl.add(btnHelp = new SideButton(new ContextSensitiveHelpAction(ht("/Action/Download")))); 187 btnHelp.setFocusable(true); 188 btnHelp.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "enter"); 189 btnHelp.getActionMap().put("enter",btnHelp.getAction()); 185 InputMapUtils.enableEnter(btnHelp); 190 186 191 187 return pnl; -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
r4310 r5200 32 32 import org.openstreetmap.josm.gui.SideButton; 33 33 import org.openstreetmap.josm.tools.ImageProvider; 34 import org.openstreetmap.josm.tools.InputMapUtils; 34 35 import org.openstreetmap.josm.tools.WindowGeometry; 35 36 … … 74 75 lstOpenChangesets.addListSelectionListener(closeAction); 75 76 pnl.add(btnCloseChangesets = new SideButton(closeAction)); 76 btnCloseChangesets.setFocusable(true); 77 btnCloseChangesets.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "enter"); 78 btnCloseChangesets.getActionMap().put("enter",closeAction); 77 InputMapUtils.enableEnter(btnCloseChangesets); 79 78 80 79 // -- cancel action -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r4414 r5200 45 45 import org.openstreetmap.josm.io.OsmApi; 46 46 import org.openstreetmap.josm.tools.ImageProvider; 47 import org.openstreetmap.josm.tools.InputMapUtils; 47 48 import org.openstreetmap.josm.tools.WindowGeometry; 48 49 … … 154 155 pnl.add(btnUpload = new SideButton(uploadAction)); 155 156 btnUpload.setFocusable(true); 156 InputMap inputMap = btnUpload.getInputMap(); 157 inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), "doUpload"); 158 btnUpload.getActionMap().put("doUpload", uploadAction); 157 InputMapUtils.enableEnter(btnUpload); 159 158 160 159 // -- cancel button
Note:
See TracChangeset
for help on using the changeset viewer.