Ignore:
Timestamp:
2010-05-15T10:37:03+02:00 (15 years ago)
Author:
jttt
Message:

Fix #4807 Preferences: shortcut edting broken

Location:
trunk/src/org/openstreetmap/josm/gui/preferences
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/PrefJPanel.java

    r3083 r3247  
    1313import java.util.Map;
    1414
     15import javax.swing.AbstractAction;
    1516import javax.swing.JEditorPane;
    1617import javax.swing.JScrollPane;
     
    370371    // even have some duplicated code. Feel free to refactor, If you have
    371372    // 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 {
    373374        private PrefJPanel panel;
    374375        public cbAction (PrefJPanel panel) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/ShortcutPreference.java

    r3083 r3247  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.Collection;
     6import java.util.List;
    77
    88import javax.swing.JPanel;
     
    3636
    3737    public boolean ok() {
    38         return false;
     38        return Shortcut.savePrefs();
    3939    }
    4040
    4141    // Maybe move this to prefPanel? There's no need for it to be here.
    4242    private static class scListModel extends AbstractTableModel {
    43 //      private String[] columnNames = new String[]{tr("Action"), tr("Shortcut"), tr("Group"), tr("ID")};
    4443        private String[] columnNames = new String[]{tr("Action"), tr("Shortcut")};
    45         private Collection<Shortcut> data;
     44        private List<Shortcut> data;
     45
    4646        public scListModel() {
    4747            data = Shortcut.listAll();
     
    5353            return data.size();
    5454        }
     55        @Override
    5556        public String getColumnName(int col) {
    5657            return columnNames[col];
    5758        }
    5859        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)
    6162                return sc.getLongText();
    62             } else if (col == 1) {
     63            else if (col == 1)
    6364                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
    8766                // This is a kind of hack that allows the actions on the editing controls
    8867                // to access the underlying shortcut object without introducing another
    8968                // method. I opted to stay within the interface.
    9069                return sc;
    91             }
    9270        }
     71        @Override
    9372        public boolean isCellEditable(int row, int col) {
    9473            return false;
Note: See TracChangeset for help on using the changeset viewer.