Changeset 1866 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-07-28T20:01:00+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r1856 r1866 101 101 // 102 102 JPanel buttonPanel = new JPanel(new GridLayout(1,3)); 103 buttonPanel.add(new SideButton(marktr("New"), "addrelation", "Selection", tr("Create a new relation"), new ActionListener() { 104 public void actionPerformed(ActionEvent e) {105 // call relation editor with null argument to create new relation106 RelationEditor.getEditor(Main.map.mapView.getEditLayer(),null, null).setVisible(true);107 }108 }), GBC.std());103 104 // the new action 105 // 106 NewAction newAction = new NewAction(); 107 Layer.listeners.add(newAction); 108 buttonPanel.add(new SideButton(newAction), GBC.std()); 109 109 110 110 // the edit action … … 313 313 } 314 314 } 315 316 /** 317 * The edit action 318 * 319 */ 320 class NewAction extends AbstractAction implements LayerChangeListener{ 321 public NewAction() { 322 putValue(SHORT_DESCRIPTION,tr("Create a new relation")); 323 putValue(NAME, tr("New")); 324 putValue(SMALL_ICON, ImageProvider.get("dialogs", "addrelation")); 325 setEnabled(false); 326 } 327 328 public void run() { 329 RelationEditor.getEditor(Main.map.mapView.getEditLayer(),null, null).setVisible(true); 330 } 331 332 public void actionPerformed(ActionEvent e) { 333 run(); 334 } 335 336 protected void updateEnabledState() { 337 setEnabled(Main.main != null && Main.main.getEditLayer() != null); 338 } 339 340 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 341 updateEnabledState(); 342 } 343 344 public void layerAdded(Layer newLayer) { 345 updateEnabledState(); 346 } 347 348 public void layerRemoved(Layer oldLayer) { 349 updateEnabledState(); 350 } 351 } 315 352 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r1857 r1866 89 89 } 90 90 91 protected RelationEditor(OsmDataLayer layer, Relation relation, Collection<RelationMember> selectedMembers) { 91 /** 92 * Creates a new relation editor 93 * 94 * @param layer the {@see OsmDataLayer} in whose context a relation is edited. Must not be null. 95 * @param relation the relation. Can be null if a new relation is to be edited. 96 * @param selectedMembers a collection of members in <code>relation</code> which the editor 97 * should display selected when the editor is first displayed on screen 98 * @throws IllegalArgumentException thrown if layer is null 99 */ 100 protected RelationEditor(OsmDataLayer layer, Relation relation, Collection<RelationMember> selectedMembers) throws IllegalArgumentException{ 92 101 // Initalizes ExtendedDialog 93 102 super(Main.parent, … … 96 105 false 97 106 ); 107 if (layer == null) 108 throw new IllegalArgumentException(tr("parameter ''layer'' must not be null", "layer")); 98 109 this.layer = layer; 99 110 setRelation(relation);
Note:
See TracChangeset
for help on using the changeset viewer.