Changeset 1379 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-02-08T11:34:23+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r1169 r1379 15 15 import org.openstreetmap.josm.data.osm.WaySegment; 16 16 import org.openstreetmap.josm.gui.MapFrame; 17 import org.openstreetmap.josm.gui.layer.Layer; 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 17 19 import org.openstreetmap.josm.tools.ImageProvider; 18 20 import org.openstreetmap.josm.tools.Shortcut; … … 129 131 return tr("Click to delete. Shift: delete way segment. Alt: don't delete unused nodes when deleting a way. Ctrl: delete referring objects."); 130 132 } 133 134 @Override public boolean layerIsSupported(Layer l) { 135 return l instanceof OsmDataLayer; 136 } 131 137 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1317 r1379 50 50 import org.openstreetmap.josm.gui.MapView; 51 51 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 52 import org.openstreetmap.josm.gui.layer.Layer; 53 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 52 54 import org.openstreetmap.josm.tools.ImageProvider; 53 55 import org.openstreetmap.josm.tools.Pair; … … 647 649 return rv.toString(); 648 650 } 651 652 @Override public boolean layerIsSupported(Layer l) { 653 return l instanceof OsmDataLayer; 654 } 649 655 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r1313 r1379 29 29 import org.openstreetmap.josm.gui.MapView; 30 30 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 31 import org.openstreetmap.josm.gui.layer.Layer; 32 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 31 33 import org.openstreetmap.josm.tools.ImageProvider; 32 34 import org.openstreetmap.josm.tools.Shortcut; … … 257 259 } 258 260 } 261 262 @Override public boolean layerIsSupported(Layer l) { 263 return l instanceof OsmDataLayer; 264 } 259 265 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java
r1180 r1379 10 10 import org.openstreetmap.josm.Main; 11 11 import org.openstreetmap.josm.actions.JosmAction; 12 import org.openstreetmap.josm.gui.layer.Layer; 12 13 import org.openstreetmap.josm.gui.MapFrame; 13 14 import org.openstreetmap.josm.tools.ImageProvider; … … 71 72 Main.map.selectMapMode(this); 72 73 } 74 75 // By default, all tools will work with all layers. Can be overwritten to require 76 // a special type of layer 77 public boolean layerIsSupported(Layer l) { 78 return true; 79 } 73 80 74 81 public void mouseReleased(MouseEvent e) {} -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r1313 r1379 32 32 import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor; 33 33 import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor; 34 import org.openstreetmap.josm.gui.layer.Layer; 35 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 34 36 import org.openstreetmap.josm.gui.MapFrame; 35 37 import org.openstreetmap.josm.gui.MapView; … … 395 397 } 396 398 } 399 400 @Override public boolean layerIsSupported(Layer l) { 401 return l instanceof OsmDataLayer; 402 } 397 403 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r1265 r1379 15 15 import java.awt.image.BufferedImage; 16 16 import java.util.ArrayList; 17 import java.util.Enumeration; 17 18 import java.util.Collection; 18 19 import java.util.Collections; 19 20 import java.util.LinkedList; 20 21 22 import javax.swing.AbstractButton; 21 23 import javax.swing.JComponent; 22 24 import javax.swing.JOptionPane; … … 25 27 import org.openstreetmap.josm.actions.AutoScaleAction; 26 28 import org.openstreetmap.josm.actions.JosmAction; 29 import org.openstreetmap.josm.actions.mapmode.MapMode; 27 30 import org.openstreetmap.josm.actions.MoveAction; 28 31 import org.openstreetmap.josm.data.Bounds; … … 357 360 l.activeLayerChange(old, layer); 358 361 } 362 363 /* This only makes the buttons look disabled. Disabling the actions as well requires 364 * the user to re-select the tool after i.e. moving a layer. While testing I found 365 * that I switch layers and actions at the same time and it was annoying to mind the 366 * order. This way it works as visual clue for new users */ 367 for (Enumeration e = Main.map.toolGroup.getElements() ; e.hasMoreElements() ;) { 368 AbstractButton x=(AbstractButton)e.nextElement(); 369 x.setEnabled(((MapMode)x.getAction()).layerIsSupported(layer)); 370 } 359 371 repaint(); 360 372 }
Note:
See TracChangeset
for help on using the changeset viewer.