Changeset 3247 in josm for trunk/src/org
- Timestamp:
- 2010-05-15T10:37:03+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/PrefJPanel.java
r3083 r3247 13 13 import java.util.Map; 14 14 15 import javax.swing.AbstractAction; 15 16 import javax.swing.JEditorPane; 16 17 import javax.swing.JScrollPane; … … 370 371 // even have some duplicated code. Feel free to refactor, If you have 371 372 // more expirience with GUI coding than I have. 372 private class cbAction extends javax.swing.AbstractAction implements ListSelectionListener {373 private class cbAction extends AbstractAction implements ListSelectionListener { 373 374 private PrefJPanel panel; 374 375 public cbAction (PrefJPanel panel) { -
trunk/src/org/openstreetmap/josm/gui/preferences/ShortcutPreference.java
r3083 r3247 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util. Collection;6 import java.util.List; 7 7 8 8 import javax.swing.JPanel; … … 36 36 37 37 public boolean ok() { 38 return false;38 return Shortcut.savePrefs(); 39 39 } 40 40 41 41 // Maybe move this to prefPanel? There's no need for it to be here. 42 42 private static class scListModel extends AbstractTableModel { 43 // private String[] columnNames = new String[]{tr("Action"), tr("Shortcut"), tr("Group"), tr("ID")};44 43 private String[] columnNames = new String[]{tr("Action"), tr("Shortcut")}; 45 private Collection<Shortcut> data; 44 private List<Shortcut> data; 45 46 46 public scListModel() { 47 47 data = Shortcut.listAll(); … … 53 53 return data.size(); 54 54 } 55 @Override 55 56 public String getColumnName(int col) { 56 57 return columnNames[col]; 57 58 } 58 59 public Object getValueAt(int row, int col) { 59 Shortcut sc = (Shortcut)data.toArray()[row];60 if (col == 0) {60 Shortcut sc = data.get(row); 61 if (col == 0) 61 62 return sc.getLongText(); 62 } else if (col == 1) {63 else if (col == 1) 63 64 return sc.getKeyText(); 64 } /*else if (col == 2) { 65 if (sc.getRequestedGroup() == Shortcut.GROUP_NONE) { 66 return tr("None"); 67 } else if (sc.getRequestedGroup() == Shortcut.GROUP_HOTKEY) { 68 return tr("Hotkey"); 69 } else if (sc.getRequestedGroup() == Shortcut.GROUP_MENU) { 70 return tr("Menu"); 71 } else if (sc.getRequestedGroup() == Shortcut.GROUP_EDIT) { 72 return tr("Edit"); 73 } else if (sc.getRequestedGroup() == Shortcut.GROUP_LAYER) { 74 return tr("Subwindow"); 75 } else if (sc.getRequestedGroup() == Shortcut.GROUP_DIRECT) { 76 return tr("Direct"); 77 } else if (sc.getRequestedGroup() == Shortcut.GROUP_MNEMONIC) { 78 return tr("Mnemonic"); 79 } else if (sc.getRequestedGroup() == Shortcut.GROUP_RESERVED) { 80 return tr("System"); 81 } else { 82 return tr("Unknown"); 83 } 84 } else if (col == 3) { 85 return sc.getShortText(); 86 } */else { 65 else 87 66 // This is a kind of hack that allows the actions on the editing controls 88 67 // to access the underlying shortcut object without introducing another 89 68 // method. I opted to stay within the interface. 90 69 return sc; 91 }92 70 } 71 @Override 93 72 public boolean isCellEditable(int row, int col) { 94 73 return false; -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r3135 r3247 5 5 6 6 import java.awt.event.KeyEvent; 7 import java.util. Collection;7 import java.util.ArrayList; 8 8 import java.util.HashMap; 9 9 import java.util.LinkedHashMap; 10 import java.util.List; 10 11 import java.util.Map; 11 12 … … 231 232 * FOR PREF PANE ONLY 232 233 */ 233 public static Collection<Shortcut> listAll() {234 return shortcuts.values();234 public static List<Shortcut> listAll() { 235 return new ArrayList<Shortcut>(shortcuts.values()); 235 236 } 236 237 … … 313 314 314 315 // shutdown handling 315 public static voidsavePrefs() {316 public static boolean savePrefs() { 316 317 // we save this directly from the preferences pane, so don't overwrite these values here 317 318 // for (int i = GROUP_NONE; i < GROUP__MAX+GROUPS_ALT2; i++) { 318 319 // Main.pref.put("shortcut.groups."+i, Groups.get(i).toString()); 319 320 // } 321 boolean changed = false; 320 322 int i = 0; 321 323 for (Shortcut sc : shortcuts.values()) { 322 324 // TODO: Remove sc.getAssignedUser() when we fixed all internal conflicts 323 325 if (!sc.getAutomatic() && !sc.getReset() && sc.getAssignedUser()) { 324 Main.pref.put("shortcut.shortcut."+i, sc.asPrefString());326 changed = changed | Main.pref.put("shortcut.shortcut."+i, sc.asPrefString()); 325 327 i++; 326 328 } 327 329 } 328 Main.pref.put("shortcut.shortcut."+i, ""); 330 changed = changed | Main.pref.put("shortcut.shortcut."+i, ""); 331 return changed; 329 332 } 330 333 … … 465 468 * 'Ctrl-C' on windows or 'Meta-C' on a Mac. null, if the platform specific 466 469 * copy command isn't known. 467 * 470 * 468 471 * @return the platform specific key stroke for the 'Copy' command 469 472 */ … … 478 481 * 'Ctrl-V' on windows or 'Meta-V' on a Mac. null, if the platform specific 479 482 * paste command isn't known. 480 * 483 * 481 484 * @return the platform specific key stroke for the 'Paste' command 482 485 */ … … 491 494 * 'Ctrl-X' on windows or 'Meta-X' on a Mac. null, if the platform specific 492 495 * 'Cut' command isn't known. 493 * 496 * 494 497 * @return the platform specific key stroke for the 'Cut' command 495 498 */
Note:
See TracChangeset
for help on using the changeset viewer.