Changeset 5472 in josm for trunk/src/org/openstreetmap/josm/gui/MapMover.java
- Timestamp:
- 2012-08-23T02:25:01+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapMover.java
r4982 r5472 15 15 16 16 import javax.swing.AbstractAction; 17 import javax.swing.ActionMap; 18 import javax.swing.InputMap; 17 19 import javax.swing.JComponent; 18 20 import javax.swing.JPanel; 21 import javax.swing.KeyStroke; 19 22 20 23 import org.openstreetmap.josm.Main; 21 24 import org.openstreetmap.josm.data.coor.EastNorth; 25 import org.openstreetmap.josm.tools.Destroyable; 22 26 import org.openstreetmap.josm.tools.PlatformHookOsx; 23 27 import org.openstreetmap.josm.tools.Shortcut; … … 29 33 * @author imi 30 34 */ 31 public class MapMover extends MouseAdapter implements MouseMotionListener, MouseWheelListener {35 public class MapMover extends MouseAdapter implements MouseMotionListener, MouseWheelListener, Destroyable { 32 36 33 37 private final class ZoomerAction extends AbstractAction { … … 67 71 */ 68 72 private final NavigatableComponent nc; 73 private final JPanel contentPane; 69 74 70 75 private boolean movementInPlace = false; … … 75 80 public MapMover(NavigatableComponent navComp, JPanel contentPane) { 76 81 this.nc = navComp; 82 this.contentPane = contentPane; 77 83 nc.addMouseListener(this); 78 84 nc.addMouseMotionListener(this); … … 217 223 } 218 224 225 @Override 226 public void destroy() { 227 if (this.contentPane != null) { 228 InputMap inputMap = contentPane.getInputMap(); 229 KeyStroke[] inputKeys = inputMap.keys(); 230 if (inputKeys != null) { 231 for (KeyStroke key : inputKeys) { 232 Object binding = inputMap.get(key); 233 if (binding instanceof String && ((String)binding).startsWith("MapMover.")) { 234 inputMap.remove(key); 235 } 236 } 237 } 238 ActionMap actionMap = contentPane.getActionMap(); 239 Object[] actionsKeys = actionMap.keys(); 240 if (actionsKeys != null) { 241 for (Object key : actionsKeys) { 242 if (key instanceof String && ((String)key).startsWith("MapMover.")) { 243 actionMap.remove(key); 244 } 245 } 246 } 247 } 248 } 219 249 }
Note:
See TracChangeset
for help on using the changeset viewer.