Changeset 5472 in josm
- Timestamp:
- 2012-08-23T02:25:01+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 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 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r5460 r5472 215 215 private boolean paintPreferencesChanged = true; 216 216 private Rectangle lastClipBounds = new Rectangle(); 217 private MapMover mapMover; 217 218 218 219 /** … … 235 236 scaler.setLocation(10,30); 236 237 237 new MapMover(MapView.this, contentPane);238 mapMover = new MapMover(MapView.this, contentPane); 238 239 OsmDataLayer layer = getEditLayer(); 239 240 if (layer != null) { … … 887 888 DataSet.removeSelectionListener(repaintSelectionChangedListener); 888 889 MultipolygonCache.getInstance().clear(this); 890 if (mapMover != null) { 891 mapMover.destroy(); 892 } 889 893 } 890 894 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r5459 r5472 7 7 import java.awt.BorderLayout; 8 8 import java.awt.Component; 9 import java.awt.Container; 9 10 import java.awt.Cursor; 10 11 import java.awt.Dialog.ModalityType; … … 1678 1679 action.destroy(); 1679 1680 } 1681 Container parent = pluginHook.getParent(); 1682 if (parent != null) { 1683 parent.remove(pluginHook); 1684 } 1680 1685 } 1681 1686 }
Note:
See TracChangeset
for help on using the changeset viewer.