- Timestamp:
- 2010-05-08T17:04:34+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r2884 r3220 21 21 import javax.swing.AbstractAction; 22 22 import javax.swing.Icon; 23 import javax.swing.JCheckBoxMenuItem; 23 24 import javax.swing.JColorChooser; 24 25 import javax.swing.JMenuItem; … … 282 283 Collection<Component> components = new ArrayList<Component>(); 283 284 components.add(new JMenuItem(LayerListDialog.getInstance().createShowHideLayerAction(this))); 284 components.add(new JMenuItem(new ShowHideMarkerText(this))); 285 JCheckBoxMenuItem showMarkerTextItem = new JCheckBoxMenuItem(new ShowHideMarkerText(this)); 286 showMarkerTextItem.setState(isTextShown()); 287 components.add(showMarkerTextItem); 285 288 components.add(new JMenuItem(LayerListDialog.getInstance().createDeleteLayerAction(this))); 286 289 components.add(new JSeparator()); … … 449 452 } 450 453 454 private boolean isTextShown() { 455 String current = Main.pref.get("marker.show "+getName(),"show"); 456 return current.equalsIgnoreCase("show"); 457 } 458 451 459 public static final class ShowHideMarkerText extends AbstractAction { 452 private final Layer layer;453 454 public ShowHideMarkerText( Layer layer) {455 super(tr("Show /HideText/Icons"), ImageProvider.get("dialogs", "showhide"));460 private final MarkerLayer layer; 461 462 public ShowHideMarkerText(MarkerLayer layer) { 463 super(tr("Show Text/Icons"), ImageProvider.get("dialogs", "showhide")); 456 464 putValue(SHORT_DESCRIPTION, tr("Toggle visible state of the marker text and icons.")); 457 465 putValue("help", "Action/ShowHideTextIcons"); … … 459 467 } 460 468 469 461 470 public void actionPerformed(ActionEvent e) { 462 String current = Main.pref.get("marker.show "+layer.getName(),"show"); 463 Main.pref.put("marker.show "+layer.getName(), current.equalsIgnoreCase("show") ? "hide" : "show"); 471 Main.pref.put("marker.show "+layer.getName(), layer.isTextShown() ? "hide" : "show"); 464 472 Main.map.mapView.repaint(); 465 473 }
Note:
See TracChangeset
for help on using the changeset viewer.