Changeset 23254 in osm for applications/editors/josm/plugins/turnrestrictions/src/org
- Timestamp:
- 2010-09-19T10:38:40+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java
r23192 r23254 22 22 23 23 /** 24 * This action is triggered by a global shortcut (default is Shift-Ctrl-T on windows). 24 * This action is triggered by a global shortcut (default is Shift-Ctrl-T on windows). 25 25 * Depending on the current selection it either launches an editor for a new turn 26 26 * restriction or a popup component from which one can choose a turn restriction to 27 * edit. 27 * edit. 28 28 * 29 29 */ 30 30 public class CreateOrEditTurnRestrictionAction extends JosmAction { 31 31 static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName()); 32 32 33 33 /** 34 34 * Installs the global key stroke with which creating/editing a turn restriction 35 35 * is triggered. 36 * 37 * @param keyStroke the key stroke 36 * 37 * @param keyStroke the key stroke 38 38 */ 39 39 static public void install(KeyStroke keyStroke){ … … 41 41 Object actionMapKey = im.get(keyStroke); 42 42 if (actionMapKey != null && !actionMapKey.toString().equals("turnrestrictions:create-or-edit")) { 43 System.out.println(tr("Warning: turnrestrictions plugin replaces already existing action ''{0}'' behind shortcut ''{1}'' by action ''{2}''", actionMapKey.toString(), keyStroke.toString(), "turnrestrictions:create-or-edit")); 43 System.out.println(tr("Warning: turnrestrictions plugin replaces already existing action ''{0}'' behind shortcut ''{1}'' by action ''{2}''", actionMapKey.toString(), keyStroke.toString(), "turnrestrictions:create-or-edit")); 44 44 } 45 45 KeyStroke[] keys = im.keys(); … … 55 55 am.put("turnrestrictions:create-or-edit", getInstance()); 56 56 } 57 57 58 58 /** 59 59 * Installs global key stroke configured in the preferences. 60 * 61 * @param keyStroke the key stroke 60 * 61 * @param keyStroke the key stroke 62 62 */ 63 63 static public void install(){ … … 70 70 install(key); 71 71 } 72 72 73 73 /** the singleton instance of this action */ 74 74 private static CreateOrEditTurnRestrictionAction instance; 75 75 76 76 /** 77 77 * Replies the unique instance of this action 78 * 78 * 79 79 * @return 80 80 */ … … 85 85 return instance; 86 86 } 87 87 88 88 protected CreateOrEditTurnRestrictionAction() { 89 89 super( … … 91 91 null, 92 92 tr("Create or edit a turn restriction."), 93 null, // shortcut is going to be registered later 94 false 93 null, // shortcut is going to be registered later 94 false 95 95 ); 96 } 97 96 } 97 98 98 public void actionPerformed(ActionEvent e) { 99 99 OsmDataLayer layer = Main.main.getEditLayer(); 100 100 if (layer == null) return; 101 101 Collection<Relation> trs = TurnRestrictionSelectionPopupPanel.getTurnRestrictionsParticipatingIn(layer.data.getSelected()); 102 if (layer == null) return;103 102 if (trs.isEmpty()){ 104 103 // current selection isn't participating in turn restrictions. Launch 105 // an editor for a new turn restriction 104 // an editor for a new turn restriction 106 105 // 107 106 Relation tr = new TurnRestrictionBuilder().buildFromSelection(layer); … … 112 111 } else { 113 112 // let the user choose whether he wants to create a new turn restriction or 114 // edit one of the turn restrictions participating in the current selection 113 // edit one of the turn restrictions participating in the current selection 115 114 TurnRestrictionSelectionPopupPanel pnl = new TurnRestrictionSelectionPopupPanel( 116 115 layer -
applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AdvancedEditorPanel.java
r23192 r23254 1 1 package org.openstreetmap.josm.plugins.turnrestrictions.editor; 2 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 3 5 import java.awt.BorderLayout; 4 5 6 import java.awt.event.HierarchyEvent; 6 7 import java.awt.event.HierarchyListener; … … 16 17 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 17 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 import static org.openstreetmap.josm.tools.I18n.tr;19 19 20 20 /** … … 26 26 27 27 private TurnRestrictionEditorModel model; 28 private TagEditorPanel pnlTagEditor; 28 private TagEditorPanel pnlTagEditor; 29 29 private JPanel pnlRelationMemberEditor; 30 30 private JTable tblRelationMemberEditor; 31 31 private JSplitPane spEditors; 32 32 33 33 /** 34 * Creates the panel with the tag editor 35 * 34 * Creates the panel with the tag editor 35 * 36 36 * @return 37 37 */ … … 39 39 JPanel pnl = new JPanel(new BorderLayout()); 40 40 HtmlPanel msg = new HtmlPanel(); 41 msg.setText("<html><body>" + 41 msg.setText("<html><body>" + 42 42 tr("In the following table you can edit the <strong>raw tags</strong>" 43 43 + " of the OSM relation representing this turn restriction.") … … 45 45 ); 46 46 pnl.add(msg, BorderLayout.NORTH); 47 pnlTagEditor = new TagEditorPanel(model.getTagEditorModel() );47 pnlTagEditor = new TagEditorPanel(model.getTagEditorModel(), null); 48 48 pnlTagEditor.initAutoCompletion(model.getLayer()); 49 49 pnl.add(pnlTagEditor, BorderLayout.CENTER); 50 50 return pnl; 51 51 } 52 52 53 53 /** 54 54 * Builds the panel with the table for editing relation members 55 * 55 * 56 56 * @return 57 57 */ … … 59 59 JPanel pnl = new JPanel(new BorderLayout()); 60 60 HtmlPanel msg = new HtmlPanel(); 61 msg.setText("<html><body>" 61 msg.setText("<html><body>" 62 62 + tr("In the following table you can edit the <strong>raw members</strong>" 63 63 + " of the OSM relation representing this turn restriction.") + "</body></html>" 64 64 ); 65 65 pnl.add(msg, BorderLayout.NORTH); 66 66 67 67 tblRelationMemberEditor = new RelationMemberTable(model); 68 68 JScrollPane pane = new JScrollPane(tblRelationMemberEditor); … … 72 72 return pnl; 73 73 } 74 74 75 75 /** 76 * Creates the main split panel 76 * Creates the main split panel 77 77 * @return 78 78 */ … … 86 86 return spEditors; 87 87 } 88 88 89 89 /** 90 90 * Builds the user interface … … 94 94 add(buildSplitPane(), BorderLayout.CENTER); 95 95 } 96 96 97 97 /** 98 98 * Creates the advanced editor 99 * 99 * 100 100 * @param model the editor model. Must not be null. 101 101 * @throws IllegalArgumentException thrown if model is null … … 107 107 HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#AdvancedEditor")); 108 108 } 109 109 110 110 /** 111 111 * Initializes the divider location when the components becomes visible the 112 * first time 112 * first time 113 113 */ 114 114 class SplitPaneDividerInitializer implements HierarchyListener { … … 117 117 spEditors.setDividerLocation(0.5); 118 118 spEditors.removeHierarchyListener(this); 119 } 120 } 119 } 120 } 121 121 } 122 122 }
Note:
See TracChangeset
for help on using the changeset viewer.