Changeset 27876 in osm for applications/editors/josm/plugins/turnrestrictions
- Timestamp:
- 2012-02-19T15:42:30+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/turnrestrictions
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnrestrictions/build.xml
r27857 r27876 32 32 <property name="commit.message" value="Adapt to JOSM core change (DefaultNameFormatter)"/> 33 33 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 34 <property name="plugin.main.version" value="49 68"/>34 <property name="plugin.main.version" value="4980"/> 35 35 <!-- 36 36 ************************************************ -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java
r23510 r27876 4 4 5 5 import java.awt.event.ActionEvent; 6 import java.awt.event.KeyEvent; 6 7 import java.util.Collection; 7 import java.util.logging.Logger;8 9 import javax.swing.KeyStroke;10 8 11 9 import org.openstreetmap.josm.Main; … … 13 11 import org.openstreetmap.josm.data.osm.Relation; 14 12 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 13 import org.openstreetmap.josm.tools.Shortcut; 15 14 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditor; 16 15 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditorManager; … … 26 25 */ 27 26 public class CreateOrEditTurnRestrictionAction extends JosmAction { 28 static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName());29 30 /**31 * Installs global key stroke configured in the preferences.32 *33 * @param keyStroke the key stroke34 */35 static public void install(){36 String value = Main.pref.get(PreferenceKeys.EDIT_SHORTCUT, "shift ctrl T");37 KeyStroke key = KeyStroke.getKeyStroke(value);38 if (key == null){39 System.out.println(tr("Warning: illegal value ''{0}'' for preference key ''{1}''. Falling back to default value ''shift ctrl T''.", value, PreferenceKeys.EDIT_SHORTCUT));40 key = KeyStroke.getKeyStroke("shift ctrl T");41 }42 Main.registerActionShortcut(getInstance(), key);43 }44 45 27 /** the singleton instance of this action */ 46 28 private static CreateOrEditTurnRestrictionAction instance; … … 63 45 null, 64 46 tr("Create or edit a turn restriction."), 65 null, // shortcut is going to be registered later 47 Shortcut.registerShortcut("tools:extnode", tr("Tool: {0}","Extract node"), 48 KeyEvent.VK_2, Shortcut.ALT_SHIFT), 66 49 false 67 50 ); -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java
r23192 r27876 35 35 private ButtonGroup bgIconSet; 36 36 private JCheckBox cbShowViaListInBasicEditor; 37 private ShortcutPreferencePanel pnlShortcutPreference;38 37 39 38 protected JPanel buildShowViaListInBasicEditorPanel() { … … 161 160 add(new JSeparator(), gc); 162 161 gc.gridy++; 163 add(pnlShortcutPreference = new ShortcutPreferencePanel(), gc);164 162 165 163 // filler - just grab remaining space … … 184 182 public void initFromPreferences(Preferences prefs){ 185 183 String set = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a"); 186 set = set.trim().toLowerCase();187 184 if (! set.equals("set-a") && ! set.equals("set-b")) { 188 185 System.out.println(tr("Warning: the preference with key ''{0}'' has an unsupported value ''{1}''. Assuming the default value ''set-a''.", PreferenceKeys.ROAD_SIGNS, set)); … … 197 194 boolean b = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false); 198 195 cbShowViaListInBasicEditor.setSelected(b); 199 200 pnlShortcutPreference.initFromPreferences(prefs);201 196 } 202 197 … … 207 202 */ 208 203 public void saveToPreferences(Preferences prefs){ 209 String set = null; 210 if (rbSetA.isSelected()){ 211 set = "set-a"; 212 } else { 213 set = "set-b"; 214 } 215 String oldSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a"); 216 if (!set.equals(oldSet)){ 217 prefs.put(PreferenceKeys.ROAD_SIGNS, set); 218 } 219 220 boolean newValue = cbShowViaListInBasicEditor.isSelected(); 221 boolean oldValue = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false); 222 if (newValue != oldValue){ 223 prefs.put(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, newValue); 224 } 225 226 pnlShortcutPreference.saveToPreferences(prefs); 204 prefs.put(PreferenceKeys.ROAD_SIGNS, rbSetA.isSelected() ? "set-a" : "set-b"); 205 prefs.put(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, cbShowViaListInBasicEditor.isSelected()); 227 206 } 228 207
Note:
See TracChangeset
for help on using the changeset viewer.