Changeset 6327 in josm
- Timestamp:
- 2013-10-27T02:15:10+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ChangesetManagerToggleAction.java
r6220 r6327 40 40 @Override 41 41 public void actionPerformed(ActionEvent e) { 42 toggleSelectedState( );42 toggleSelectedState(e); 43 43 notifySelectedState(); 44 44 if (isSelected()) { -
trunk/src/org/openstreetmap/josm/actions/DialogsToggleAction.java
r6220 r6327 38 38 @Override 39 39 public void actionPerformed(ActionEvent e) { 40 toggleSelectedState( );40 toggleSelectedState(e); 41 41 Main.pref.put("draw.dialogspanel", isSelected()); 42 42 notifySelectedState(); -
trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java
r6220 r6327 140 140 @Override 141 141 public void actionPerformed(ActionEvent e) { 142 toggleSelectedState( );142 toggleSelectedState(e); 143 143 Main.pref.put("expert", isSelected()); 144 144 notifySelectedState(); -
trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java
r6220 r6327 52 52 @Override 53 53 public void actionPerformed(ActionEvent e) { 54 toggleSelectedState( );54 toggleSelectedState(e); 55 55 Main.pref.put("draw.fullscreen", isSelected()); 56 56 notifySelectedState(); -
trunk/src/org/openstreetmap/josm/actions/ToggleAction.java
r6220 r6327 2 2 package org.openstreetmap.josm.actions; 3 3 4 import java.awt.event.ActionEvent; 4 5 import java.util.ArrayList; 5 6 import java.util.List; … … 7 8 import javax.swing.ButtonModel; 8 9 import javax.swing.Icon; 10 import javax.swing.JCheckBox; 11 import javax.swing.JCheckBoxMenuItem; 12 import javax.swing.JRadioButton; 13 import javax.swing.JRadioButtonMenuItem; 14 import javax.swing.JToggleButton; 9 15 10 16 import org.openstreetmap.josm.tools.Shortcut; … … 101 107 } 102 108 103 protected final void toggleSelectedState() { 104 setSelected(!isSelected()); 109 /** 110 * Toggles the selcted action state, if needed according to the ActionEvent that trigerred the action. 111 * This method will do nothing if the action event comes from a Swing component supporting the SELECTED_KEY property because the component already set the selected state. 112 * This method needs to be called especially if the action is associated with a keyboard shortcut to ensure correct selected state. 113 * @see <a href="https://weblogs.java.net/blog/zixle/archive/2005/11/changes_to_acti.html">Changes to Actions in 1.6</a> 114 * @see <a href="http://docs.oracle.com/javase/6/docs/api/javax/swing/Action.html">Interface Action</a> 115 */ 116 protected final void toggleSelectedState(ActionEvent e) { 117 if (e == null || !(e.getSource() instanceof JToggleButton || 118 e.getSource() instanceof JCheckBox || 119 e.getSource() instanceof JRadioButton || 120 e.getSource() instanceof JCheckBoxMenuItem || 121 e.getSource() instanceof JRadioButtonMenuItem 122 )) { 123 setSelected(!isSelected()); 124 } 105 125 } 106 126 } -
trunk/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java
r6220 r6327 35 35 @Override 36 36 public void actionPerformed(ActionEvent e) { 37 toggleSelectedState( );37 toggleSelectedState(e); 38 38 Main.map.mapView.viewportFollowing = isSelected(); 39 39 notifySelectedState(); -
trunk/src/org/openstreetmap/josm/actions/WireframeToggleAction.java
r6220 r6327 42 42 @Override 43 43 public void actionPerformed(ActionEvent e) { 44 toggleSelectedState( );44 toggleSelectedState(e); 45 45 if (isSelected()) { 46 46 MapRendererFactory.getInstance().activate(WireframeMapRenderer.class);
Note:
See TracChangeset
for help on using the changeset viewer.