Changeset 5088 in josm for trunk/src/org
- Timestamp:
- 2012-03-15T10:19:24+01:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MenuScroller.java
r4593 r5088 10 10 import java.awt.event.ActionEvent; 11 11 import java.awt.event.ActionListener; 12 import java.awt.event.MouseWheelEvent;13 import java.awt.event.MouseWheelListener;14 import java.beans.PropertyChangeEvent;15 import java.beans.PropertyChangeListener;16 12 import javax.swing.Icon; 17 13 import javax.swing.JComponent; -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r5030 r5088 362 362 * Opens preferences window and selects the mappaint tab. 363 363 */ 364 static class LaunchMapPaintPreferencesAction extends AbstractAction { 364 public static class LaunchMapPaintPreferencesAction extends AbstractAction { 365 365 public LaunchMapPaintPreferencesAction() { 366 366 putValue(NAME, tr("Preferences")); -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
r5086 r5088 5 5 import java.awt.event.ActionEvent; 6 6 import java.util.HashMap; 7 import java.util.HashSet;8 7 import java.util.Map; 9 import java.util.Set;10 8 import javax.swing.JCheckBoxMenuItem; 11 9 import javax.swing.JMenu; 12 10 import org.openstreetmap.josm.Main; 13 11 import org.openstreetmap.josm.actions.JosmAction; 12 import org.openstreetmap.josm.gui.dialogs.MapPaintDialog; 13 import org.openstreetmap.josm.gui.dialogs.MapPaintDialog.LaunchMapPaintPreferencesAction; 14 14 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener; 15 import org.openstreetmap.josm.gui.util.StayOpenCheckBoxMenuItem; 15 16 import org.openstreetmap.josm.tools.ImageProvider; 16 17 … … 29 30 Main.toolbar.register(this); 30 31 } 31 this.button = new JCheckBoxMenuItem(this);32 this.button = new StayOpenCheckBoxMenuItem(this); 32 33 this.style = style; 33 34 updateButton(); … … 57 58 } 58 59 } 59 private Map<String, MapPaintAction> actions = new HashMap<String, MapPaintAction>(); 60 private final Map<String, MapPaintAction> actions = new HashMap<String, MapPaintAction>(); 61 private final LaunchMapPaintPreferencesAction mapPaintPreferencesAction = new MapPaintDialog.LaunchMapPaintPreferencesAction() { 62 63 { 64 putValue("toolbar", "mappaintpreference"); 65 } 66 }; 60 67 61 68 public MapPaintMenu() { … … 67 74 @Override 68 75 public void mapPaintStylesUpdated() { 69 final Set<String> actionsToRemove = new HashSet<String>(actions.keySet());76 removeAll(); 70 77 for (StyleSource style : MapPaintStyles.getStyles().getStyleSources()) { 71 78 final String k = style.getDisplayString(); 72 79 MapPaintAction a = actions.get(k); 73 80 if (a == null) { 74 a = new MapPaintAction(style); 81 actions.put(k, a = new MapPaintAction(style)); 75 82 add(a.getButton()); 76 actions.put(k, a);77 83 } else { 84 add(a.getButton()); 78 85 a.updateButton(); 79 actionsToRemove.remove(k);80 86 } 81 87 } 82 for (String k : actionsToRemove) { 83 final MapPaintAction a = actions.get(k); 84 if (a != null) { 85 remove(a.getButton()); 86 actions.remove(k); 87 } 88 } 88 addSeparator(); 89 add(mapPaintPreferencesAction); 89 90 } 90 91
Note:
See TracChangeset
for help on using the changeset viewer.