Changeset 6336 in josm
- Timestamp:
- 2013-10-27T05:35:41+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 53 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r6333 r6336 544 544 */ 545 545 public OsmDataLayer getEditLayer() { 546 if (map == null) return null; 547 if (map.mapView == null) return null; 546 if (!isDisplayingMapView()) return null; 548 547 return map.mapView.getEditLayer(); 549 548 } … … 565 564 */ 566 565 public Layer getActiveLayer() { 567 if (map == null) return null; 568 if (map.mapView == null) return null; 566 if (!isDisplayingMapView()) return null; 569 567 return map.mapView.getActiveLayer(); 570 568 } … … 762 760 */ 763 761 public static boolean saveUnsavedModifications() { 764 if ( map == null || map.mapView == null) return true;762 if (!isDisplayingMapView()) return true; 765 763 return saveUnsavedModifications(map.mapView.getLayersOfType(OsmDataLayer.class), true); 766 764 } -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r6333 r6336 62 62 */ 63 63 public static void zoomToSelection() { 64 if (Main.main == null || Main.main.getEditLayer() == null) return; 65 if (Main.map == null || Main.map.mapView == null) return; 64 if (Main.main == null || !Main.main.hasEditLayer()) return; 66 65 Collection<OsmPrimitive> sel = Main.main.getEditLayer().data.getSelected(); 67 66 if (sel.isEmpty()) { -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r6258 r6336 67 67 @Override 68 68 public void actionPerformed(ActionEvent e) { 69 if ( Main.main.getEditLayer() == null) {69 if (!Main.main.hasEditLayer()) { 70 70 new Notification( 71 71 tr("No data loaded.")) -
trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
r6084 r6336 81 81 @Override 82 82 public void actionPerformed(ActionEvent e) { 83 if (!isEnabled() || ! Main.isDisplayingMapView())83 if (!isEnabled()) 84 84 return; 85 OsmDataLayer layer = Main.ma p.mapView.getEditLayer();85 OsmDataLayer layer = Main.main.getEditLayer(); 86 86 if (layer == null) 87 87 return; -
trunk/src/org/openstreetmap/josm/actions/InfoAction.java
r5925 r6336 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.actions; 3 3 … … 17 17 public class InfoAction extends JosmAction { 18 18 19 /** 20 * Constructs a new {@code InfoAction}. 21 */ 19 22 public InfoAction() { 20 23 super(tr("Advanced info"), "about", … … 30 33 DataSet set = getCurrentDataSet(); 31 34 if (set != null) { 32 new InspectPrimitiveDialog(set.getAllSelected(), Main.ma p.mapView.getEditLayer()).showDialog();35 new InspectPrimitiveDialog(set.getAllSelected(), Main.main.getEditLayer()).showDialog(); 33 36 } 34 37 } -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r6316 r6336 519 519 // Delete the discarded inner ways 520 520 if (!discardedWays.isEmpty()) { 521 Command deleteCmd = DeleteCommand.delete(Main.ma p.mapView.getEditLayer(), discardedWays, true);521 Command deleteCmd = DeleteCommand.delete(Main.main.getEditLayer(), discardedWays, true); 522 522 if (deleteCmd != null) { 523 523 cmds.add(deleteCmd); … … 835 835 836 836 if (chunks.size() > 1) { 837 SplitWayResult split = SplitWayAction.splitWay(Main.ma p.mapView.getEditLayer(), way, chunks, Collections.<OsmPrimitive>emptyList());837 SplitWayResult split = SplitWayAction.splitWay(Main.main.getEditLayer(), way, chunks, Collections.<OsmPrimitive>emptyList()); 838 838 839 839 //execute the command, we need the results -
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r6227 r6336 131 131 if (data instanceof NodeData) { 132 132 NodeData nodeData = (NodeData)data; 133 if (Main.ma p.mapView.getEditLayer() == source) {133 if (Main.main.getEditLayer() == source) { 134 134 nodeData.setEastNorth(nodeData.getEastNorth().add(offsetEast, offsetNorth)); 135 135 } -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r6084 r6336 90 90 91 91 Collection<OsmPrimitive> sel = getCurrentDataSet().getAllSelected(); 92 layer = Main.ma p.mapView.getEditLayer();92 layer = Main.main.getEditLayer(); 93 93 94 94 toPurge = new HashSet<OsmPrimitive>(sel); … … 209 209 Main.pref.put("purge.clear_undo_redo", cbClearUndoRedo.isSelected()); 210 210 211 Main.main.undoRedo.add(new PurgeCommand(Main.ma p.mapView.getEditLayer(), toPurgeChecked, makeIncomplete));211 Main.main.undoRedo.add(new PurgeCommand(Main.main.getEditLayer(), toPurgeChecked, makeIncomplete)); 212 212 213 213 if (cbClearUndoRedo.isSelected()) { -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r6296 r6336 48 48 49 49 protected boolean confirmWayWithNodesOutsideBoundingBox(List<? extends OsmPrimitive> primitives) { 50 return DeleteCommand.checkAndConfirmOutlyingDelete(Main.ma p.mapView.getEditLayer(), primitives, null);50 return DeleteCommand.checkAndConfirmOutlyingDelete(Main.main.getEditLayer(), primitives, null); 51 51 } 52 52 -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r6046 r6336 40 40 try { 41 41 DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE); 42 Main.ma p.mapView.getEditLayer().mergeFrom(ds);42 Main.main.getEditLayer().mergeFrom(ds); 43 43 } catch(Exception e) { 44 44 ExceptionDialogUtil.explainException(e); -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r6316 r6336 269 269 } 270 270 APIDataSet apiData = new APIDataSet(Main.main.getCurrentDataSet()); 271 uploadData(Main.ma p.mapView.getEditLayer(), apiData);271 uploadData(Main.main.getEditLayer(), apiData); 272 272 } 273 273 } -
trunk/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java
r6327 r6336 42 42 @Override 43 43 protected void updateEnabledState() { 44 setEnabled(Main. isDisplayingMapView() && Main.main.getEditLayer() != null);44 setEnabled(Main.main.hasEditLayer()); 45 45 } 46 46 } -
trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java
r6327 r6336 37 37 @Override 38 38 protected void updateEnabledState() { 39 setEnabled(Main. isDisplayingMapView() && Main.main.getEditLayer() != null);39 setEnabled(Main.main.hasEditLayer()); 40 40 } 41 41 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r6272 r6336 223 223 protected OsmDataLayer getEditLayer() { 224 224 if (!Main.isDisplayingMapView()) return null; 225 return Main.ma p.mapView.getEditLayer();225 return Main.main.getEditLayer(); 226 226 } 227 227 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r6316 r6336 291 291 } 292 292 } 293 final OsmDataLayer editLayer = Main.ma p.mapView.getEditLayer();293 final OsmDataLayer editLayer = Main.main.getEditLayer(); 294 294 if (editLayer != null && osmData) { 295 295 final Set<OsmPrimitive> myPrimitives = getCompletePrimitives(editLayer.data); -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r6317 r6336 283 283 @Override 284 284 public void eventDispatched(AWTEvent event) { 285 if (Main.map == null || Main.map.mapView == null|| !Main.map.mapView.isActiveLayerDrawable())285 if (!Main.isDisplayingMapView() || !Main.map.mapView.isActiveLayerDrawable()) 286 286 return; 287 287 if (event instanceof KeyEvent) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r6310 r6336 156 156 @Override 157 157 public void eventDispatched(AWTEvent e) { 158 if (Main.map == null || Main.map.mapView == null|| !Main.map.mapView.isActiveLayerDrawable())158 if (!Main.isDisplayingMapView() || !Main.map.mapView.isActiveLayerDrawable()) 159 159 return; 160 160 InputEvent ie = (InputEvent) e; -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r6316 r6336 323 323 @Override 324 324 public void eventDispatched(AWTEvent event) { 325 if (Main.map == null || Main.map.mapView == null 326 || !Main.map.mapView.isActiveLayerDrawable()) { 325 if (!Main.isDisplayingMapView() || !Main.map.mapView.isActiveLayerDrawable()) { 327 326 return; 328 327 } -
trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java
r5799 r6336 39 39 @Override 40 40 public void actionPerformed(ActionEvent e) { 41 if (!isEnabled() || Main.main.getEditLayer() == null)41 if (!isEnabled() || !Main.main.hasEditLayer()) 42 42 return; 43 43 for (Relation r : relations) { -
trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java
r5821 r6336 34 34 @Override 35 35 public void actionPerformed(ActionEvent e) { 36 if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;37 Main.worker.submit(new DownloadRelationTask(relations, Main.ma p.mapView.getEditLayer()));36 if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return; 37 Main.worker.submit(new DownloadRelationTask(relations, Main.main.getEditLayer())); 38 38 } 39 39 -
trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java
r5821 r6336 47 47 @Override 48 48 public void actionPerformed(ActionEvent e) { 49 if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;49 if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return; 50 50 Main.worker.submit(new DownloadRelationMemberTask( 51 51 relations, 52 52 buildSetOfIncompleteMembers(relations), 53 Main.ma p.mapView.getEditLayer()));53 Main.main.getEditLayer())); 54 54 } 55 55 -
trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
r6333 r6336 40 40 Set<RelationMember> members = new HashSet<RelationMember>(); 41 41 if (Main.isDisplayingMapView()) { 42 OsmDataLayer editLayer = Main.ma p.mapView.getEditLayer();42 OsmDataLayer editLayer = Main.main.getEditLayer(); 43 43 if (editLayer != null && editLayer.data != null) { 44 44 Collection<OsmPrimitive> selection = editLayer.data.getSelected(); … … 58 58 */ 59 59 public static void launchEditor(Relation toEdit) { 60 if (toEdit == null || Main.map==null || Main.map.mapView==null) return;61 RelationEditor.getEditor(Main.ma p.mapView.getEditLayer(), toEdit,60 if (toEdit == null || !Main.isDisplayingMapView()) return; 61 RelationEditor.getEditor(Main.main.getEditLayer(), toEdit, 62 62 getMembersForCurrentSelection(toEdit)).setVisible(true); 63 63 } -
trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java
r5794 r6336 34 34 @Override 35 35 public void actionPerformed(ActionEvent e) { 36 if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;36 if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return; 37 37 38 38 HashSet<OsmPrimitive> members = new HashSet<OsmPrimitive>(); … … 41 41 } 42 42 if (add) { 43 Main.ma p.mapView.getEditLayer().data.addSelected(members);43 Main.main.getEditLayer().data.addSelected(members); 44 44 } else { 45 Main.ma p.mapView.getEditLayer().data.setSelected(members);45 Main.main.getEditLayer().data.setSelected(members); 46 46 } 47 47 } -
trunk/src/org/openstreetmap/josm/actions/relation/SelectRelationAction.java
r6069 r6336 31 31 @Override 32 32 public void actionPerformed(ActionEvent e) { 33 if (!isEnabled() || relations.isEmpty() || Main.map==null || Main.map.mapView==null) return;34 OsmDataLayer editLayer = Main.ma p.mapView.getEditLayer();33 if (!isEnabled() || relations.isEmpty()) return; 34 OsmDataLayer editLayer = Main.main.getEditLayer(); 35 35 if (editLayer==null || editLayer.data==null) return; 36 36 if (add) { -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r6265 r6336 1134 1134 @Override 1135 1135 protected Bounds getBounds() { 1136 if ( Main.map == null || Main.map.mapView == null) {1136 if (!Main.isDisplayingMapView()) { 1137 1137 return null; 1138 1138 } … … 1150 1150 } 1151 1151 1152 public static Match compile(String searchStr, boolean caseSensitive, boolean regexSearch) 1153 throws ParseError { 1152 public static Match compile(String searchStr, boolean caseSensitive, boolean regexSearch) throws ParseError { 1154 1153 return new SearchCompiler(caseSensitive, regexSearch, 1155 1154 new PushbackTokenizer( -
trunk/src/org/openstreetmap/josm/command/Command.java
r6333 r6336 86 86 */ 87 87 public Command() { 88 this.layer = Main. isDisplayingMapView() ? Main.map.mapView.getEditLayer() : null;88 this.layer = Main.main.getEditLayer(); 89 89 } 90 90 -
trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java
r6248 r6336 68 68 69 69 // remember the layer 70 layer = Main.ma p.mapView.getEditLayer();70 layer = Main.main.getEditLayer(); 71 71 return true; 72 72 } … … 89 89 90 90 Main.map.mapView.setActiveLayer(layer); 91 OsmDataLayer editLayer = Main.ma p.mapView.getEditLayer();91 OsmDataLayer editLayer = Main.main.getEditLayer(); 92 92 93 93 // restore the former state -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
r6317 r6336 175 175 @Override 176 176 public void layerRemoved(Layer oldLayer) { 177 if ( Main.map == null || Main.map.mapView == null) return;177 if (!Main.isDisplayingMapView()) return; 178 178 if (Main.map.mapView.getNumLayers() == 0) { 179 179 data.clear(); -
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r6069 r6336 240 240 } 241 241 if (!primitivesToDelete.isEmpty()) { 242 return DeleteCommand.delete(Main.ma p.mapView.getEditLayer(), primitivesToDelete);242 return DeleteCommand.delete(Main.main.getEditLayer(), primitivesToDelete); 243 243 } else { 244 244 return null; -
trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
r6162 r6336 52 52 super.startTest(monitor); 53 53 54 OsmDataLayer layer = Main.ma p.mapView.getEditLayer();54 OsmDataLayer layer = Main.main.getEditLayer(); 55 55 56 56 if (layer != null) { -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r6246 r6336 179 179 180 180 private JMenuItem getNewOffsetMenu(){ 181 if ( Main.map == null || Main.map.mapView == null) {181 if (!Main.isDisplayingMapView()) { 182 182 offsetAction.setEnabled(false); 183 183 return singleOffset; -
trunk/src/org/openstreetmap/josm/gui/MainMenu.java
r6253 r6336 752 752 /** 753 753 * Refreshes the enabled state 754 *755 754 */ 756 755 protected void refreshEnabled() { 757 presetsMenu.setEnabled(Main.isDisplayingMapView() 758 && Main.map.mapView.getEditLayer() != null 759 ); 756 presetsMenu.setEnabled(Main.main.hasEditLayer()); 760 757 } 761 758 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r6313 r6336 52 52 import org.openstreetmap.josm.gui.help.HelpUtil; 53 53 import org.openstreetmap.josm.gui.io.CloseChangesetTask; 54 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 54 55 import org.openstreetmap.josm.gui.widgets.ListPopupMenu; 55 56 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; … … 120 121 ChangesetCache.getInstance().addChangesetCacheListener(inActiveDataLayerModel); 121 122 MapView.addEditLayerChangeListener(inActiveDataLayerModel); 122 if (Main.main.getEditLayer() != null) { 123 Main.main.getEditLayer().data.addDataSetListener(inActiveDataLayerModel); 124 inActiveDataLayerModel.initFromDataSet(Main.main.getEditLayer().data); 125 inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getAllSelected()); 123 OsmDataLayer editLayer = Main.main.getEditLayer(); 124 if (editLayer != null) { 125 editLayer.data.addDataSetListener(inActiveDataLayerModel); 126 inActiveDataLayerModel.initFromDataSet(editLayer.data); 127 inSelectionModel.initFromPrimitives(editLayer.data.getAllSelected()); 126 128 } 127 129 } … … 132 134 ChangesetCache.getInstance().removeChangesetCacheListener(inActiveDataLayerModel); 133 135 MapView.removeEditLayerChangeListener(inActiveDataLayerModel); 134 if (Main.main.getEditLayer() != null) { 135 Main.main.getEditLayer().data.removeDataSetListener(inActiveDataLayerModel); 136 OsmDataLayer editLayer = Main.main.getEditLayer(); 137 if (editLayer != null) { 138 editLayer.data.removeDataSetListener(inActiveDataLayerModel); 136 139 } 137 140 … … 233 236 234 237 protected void initWithCurrentData() { 235 if (Main.main.getEditLayer() != null) { 236 inSelectionModel.initFromPrimitives(Main.main.getEditLayer().data.getAllSelected()); 237 inActiveDataLayerModel.initFromDataSet(Main.main.getEditLayer().data); 238 OsmDataLayer editLayer = Main.main.getEditLayer(); 239 if (editLayer != null) { 240 inSelectionModel.initFromPrimitives(editLayer.data.getAllSelected()); 241 inActiveDataLayerModel.initFromDataSet(editLayer.data); 238 242 } 239 243 } … … 308 312 @Override 309 313 public void actionPerformed(ActionEvent e) { 310 if ( Main.main.getEditLayer() == null)314 if (!Main.main.hasEditLayer()) 311 315 return; 312 316 ChangesetListModel model = getCurrentChangesetListModel(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r6084 r6336 243 243 private void buildTrees() { 244 244 setTitle(tr("Command Stack")); 245 if ( Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null)245 if (!Main.main.hasEditLayer()) 246 246 return; 247 247 … … 317 317 protected static FilteredCollection<OsmPrimitive> getAffectedPrimitives(TreePath path) { 318 318 PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand(); 319 final OsmDataLayer currentLayer = Main.ma p.mapView.getEditLayer();319 final OsmDataLayer currentLayer = Main.main.getEditLayer(); 320 320 FilteredCollection<OsmPrimitive> prims = new FilteredCollection<OsmPrimitive>( 321 321 c.getParticipatingPrimitives(), … … 359 359 throw new IllegalStateException(); 360 360 361 if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return; 362 Main.map.mapView.getEditLayer().data.setSelected( getAffectedPrimitives(path)); 361 OsmDataLayer editLayer = Main.main.getEditLayer(); 362 if (editLayer == null) return; 363 editLayer.data.setSelected( getAffectedPrimitives(path)); 363 364 } 364 365 … … 367 368 setEnabled(!undoTree.isSelectionEmpty() || !redoTree.isSelectionEmpty()); 368 369 } 369 370 370 } 371 371 372 372 public class SelectAndZoomAction extends SelectAction { 373 /** 374 * Constructs a new {@code SelectAndZoomAction}. 375 */ 373 376 public SelectAndZoomAction() { 374 super();375 377 putValue(NAME,tr("Select and zoom")); 376 378 putValue(SHORT_DESCRIPTION, tr("Selects the objects that take part in this command (unless currently deleted), then and zooms to it")); … … 381 383 public void actionPerformed(ActionEvent e) { 382 384 super.actionPerformed(e); 383 if ( Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return;385 if (!Main.main.hasEditLayer()) return; 384 386 AutoScaleAction.autoScale("selection"); 385 387 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r6316 r6336 680 680 681 681 protected boolean isActiveLayer(Layer layer) { 682 if (Main.map == null) return false; 683 if (Main.map.mapView == null) return false; 682 if (!Main.isDisplayingMapView()) return false; 684 683 return Main.map.mapView.getActiveLayer() == layer; 685 684 } … … 776 775 777 776 protected boolean isActiveLayer(Layer layer) { 778 if (Main.map == null) return false; 779 if (Main.map.mapView == null) return false; 777 if (!Main.isDisplayingMapView()) return false; 780 778 return Main.map.mapView.getActiveLayer() == layer; 781 779 } … … 832 830 833 831 private void duplicate(Layer layer) { 834 if ( Main.map == null || Main.map.mapView == null)832 if (!Main.isDisplayingMapView()) 835 833 return; 836 834 … … 863 861 864 862 protected boolean isActiveLayer(Layer layer) { 865 if ( Main.map == null || Main.map.mapView == null)863 if (!Main.isDisplayingMapView()) 866 864 return false; 867 865 return Main.map.mapView.getActiveLayer() == layer; … … 974 972 975 973 protected boolean isActiveLayer(Layer layer) { 976 if (Main.map == null) return false; 977 if (Main.map.mapView == null) return false; 974 if (!Main.isDisplayingMapView()) return false; 978 975 return Main.map.mapView.getActiveLayer() == layer; 979 976 } … … 1404 1401 */ 1405 1402 public List<Layer> getLayers() { 1406 if ( Main.map == null || Main.map.mapView == null)1403 if (!Main.isDisplayingMapView()) 1407 1404 return Collections.<Layer>emptyList(); 1408 1405 return Main.map.mapView.getAllLayersAsList(); … … 1437 1434 */ 1438 1435 protected Layer getActiveLayer() { 1439 if ( Main.map == null || Main.map.mapView == null) return null;1436 if (!Main.isDisplayingMapView()) return null; 1440 1437 return Main.map.mapView.getActiveLayer(); 1441 1438 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r6316 r6336 324 324 325 325 @Override public void mouseClicked(MouseEvent e) { 326 if ( Main.main.getEditLayer() == null) return;326 if (!Main.main.hasEditLayer()) return; 327 327 if (isDoubleClick(e)) { 328 328 if (e.isControlDown()) { … … 357 357 358 358 protected void updateEnabledState() { 359 setEnabled(Main.main != null && Main.main. getEditLayer() != null);359 setEnabled(Main.main != null && Main.main.hasEditLayer()); 360 360 } 361 361 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r6070 r6336 168 168 MapView.addEditLayerChangeListener(actSearch); 169 169 // editLayerChanged also gets the selection history of the level 170 model.editLayerChanged(null, Main.map.mapView.getEditLayer()); 171 if (Main.map.mapView.getEditLayer() != null) { 172 model.setJOSMSelection(Main.map.mapView.getEditLayer().data.getAllSelected()); 170 OsmDataLayer editLayer = Main.main.getEditLayer(); 171 model.editLayerChanged(null, editLayer); 172 if (editLayer != null) { 173 model.setJOSMSelection(editLayer.data.getAllSelected()); 173 174 } 174 175 actSearch.updateEnabledState(); … … 285 286 286 287 public void updateEnabledState() { 287 setEnabled(Main.main != null && Main.main.getEditLayer() != null);288 setEnabled(Main.main != null && !Main.main.hasEditLayer()); 288 289 } 289 290 … … 310 311 Collection<OsmPrimitive> sel = model.getSelected(); 311 312 if (sel.isEmpty())return; 312 if (Main.map == null || Main.map.mapView == null || Main.map.mapView.getEditLayer() == null) return; 313 Main.map.mapView.getEditLayer().data.setSelected(sel); 313 OsmDataLayer editLayer = Main.main.getEditLayer(); 314 if (editLayer == null) return; 315 editLayer.data.setSelected(sel); 314 316 } 315 317 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r6316 r6336 325 325 if (!isEnabled()) 326 326 return; 327 if (Main.main == null || Main.main.getEditLayer() == null) return;327 if (Main.main == null || !Main.main.hasEditLayer()) return; 328 328 OsmDataLayer layer = Main.main.getEditLayer(); 329 329 Set<HistoryOsmPrimitive> selected = model.getSelectedPrimitives(); … … 343 343 344 344 public void updateEnabledState() { 345 if (Main.main == null || Main.main.getEditLayer() == null){345 if (Main.main == null || !Main.main.hasEditLayer()) { 346 346 setEnabled(false); 347 347 return; … … 390 390 if (!isEnabled()) 391 391 return; 392 if (Main.main == null || Main.main.getEditLayer() == null) return;392 if (Main.main == null || !Main.main.hasEditLayer()) return; 393 393 OsmDataLayer layer = Main.main.getEditLayer(); 394 394 Set<HistoryOsmPrimitive> selected = model.getSelectedPrimitives(); … … 409 409 410 410 public void updateEnabledState() { 411 if (Main.main == null || Main.main.getEditLayer() == null){411 if (Main.main == null || !Main.main.hasEditLayer()) { 412 412 setEnabled(false); 413 413 return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java
r6084 r6336 386 386 if (!isEnabled()) 387 387 return; 388 if (Main.main == null || Main.main.getEditLayer() == null) return;388 if (Main.main == null || !Main.main.hasEditLayer()) return; 389 389 OsmDataLayer layer = Main.main.getEditLayer(); 390 390 Set<OsmPrimitive> target = new HashSet<OsmPrimitive>(); … … 402 402 403 403 public void updateEnabledState() { 404 if (Main.main == null || Main.main.getEditLayer() == null){404 if (Main.main == null || !Main.main.hasEditLayer()) { 405 405 setEnabled(false); 406 406 return; … … 447 447 if (!isEnabled()) 448 448 return; 449 if (Main.main == null || Main.main.getEditLayer() == null) return;449 if (Main.main == null || !Main.main.hasEditLayer()) return; 450 450 OsmDataLayer layer = Main.main.getEditLayer(); 451 451 Set<OsmPrimitive> target = new HashSet<OsmPrimitive>(); … … 464 464 465 465 public void updateEnabledState() { 466 if (Main.main == null || Main.main.getEditLayer() == null){466 if (Main.main == null || !Main.main.hasEditLayer()) { 467 467 setEnabled(false); 468 468 return; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java
r6267 r6336 158 158 // map view 159 159 lbl = lblQueries.get(BasicQuery.CHANGESETS_IN_MAP_VIEW); 160 if ( Main.map == null || Main.map.mapView == null) {160 if (!Main.isDisplayingMapView()) { 161 161 rbQueries.get(BasicQuery.CHANGESETS_IN_MAP_VIEW).setEnabled(false); 162 162 lbl.setText(tr("<html>Download changesets in the current map view.<br><em>Disabled. There is currently no map view active.</em></html>")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r6324 r6336 484 484 Main.map.relationListDialog.selectRelation(relation); 485 485 RelationEditor.getEditor( 486 Main.ma p.mapView.getEditLayer(),486 Main.main.getEditLayer(), 487 487 relation, 488 488 ((MemberInfo) membershipData.getValueAt(row, 1)).role).setVisible(true); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r6316 r6336 655 655 */ 656 656 protected boolean isActiveLayer() { 657 if ( Main.map == null || Main.map.mapView == null) return false;657 if (!Main.isDisplayingMapView()) return false; 658 658 return Main.map.mapView.getActiveLayer() == layer; 659 659 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java
r6316 r6336 52 52 @Override 53 53 public int getRowCount() { 54 if (Main.ma p.mapView.getEditLayer() != layer)54 if (Main.main.getEditLayer() != layer) 55 55 return 0; 56 56 return cache.size(); … … 89 89 @Override 90 90 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 91 if (layer == Main.ma p.mapView.getEditLayer()) {91 if (layer == Main.main.getEditLayer()) { 92 92 cache.clear(); 93 93 cache.addAll(newSelection); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r6316 r6336 104 104 referenceRelationMemberTableModel = new DiffTableModel(); 105 105 106 if (getEditLayer() != null) { 107 getEditLayer().data.addDataSetListener(this); 106 OsmDataLayer editLayer = Main.main.getEditLayer(); 107 if (editLayer != null) { 108 editLayer.data.addDataSetListener(this); 108 109 } 109 110 MapView.addLayerChangeListener(this); … … 120 121 CheckParameterUtil.ensureParameterNotNull(history, "history"); 121 122 setHistory(history); 122 }123 124 /**125 * Replies the current edit layer; null, if there isn't a current edit layer126 * of type {@link OsmDataLayer}.127 *128 * @return the current edit layer129 */130 protected OsmDataLayer getEditLayer() {131 try {132 return Main.map.mapView.getEditLayer();133 } catch(NullPointerException e) {134 return null;135 }136 123 } 137 124 … … 187 174 if (history.getNumVersions() > 0) { 188 175 HistoryOsmPrimitive newLatest = null; 189 if (getEditLayer() != null) { 190 OsmPrimitive p = getEditLayer().data.getPrimitiveById(history.getId(), history.getType()); 176 OsmDataLayer editLayer = Main.main.getEditLayer(); 177 if (editLayer != null) { 178 OsmPrimitive p = editLayer.data.getPrimitiveById(history.getId(), history.getType()); 191 179 if (canShowAsLatest(p)) { 192 180 newLatest = new HistoryPrimitiveBuilder().build(p); … … 536 524 public OsmPrimitive getLatest() { 537 525 if (latest == null) return null; 538 if (getEditLayer() == null) return null; 539 OsmPrimitive p = getEditLayer().data.getPrimitiveById(latest.getId(), latest.getType()); 526 OsmDataLayer editLayer = Main.main.getEditLayer(); 527 if (editLayer == null) return null; 528 OsmPrimitive p = editLayer.data.getPrimitiveById(latest.getId(), latest.getType()); 540 529 return p; 541 530 } … … 674 663 */ 675 664 public void unlinkAsListener() { 676 if (getEditLayer() != null) { 677 getEditLayer().data.removeDataSetListener(this); 665 OsmDataLayer editLayer = Main.main.getEditLayer(); 666 if (editLayer != null) { 667 editLayer.data.removeDataSetListener(this); 678 668 } 679 669 MapView.removeLayerChangeListener(this); -
trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java
r6147 r6336 207 207 if (!isEnabled()) return; 208 208 OsmPrimitive p = getPrimitiveToZoom(); 209 if (p!= null) { 210 getEditLayer().data.setSelected(p.getPrimitiveId()); 211 AutoScaleAction.autoScale("selection"); 209 if (p != null) { 210 OsmDataLayer editLayer = Main.main.getEditLayer(); 211 if (editLayer != null) { 212 editLayer.data.setSelected(p.getPrimitiveId()); 213 AutoScaleAction.autoScale("selection"); 214 } 212 215 } 213 216 } … … 218 221 } 219 222 220 protected OsmDataLayer getEditLayer() {221 try {222 return Main.map.mapView.getEditLayer();223 } catch(NullPointerException e) {224 return null;225 }226 }227 228 223 protected OsmPrimitive getPrimitiveToZoom() { 229 224 if (primitiveId == null) return null; 230 OsmPrimitive p = getEditLayer().data.getPrimitiveById(primitiveId); 225 OsmDataLayer editLayer = Main.main.getEditLayer(); 226 if (editLayer == null) return null; 227 OsmPrimitive p = editLayer.data.getPrimitiveById(primitiveId); 231 228 return p; 232 229 } 233 230 234 231 public void updateEnabledState() { 235 if ( getEditLayer() == null) {232 if (!Main.main.hasEditLayer()) { 236 233 setEnabled(false); 237 234 return; -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r6267 r6336 73 73 } 74 74 75 protected OsmDataLayer getEditLayer() {76 try {77 return Main.map.mapView.getEditLayer();78 } catch(NullPointerException e) {79 return null;80 }81 }82 83 75 protected String getInfoText() { 84 76 HistoryOsmPrimitive primitive = getPrimitive(); … … 87 79 String text; 88 80 if (model.isLatest(primitive)) { 81 OsmDataLayer editLayer = Main.main.getEditLayer(); 89 82 text = tr("<html>Version <strong>{0}</strong> currently edited in layer ''{1}''</html>", 90 83 Long.toString(primitive.getVersion()), 91 getEditLayer() == null ? tr("unknown") : getEditLayer().getName()84 editLayer == null ? tr("unknown") : editLayer.getName() 92 85 ); 93 86 } else { -
trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java
r6248 r6336 240 240 ); 241 241 if (ret == 0) { 242 DownloadReferrersAction.downloadReferrers(Main.ma p.mapView.getEditLayer(), Arrays.asList(conflict.a));242 DownloadReferrersAction.downloadReferrers(Main.main.getEditLayer(), Arrays.asList(conflict.a)); 243 243 } 244 244 } -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r6070 r6336 83 83 84 84 public double getPPD(){ 85 if ( Main.map == null || Main.map.mapView == null) return Main.getProjection().getDefaultZoomInPPD();85 if (!Main.isDisplayingMapView()) return Main.getProjection().getDefaultZoomInPPD(); 86 86 ProjectionBounds bounds = Main.map.mapView.getProjectionBounds(); 87 87 return Main.map.mapView.getWidth() / (bounds.maxEast - bounds.minEast); -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r6316 r6336 439 439 */ 440 440 private double getScaleFactor(int zoom) { 441 if ( Main.map == null || Main.map.mapView == null) return 1;441 if (!Main.isDisplayingMapView()) return 1; 442 442 MapView mv = Main.map.mapView; 443 443 LatLon topLeft = mv.getLatLon(0, 0); -
trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
r6333 r6336 156 156 @Override 157 157 public void layerRemoved(Layer oldLayer) { 158 if (oldLayer instanceof OsmDataLayer && Main.isDisplayingMapView() && Main.map.mapView.getEditLayer() == null) {158 if (oldLayer instanceof OsmDataLayer && Main.isDisplayingMapView() && !Main.main.hasEditLayer()) { 159 159 Main.main.removeLayer(this); 160 160 } else if (oldLayer == this) { -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r6310 r6336 432 432 private static void playAdjacentMarker(Marker startMarker, boolean next) { 433 433 Marker m = null; 434 if ( Main.map == null || Main.map.mapView == null)434 if (!Main.isDisplayingMapView()) 435 435 return; 436 436 Layer l = Main.map.mapView.getActiveLayer(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
r6075 r6336 65 65 @Override 66 66 public void updateEnabledState() { 67 setEnabled(Main.isDisplayingMapView() && (Main.main. getEditLayer() != null|| mapHasGpxorMarkerLayer()));67 setEnabled(Main.isDisplayingMapView() && (Main.main.hasEditLayer() || mapHasGpxorMarkerLayer())); 68 68 } 69 69 -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItem.java
r6198 r6336 28 28 } 29 29 AutoCompletionList list = new AutoCompletionList(); 30 Main.main.getEditLayer().data.getAutoCompletionManager().populateWithTagValues(list, key);30 layer.data.getAutoCompletionManager().populateWithTagValues(list, key); 31 31 field.setAutoCompletionList(list); 32 32 }
Note:
See TracChangeset
for help on using the changeset viewer.