Changeset 10318 in josm
- Timestamp:
- 2016-06-02T23:04:53+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r10212 r10318 169 169 } else if (type == ImageryType.TMS || type == ImageryType.BING || type == ImageryType.SCANEX) { 170 170 setEnabled(true); 171 } else if (Main.isDisplayingMapView() && !Main.map.mapView.getAllLayers().isEmpty()) {172 setEnabled(true);173 171 } else { 174 setEnabled( false);172 setEnabled(!Main.getLayerManager().getLayers().isEmpty()); 175 173 } 176 174 } -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r10216 r10318 261 261 262 262 private static BoundingXYVisitor modeData(BoundingXYVisitor v) { 263 for (Layer l : Main. map.mapView.getAllLayers()) {263 for (Layer l : Main.getLayerManager().getLayers()) { 264 264 l.visitBoundingBox(v); 265 265 } … … 364 364 break; 365 365 default: 366 setEnabled( Main.isDisplayingMapView() && Main.map.mapView.hasLayers());366 setEnabled(!Main.getLayerManager().getLayers().isEmpty()); 367 367 } 368 368 } -
trunk/src/org/openstreetmap/josm/actions/DeleteLayerAction.java
r9448 r10318 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;6 6 7 7 import java.awt.event.ActionEvent; … … 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.gui.layer.Layer; 12 13 import org.openstreetmap.josm.tools.Shortcut; 13 import org.openstreetmap.josm.gui.layer.Layer;14 14 15 15 /** … … 42 42 @Override 43 43 protected void updateEnabledState() { 44 setEnabled(Main. isDisplayingMapView() && Main.map.mapView.getActiveLayer() != null);44 setEnabled(Main.getLayerManager().getActiveLayer() != null); 45 45 } 46 46 } -
trunk/src/org/openstreetmap/josm/actions/DownloadNotesInViewAction.java
r9276 r10318 43 43 @Override 44 44 protected void updateEnabledState() { 45 setEnabled(Main.isDisplayingMapView() 46 && Main.map.mapView.getActiveLayer() != null 45 setEnabled(Main.getLayerManager().getActiveLayer() != null 47 46 && !Main.isOffline(OnlineResource.OSM_API)); 48 47 } -
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r9461 r10318 43 43 */ 44 44 protected Layer getLayer() { 45 if (!Main.isDisplayingMapView()) 46 return null; 47 Layer layer = Main.map.mapView.getActiveLayer(); 45 Layer layer = Main.getLayerManager().getActiveLayer(); 48 46 return (layer instanceof GpxLayer || layer instanceof OsmDataLayer) ? layer : null; 49 47 } -
trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java
r8925 r10318 239 239 @Override 240 240 protected void updateEnabledState() { 241 setEnabled( Main.isDisplayingMapView() && !Main.map.mapView.getAllLayers().isEmpty());241 setEnabled(!Main.getLayerManager().getLayers().isEmpty()); 242 242 } 243 243 } -
trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java
r8819 r10318 64 64 } 65 65 if (layerMerged) { 66 Main. map.mapView.setActiveLayer(targetLayer);66 Main.getLayerManager().setActiveLayer(targetLayer); 67 67 } 68 68 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r10007 r10318 52 52 */ 53 53 public boolean doSave() { 54 if (Main.isDisplayingMapView()) { 55 Layer layer = Main.map.mapView.getActiveLayer(); 56 if (layer != null && layer.isSavable()) { 57 return doSave(layer); 58 } 54 Layer layer = Main.getLayerManager().getActiveLayer(); 55 if (layer != null && layer.isSavable()) { 56 return doSave(layer); 59 57 } 60 58 return false; … … 134 132 @Override 135 133 protected void updateEnabledState() { 136 boolean check = Main.isDisplayingMapView() 137 && Main.map.mapView.getActiveLayer() != null; 138 if (!check) { 139 setEnabled(false); 140 return; 141 } 142 Layer layer = Main.map.mapView.getActiveLayer(); 143 setEnabled(layer != null && layer.isSavable()); 134 Layer activeLayer = Main.getLayerManager().getActiveLayer(); 135 setEnabled(activeLayer != null && activeLayer.isSavable()); 144 136 } 145 137 -
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r10212 r10318 136 136 } 137 137 if (active != null) { 138 Main. map.mapView.setActiveLayer(active);138 Main.getLayerManager().setActiveLayer(active); 139 139 } 140 140 if (noMap) { -
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r9631 r10318 161 161 162 162 int active = -1; 163 Layer activeLayer = Main. map.mapView.getActiveLayer();163 Layer activeLayer = Main.getLayerManager().getActiveLayer(); 164 164 if (activeLayer != null) { 165 165 active = layersOut.indexOf(activeLayer); … … 204 204 */ 205 205 public final void initialize() { 206 layers = new ArrayList<>(Main. map.mapView.getAllLayersAsList());206 layers = new ArrayList<>(Main.getLayerManager().getLayers()); 207 207 exporters = new HashMap<>(); 208 208 dependencies = new MultiMap<>(); -
trunk/src/org/openstreetmap/josm/actions/UploadNotesAction.java
r8510 r10318 31 31 @Override 32 32 public void actionPerformed(ActionEvent e) { 33 List<NoteLayer> noteLayers = null; 34 if (Main.map != null) { 35 noteLayers = Main.map.mapView.getLayersOfType(NoteLayer.class); 36 } 33 List<NoteLayer> noteLayers = Main.getLayerManager().getLayersOfType(NoteLayer.class); 37 34 NoteLayer layer; 38 if ( noteLayers != null &&!noteLayers.isEmpty()) {35 if (!noteLayers.isEmpty()) { 39 36 layer = noteLayers.get(0); 40 37 } else { … … 42 39 return; 43 40 } 44 if (Main.isDebugEnabled()) { 45 Main.debug("uploading note changes"); 46 } 41 Main.debug("uploading note changes"); 47 42 NoteData noteData = layer.getNoteData(); 48 43 49 44 if (noteData == null || !noteData.isModified()) { 50 if (Main.isDebugEnabled()) { 51 Main.debug("No changed notes to upload"); 52 } 45 Main.debug("No changed notes to upload"); 53 46 return; 54 47 } -
trunk/src/org/openstreetmap/josm/actions/ZoomInAction.java
r9818 r10318 52 52 @Override 53 53 protected void updateEnabledState() { 54 setEnabled( 55 Main.isDisplayingMapView() 56 && Main.map.mapView.hasLayers() 57 ); 54 setEnabled(!Main.getLayerManager().getLayers().isEmpty()); 58 55 } 59 56 -
trunk/src/org/openstreetmap/josm/actions/ZoomOutAction.java
r9818 r10318 38 38 @Override 39 39 protected void updateEnabledState() { 40 setEnabled( 41 Main.isDisplayingMapView() 42 && Main.map.mapView.hasLayers() 43 ); 40 setEnabled(!Main.getLayerManager().getLayers().isEmpty()); 44 41 } 45 42 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
r10212 r10318 155 155 156 156 private GpxLayer findGpxMergeLayer() { 157 if (!Main.isDisplayingMapView())158 return null;159 157 boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false); 160 Layer active = Main. map.mapView.getActiveLayer();158 Layer active = Main.getLayerManager().getActiveLayer(); 161 159 if (active instanceof GpxLayer && (merge || ((GpxLayer) active).data.fromServer)) 162 160 return (GpxLayer) active; 163 for (GpxLayer l : Main. map.mapView.getLayersOfType(GpxLayer.class)) {161 for (GpxLayer l : Main.getLayerManager().getLayersOfType(GpxLayer.class)) { 164 162 if (merge || l.data.fromServer) 165 163 return l; … … 169 167 170 168 private MarkerLayer findMarkerMergeLayer(GpxLayer fromLayer) { 171 if (!Main.isDisplayingMapView()) 172 return null; 173 for (MarkerLayer l : Main.map.mapView.getLayersOfType(MarkerLayer.class)) { 169 for (MarkerLayer l : Main.getLayerManager().getLayersOfType(MarkerLayer.class)) { 174 170 if (fromLayer != null && l.fromLayer == fromLayer) 175 171 return l; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r10212 r10318 113 113 } 114 114 115 List<NoteLayer> noteLayers = null; 116 if (Main.map != null) { 117 noteLayers = Main.map.mapView.getLayersOfType(NoteLayer.class); 118 } 119 if (noteLayers != null && !noteLayers.isEmpty()) { 115 List<NoteLayer> noteLayers = Main.getLayerManager().getLayersOfType(NoteLayer.class); 116 if (!noteLayers.isEmpty()) { 120 117 noteLayers.get(0).getNoteData().addNotes(notesData); 121 118 } else { -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r10315 r10318 20 20 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 21 21 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 22 import org.openstreetmap.josm.gui.layer.Layer;23 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 24 23 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 217 216 218 217 protected int getNumDataLayers() { 219 if (!Main.isDisplayingMapView()) return 0; 220 return Utils.filteredCollection(Main.map.mapView.getAllLayers(), OsmDataLayer.class).size(); 218 return Main.getLayerManager().getLayersOfType(OsmDataLayer.class).size(); 221 219 } 222 220 223 221 protected OsmDataLayer getFirstDataLayer() { 224 if (!Main.isDisplayingMapView()) return null; 225 Collection<Layer> layers = Main.map.mapView.getAllLayersAsList(); 226 for (Layer layer : layers) { 227 if (layer instanceof OsmDataLayer) 228 return (OsmDataLayer) layer; 229 } 230 return null; 222 return Utils.find(Main.getLayerManager().getLayers(), OsmDataLayer.class); 231 223 } 232 224 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r10250 r10318 73 73 Layer l = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null); 74 74 Main.main.addLayer(l); 75 Main. map.mapView.setActiveLayer(l);75 Main.getLayerManager().setActiveLayer(l); 76 76 } 77 77
Note:
See TracChangeset
for help on using the changeset viewer.