Changeset 10453 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-06-22T00:48:51+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r10446 r10453 74 74 */ 75 75 public static void zoomToSelection() { 76 if (Main.main == null || !Main.main.hasEditLayer()) 76 DataSet dataSet = Main.getLayerManager().getEditDataSet(); 77 if (dataSet == null) { 77 78 return; 78 Collection<OsmPrimitive> sel = Main.getLayerManager().getEditLayer().data.getSelected(); 79 } 80 Collection<OsmPrimitive> sel = dataSet.getSelected(); 79 81 if (sel.isEmpty()) { 80 82 JOptionPane.showMessageDialog( … … 279 281 Collection<OsmPrimitive> sel = new HashSet<>(); 280 282 if ("selection".equals(mode)) { 281 sel = getLayerManager().getEditDataSet().getSelected(); 283 DataSet dataSet = getLayerManager().getEditDataSet(); 284 if (dataSet != null) { 285 sel = dataSet.getSelected(); 286 } 282 287 } else { 283 288 Conflict<? extends OsmPrimitive> c = Main.map.conflictDialog.getSelectedConflict(); -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r10448 r10453 135 135 @Override 136 136 public void actionPerformed(ActionEvent e) { 137 if (!Main.main.hasEditLayer()) { 137 DataSet dataSet = Main.getLayerManager().getEditDataSet(); 138 if (dataSet == null) { 138 139 new Notification( 139 140 tr("No data loaded.")) … … 144 145 } 145 146 146 final Collection<Way> selectedWays = Main.getLayerManager().getEditDataSet().getSelectedWays();147 final Collection<Way> selectedWays = dataSet.getSelectedWays(); 147 148 148 149 if (selectedWays.isEmpty()) { … … 157 158 } 158 159 159 final Collection<Relation> selectedRelations = Main.getLayerManager().getEditDataSet().getSelectedRelations();160 final Collection<Relation> selectedRelations = dataSet.getSelectedRelations(); 160 161 final Relation multipolygonRelation = update 161 162 ? getSelectedMultipolygonRelation(selectedWays, selectedRelations) -
trunk/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java
r7937 r10453 42 42 @Override 43 43 protected void updateEnabledState() { 44 setEnabled(Main. main.hasEditLayer());44 setEnabled(Main.getLayerManager().getEditDataSet() != null); 45 45 } 46 46 } -
trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java
r8510 r10453 37 37 @Override 38 38 protected void updateEnabledState() { 39 setEnabled(Main. main.hasEditLayer());39 setEnabled(Main.getLayerManager().getEditLayer() != null); 40 40 } 41 41 -
trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java
r10428 r10453 10 10 import org.openstreetmap.josm.actions.mapmode.DeleteAction; 11 11 import org.openstreetmap.josm.data.osm.Relation; 12 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 12 13 import org.openstreetmap.josm.tools.ImageProvider; 13 14 … … 28 29 29 30 protected void deleteRelation(Collection<Relation> toDelete) { 30 if (toDelete == null) 31 OsmDataLayer layer = Main.getLayerManager().getEditLayer(); 32 if (toDelete == null || layer == null) 31 33 return; 32 DeleteAction.deleteRelations(Main.getLayerManager().getEditLayer(), toDelete); 34 35 DeleteAction.deleteRelations(layer, toDelete); 33 36 // clear selection after deletion 34 37 if (Main.map.relationListDialog != null) … … 38 41 @Override 39 42 public void actionPerformed(ActionEvent e) { 40 if (!isEnabled() || !Main.main.hasEditLayer())43 if (!isEnabled()) 41 44 return; 42 45 deleteRelation(relations); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r10446 r10453 21 21 import org.openstreetmap.josm.data.coor.LatLon; 22 22 import org.openstreetmap.josm.data.osm.BBox; 23 import org.openstreetmap.josm.data.osm.DataSet; 23 24 import org.openstreetmap.josm.data.osm.Node; 24 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 164 165 mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0); 165 166 minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0); 166 dsArea = Main.main == null || !Main.main.hasEditLayer() ? null : Main.getLayerManager().getEditDataSet().getDataSourceArea(); 167 DataSet dataSet = Main.getLayerManager().getEditDataSet(); 168 dsArea = dataSet == null ? null : dataSet.getDataSourceArea(); 167 169 } 168 170 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r10446 r10453 316 316 @Override 317 317 public void actionPerformed(ActionEvent e) { 318 if ( !Main.main.hasEditLayer())318 if (Main.getLayerManager().getEditLayer() == null) 319 319 return; 320 320 ChangesetListModel model = getCurrentChangesetListModel(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r10413 r10453 39 39 import org.openstreetmap.josm.command.Command; 40 40 import org.openstreetmap.josm.command.PseudoCommand; 41 import org.openstreetmap.josm.data.osm.DataSet; 41 42 import org.openstreetmap.josm.data.osm.OsmPrimitive; 42 43 import org.openstreetmap.josm.gui.SideButton; … … 268 269 private void buildTrees() { 269 270 setTitle(tr("Command Stack")); 270 if ( !Main.main.hasEditLayer())271 if (Main.getLayerManager().getEditLayer() == null) 271 272 return; 272 273 … … 389 390 throw new IllegalStateException(); 390 391 391 OsmDataLayer editLayer = Main.getLayerManager().getEditLayer();392 if ( editLayer== null) return;393 editLayer.data.setSelected(getAffectedPrimitives(path));392 DataSet dataSet = Main.getLayerManager().getEditDataSet(); 393 if (dataSet == null) return; 394 dataSet.setSelected(getAffectedPrimitives(path)); 394 395 } 395 396 … … 417 418 public void actionPerformed(ActionEvent e) { 418 419 super.actionPerformed(e); 419 if (!Main.main.hasEditLayer()) return;420 420 AutoScaleAction.autoScale("selection"); 421 421 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r10446 r10453 339 339 @Override 340 340 public void mouseClicked(MouseEvent e) { 341 if ( !Main.main.hasEditLayer()) return;341 if (Main.getLayerManager().getEditLayer() == null) return; 342 342 if (isDoubleClick(e)) { 343 343 if (e.isControlDown()) { … … 371 371 372 372 protected void updateEnabledState() { 373 setEnabled(Main. main != null && Main.main.hasEditLayer());373 setEnabled(Main.getLayerManager().getEditLayer() != null); 374 374 } 375 375 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r10446 r10453 310 310 311 311 protected void updateEnabledState() { 312 setEnabled(Main. main != null && Main.main.hasEditLayer());312 setEnabled(Main.getLayerManager().getEditLayer() != null); 313 313 } 314 314 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r10438 r10453 333 333 334 334 protected Set<OsmPrimitive> getTarget() { 335 if (!isEnabled() || Main.main == null || !Main.main.hasEditLayer()) {335 if (!isEnabled()) { 336 336 return null; 337 337 } 338 338 OsmDataLayer layer = Main.getLayerManager().getEditLayer(); 339 if (layer == null) { 340 return null; 341 } 339 342 Set<OsmPrimitive> target = new HashSet<>(); 340 343 for (HistoryOsmPrimitive p : model.getSelectedPrimitives()) { … … 348 351 349 352 public final void updateEnabledState() { 350 if (Main.main == null || !Main.main.hasEditLayer()) { 351 setEnabled(false); 352 return; 353 } 354 setEnabled(model.hasSelectedPrimitives()); 353 setEnabled(Main.getLayerManager().getEditLayer() != null && model.hasSelectedPrimitives()); 355 354 } 356 355 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java
r10438 r10453 347 347 if (!isEnabled()) 348 348 return; 349 if (Main.main == null || !Main.main.hasEditLayer()) return;350 349 OsmDataLayer layer = Main.getLayerManager().getEditLayer(); 350 if (layer == null) { 351 return; 352 } 351 353 Set<OsmPrimitive> target = new HashSet<>(); 352 354 for (OsmPrimitive p: layer.data.allPrimitives()) { … … 363 365 364 366 public void updateEnabledState() { 365 if (Main.main == null || !Main.main.hasEditLayer()) { 366 setEnabled(false); 367 return; 368 } 369 setEnabled(currentChangeset != null); 367 setEnabled(Main.getLayerManager().getEditLayer() != null && currentChangeset != null); 370 368 } 371 369 … … 408 406 if (!isEnabled()) 409 407 return; 410 if (Main.main == null || !Main.main.hasEditLayer()) return;411 408 OsmDataLayer layer = Main.getLayerManager().getEditLayer(); 409 if (layer == null) { 410 return; 411 } 412 412 Set<OsmPrimitive> target = new HashSet<>(); 413 413 for (OsmPrimitive p: layer.data.allPrimitives()) { … … 425 425 426 426 public void updateEnabledState() { 427 if (Main.main == null || !Main.main.hasEditLayer()) { 428 setEnabled(false); 429 return; 430 } 431 setEnabled(currentChangeset != null); 427 setEnabled(Main.getLayerManager().getEditLayer() != null && currentChangeset != null); 432 428 } 433 429 -
trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
r10413 r10453 266 266 267 267 public void updateEnabledState() { 268 if (!Main.main.hasEditLayer()) { 269 setEnabled(false); 270 return; 271 } 272 setEnabled(getPrimitiveToZoom() != null); 268 setEnabled(Main.getLayerManager().getEditLayer() != null && getPrimitiveToZoom() != null); 273 269 } 274 270 } -
trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
r10436 r10453 163 163 @Override 164 164 public void layerRemoving(LayerRemoveEvent e) { 165 if (e.getRemovedLayer() instanceof OsmDataLayer && Main.isDisplayingMapView() && !Main.main.hasEditLayer()) { 165 // Removed layer is still in that list. 166 if (e.getRemovedLayer() instanceof OsmDataLayer && e.getSource().getLayersOfType(OsmDataLayer.class).size() <= 1) { 166 167 Main.getLayerManager().removeLayer(this); 167 168 } else if (e.getRemovedLayer() == this) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
r10428 r10453 66 66 @Override 67 67 public void updateEnabledState() { 68 setEnabled(Main.isDisplayingMapView() && (Main. main.hasEditLayer()|| mapHasGpxorMarkerLayer()));68 setEnabled(Main.isDisplayingMapView() && (Main.getLayerManager().getEditLayer() != null || mapHasGpxorMarkerLayer())); 69 69 } 70 70 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchAction.java
r8863 r10453 30 30 public void actionPerformed(ActionEvent e) { 31 31 32 if ( !Main.main.hasEditLayer())32 if (Main.getLayerManager().getEditLayer() == null) 33 33 return; 34 34 -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java
r10446 r10453 45 45 @Override 46 46 public void actionPerformed(ActionEvent e) { 47 if (Main. main.hasEditLayer()) {47 if (Main.getLayerManager().getEditLayer() != null) { 48 48 TaggingPresetSearchPrimitiveDialog.getInstance().showDialog(); 49 49 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandler.java
r10446 r10453 120 120 throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+')', e); 121 121 } 122 if ( !Main.main.hasEditLayer()) {122 if (Main.getLayerManager().getEditLayer() == null) { 123 123 throw new RequestHandlerBadRequestException(tr("There is no layer opened to add node")); 124 124 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandler.java
r10446 r10453 114 114 throw new RequestHandlerBadRequestException(tr("One node ways")); 115 115 } 116 if ( !Main.main.hasEditLayer()) {116 if (Main.getLayerManager().getEditLayer() == null) { 117 117 throw new RequestHandlerBadRequestException(tr("There is no layer opened to add way")); 118 118 }
Note:
See TracChangeset
for help on using the changeset viewer.