Changeset 2343 in josm
- Timestamp:
- 2009-10-28T20:14:07+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r2328 r2343 70 70 71 71 abstract public class Main { 72 73 /** 74 * Replies true if JOSM currently displays a map view. False, if it doesn't, i.e. if 75 * it only shows the MOTD panel. 76 * 77 * @return true if JOSM currently displays a map view 78 */ 79 static public boolean isDisplayingMapView() { 80 if (map == null) return false; 81 if (map.mapView == null) return false; 82 return true; 83 } 72 84 /** 73 85 * Global parent component for all dialogs and message boxes -
trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java
r2032 r2343 33 33 34 34 protected boolean isActiveLayer(Layer layer) { 35 if (Main.map == null) 36 return false; 37 if (Main.map.mapView == null) 38 return false; 35 if (Main.isDisplayingMapView()) return false; 39 36 return Main.map.mapView.getActiveLayer() == layer; 40 37 } -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r2323 r2343 181 181 } else { 182 182 setEnabled( 183 Main.map != null 184 && Main.map.mapView != null 183 Main.isDisplayingMapView() 185 184 && Main.map.mapView.hasLayers() 186 185 ); -
trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
r2323 r2343 92 92 93 93 public void actionPerformed(ActionEvent e) { 94 if (!isEnabled() || Main.map == null || Main.map.mapView == null)94 if (!isEnabled() || ! Main.isDisplayingMapView()) 95 95 return; 96 96 OsmDataLayer layer = Main.map.mapView.getEditLayer(); -
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r2323 r2343 33 33 34 34 protected GpxLayer getLayer() { 35 if (Main.map == null) return null; 36 if (Main.map.mapView == null) return null; 35 if (!Main.isDisplayingMapView()) return null; 37 36 if (Main.map.mapView.getActiveLayer() == null) return null; 38 37 Layer layer = Main.map.mapView.getActiveLayer(); … … 95 94 @Override 96 95 protected void updateEnabledState() { 97 boolean check = Main.main != null 98 && Main.map != null 99 && Main.map.mapView !=null 96 boolean check = 97 Main.isDisplayingMapView() 100 98 && Main.map.mapView.getActiveLayer() != null; 101 99 if(!check) { -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r2273 r2343 36 36 public boolean doSave() { 37 37 Layer layer = null; 38 if (Main. map != null&& (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer38 if (Main.isDisplayingMapView() && (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer 39 39 || Main.map.mapView.getActiveLayer() instanceof GpxLayer)) { 40 40 layer = Main.map.mapView.getActiveLayer(); -
trunk/src/org/openstreetmap/josm/actions/ZoomInAction.java
r2323 r2343 20 20 21 21 public void actionPerformed(ActionEvent e) { 22 if ( Main.map == null) return;22 if (!Main.isDisplayingMapView()) return; 23 23 Main.map.mapView.zoomToFactor(0.9); 24 24 } … … 27 27 protected void updateEnabledState() { 28 28 setEnabled( 29 Main.map != null 30 && Main.map.mapView != null 29 Main.isDisplayingMapView() 31 30 && Main.map.mapView.hasLayers() 32 31 ); -
trunk/src/org/openstreetmap/josm/actions/ZoomOutAction.java
r2323 r2343 20 20 21 21 public void actionPerformed(ActionEvent e) { 22 if ( Main.map == null) return;22 if (!Main.isDisplayingMapView()) return; 23 23 Main.map.mapView.zoomToFactor(1/0.9); 24 24 } … … 27 27 protected void updateEnabledState() { 28 28 setEnabled( 29 Main.map != null 30 && Main.map.mapView != null 29 Main.isDisplayingMapView() 31 30 && Main.map.mapView.hasLayers() 32 31 ); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
r2328 r2343 87 87 private Layer findMergeLayer() { 88 88 boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false); 89 if ( Main.map == null)89 if (!Main.isDisplayingMapView()) 90 90 return null; 91 91 Layer active = Main.map.mapView.getActiveLayer(); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r2328 r2343 104 104 105 105 protected OsmDataLayer getEditLayer() { 106 if (Main.map == null) return null; 107 if (Main.map.mapView == null) return null; 106 if (!Main.isDisplayingMapView()) return null; 108 107 return Main.map.mapView.getEditLayer(); 109 108 } … … 111 110 protected int getNumDataLayers() { 112 111 int count = 0; 113 if (Main.map == null) return 0; 114 if (Main.map.mapView == null) return 0; 112 if (!Main.isDisplayingMapView()) return 0; 115 113 Collection<Layer> layers = Main.map.mapView.getAllLayers(); 116 114 for (Layer layer : layers) { … … 123 121 124 122 protected OsmDataLayer getFirstDataLayer() { 125 if (Main.map == null) return null; 126 if (Main.map.mapView == null) return null; 123 if (!Main.isDisplayingMapView()) return null; 127 124 Collection<Layer> layers = Main.map.mapView.getAllLayersAsList(); 128 125 for (Layer layer : layers) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r2308 r2343 176 176 */ 177 177 private void updateCursor(MouseEvent e, int modifiers) { 178 if (!Main.isDisplayingMapView()) { 179 return; 180 } 178 181 if(!Main.map.mapView.isActiveLayerVisible() || e == null) 179 182 return;
Note:
See TracChangeset
for help on using the changeset viewer.