Changeset 5463 in josm
- Timestamp:
- 2012-08-20T22:30:52+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ValidateAction.java
r5452 r5463 45 45 public ValidateAction() { 46 46 super(tr("Validation"), "dialogs/validator", tr("Performs the data validation"), 47 Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")),48 KeyEvent.VK_V, Shortcut.SHIFT), true);47 Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), 48 KeyEvent.VK_V, Shortcut.SHIFT), true); 49 49 } 50 50 … … 64 64 */ 65 65 public void doValidate(ActionEvent ev, boolean getSelectedItems) { 66 if (Main.ma in.validator.validateAction == null || Main.map == null || !Main.map.isVisible())66 if (Main.map == null || !Main.map.isVisible()) 67 67 return; 68 68 -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r5415 r5463 22 22 23 23 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.actions.ValidateAction;25 24 import org.openstreetmap.josm.data.projection.Epsg4326; 26 25 import org.openstreetmap.josm.data.projection.Lambert; … … 68 67 public static ValidatorLayer errorLayer = null; 69 68 70 /** The validate action */71 public ValidateAction validateAction = new ValidateAction();72 73 69 /** Grid detail, multiplier of east,north values for valuable cell sizing */ 74 70 public static double griddetail; -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r5459 r5463 27 27 28 28 public class ImageryMenu extends JMenu implements MapView.LayerChangeListener { 29 Action offsetAction = new JosmAction(29 private Action offsetAction = new JosmAction( 30 30 tr("Imagery offset"), "mapmode/adjustimg", tr("Adjust imagery offset"), null, false, false) { 31 31 { … … 65 65 } 66 66 }; 67 JMenuItem singleOffset = new JMenuItem(offsetAction);68 JMenuItem offsetMenuItem = singleOffset;69 Map_Rectifier_WMSmenuAction rectaction = new Map_Rectifier_WMSmenuAction();70 int offsPos;67 private JMenuItem singleOffset = new JMenuItem(offsetAction); 68 private JMenuItem offsetMenuItem = singleOffset; 69 private Map_Rectifier_WMSmenuAction rectaction = new Map_Rectifier_WMSmenuAction(); 70 private int offsPos; 71 71 72 72 public ImageryMenu() { -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r5459 r5463 52 52 import org.openstreetmap.josm.data.Preferences; 53 53 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 54 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 54 55 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 55 56 import org.openstreetmap.josm.gui.dialogs.ChangesetDialog; … … 147 148 setLayout(new BorderLayout()); 148 149 149 150 150 151 mapView = new MapView(contentPane); 151 152 152 153 new FileDrop(mapView); 153 154 leftPanel = new JPanel(); 154 155 leftPanel = new JPanel(); 155 156 leftPanel.setLayout(new GridBagLayout()); 156 157 leftPanel.add(mapView, GBC.std().fill()); 158 157 158 leftPanel.add(mapView, GBC.std().fill()); 159 159 160 // toolbar 160 161 toolBarActions.setFloatable(false); … … 256 257 MapView.removeLayerChangeListener(this); 257 258 dialogsPanel.destroy(); 259 Main.pref.removePreferenceChangeListener(sidetoolbarPreferencesChangedListener); 258 260 for (int i = 0; i < toolBarActions.getComponentCount(); ++i) { 259 261 if (toolBarActions.getComponent(i) instanceof Destroyable) { … … 431 433 })); 432 434 433 Main.pref.addPreferenceChangeListener(new Preferences.PreferenceChangedListener() {435 sidetoolbarPreferencesChangedListener = new Preferences.PreferenceChangedListener() { 434 436 435 437 @Override … … 439 441 } 440 442 } 441 }); 443 }; 444 Main.pref.addPreferenceChangeListener(sidetoolbarPreferencesChangedListener); 442 445 443 446 if (statusLine != null && Main.pref.getBoolean("statusline.visible", true)) { … … 539 542 Main.pref.putInteger("toggleDialogs.width", dialogsPanel.getWidth()); 540 543 } 541 542 544 545 /* 543 546 * Remove panel from top of MapView by class 544 547 */ 545 548 public void removeTopPanel(Class<?> type) { 546 549 int n = leftPanel.getComponentCount(); 547 550 for (int i=0; i<n; i++) { … … 550 553 leftPanel.remove(i); 551 554 leftPanel.doLayout(); 552 // repaint();555 // repaint(); 553 556 return; 554 557 } 555 558 } 556 559 } 557 560 558 561 /* 559 * Find panel on top of MapView by class560 */562 * Find panel on top of MapView by class 563 */ 561 564 public <T> T getTopPanel(Class<T> type) { 562 565 int n = leftPanel.getComponentCount(); 563 566 for (int i=0; i<n; i++) { 564 567 Component c = leftPanel.getComponent(i); 565 if (type.isInstance(c)) {568 if (type.isInstance(c)) 566 569 return type.cast(c); 567 }568 570 } 569 571 return null; … … 590 592 */ 591 593 private static final CopyOnWriteArrayList<MapModeChangeListener> mapModeChangeListeners = new CopyOnWriteArrayList<MapModeChangeListener>(); 594 595 private PreferenceChangedListener sidetoolbarPreferencesChangedListener; 592 596 /** 593 597 * Adds a mapMode change listener -
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r5028 r5463 21 21 22 22 import org.openstreetmap.josm.Main; 23 import org.openstreetmap.josm.tools.Destroyable; 23 24 import org.openstreetmap.josm.tools.ImageProvider; 24 25 import org.openstreetmap.josm.tools.Shortcut; 25 26 26 public class SideButton extends JButton {27 public class SideButton extends JButton implements Destroyable { 27 28 private final static int iconHeight = 20; 28 29 … … 136 137 arrowButton.addActionListener(listener); 137 138 } 139 140 @Override 141 public void destroy() { 142 Action action = getAction(); 143 if (action instanceof Destroyable) { 144 ((Destroyable) action).destroy(); 145 } 146 setAction(null); 147 } 138 148 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r5457 r5463 60 60 61 61 import org.openstreetmap.josm.Main; 62 import org.openstreetmap.josm.actions.SaveActionBase;63 62 import org.openstreetmap.josm.gui.ExtendedDialog; 64 63 import org.openstreetmap.josm.gui.PleaseWaitRunnable; -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r5331 r5463 7 7 import java.awt.BorderLayout; 8 8 import java.awt.Component; 9 import java.awt.Container; 9 10 import java.awt.Dimension; 10 11 import java.awt.FlowLayout; … … 24 25 import java.awt.event.WindowAdapter; 25 26 import java.awt.event.WindowEvent; 27 import java.beans.PropertyChangeEvent; 26 28 import java.util.ArrayList; 27 29 import java.util.Arrays; … … 48 50 import org.openstreetmap.josm.Main; 49 51 import org.openstreetmap.josm.actions.JosmAction; 50 import org.openstreetmap.josm.data.Preferences;51 52 import org.openstreetmap.josm.data.preferences.ParametrizedEnumProperty; 52 53 import org.openstreetmap.josm.gui.MainMenu; … … 56 57 import org.openstreetmap.josm.gui.help.HelpUtil; 57 58 import org.openstreetmap.josm.gui.help.Helpful; 59 import org.openstreetmap.josm.tools.Destroyable; 58 60 import org.openstreetmap.josm.tools.GBC; 59 61 import org.openstreetmap.josm.tools.ImageProvider; … … 366 368 hideNotify(); 367 369 Main.main.menu.windowMenu.remove(windowMenuItem); 370 Toolkit.getDefaultToolkit().removeAWTEventListener(this); 371 destroyComponents(this); 372 } 373 374 private void destroyComponents(Component component) { 375 if (component instanceof Container) { 376 for (Component c: ((Container)component).getComponents()) { 377 destroyComponents(c); 378 } 379 } 380 if (component instanceof Destroyable) { 381 ((Destroyable) component).destroy(); 382 } 368 383 } 369 384 -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r5415 r5463 33 33 import org.openstreetmap.josm.Main; 34 34 import org.openstreetmap.josm.actions.AutoScaleAction; 35 import org.openstreetmap.josm.actions.ValidateAction; 35 36 import org.openstreetmap.josm.command.Command; 36 37 import org.openstreetmap.josm.data.SelectionChangedListener; … … 110 111 tree.addTreeSelectionListener(new SelectionWatch()); 111 112 InputMapUtils.unassignCtrlShiftUpDown(tree, JComponent.WHEN_FOCUSED); 112 113 113 114 List<SideButton> buttons = new LinkedList<SideButton>(); 114 115 … … 125 126 }); 126 127 InputMapUtils.addEnterAction(tree, selectButton.getAction()); 127 128 128 129 selectButton.setEnabled(false); 129 130 buttons.add(selectButton); 130 131 131 buttons.add(new SideButton( Main.main.validator.validateAction));132 buttons.add(new SideButton(new ValidateAction())); 132 133 133 134 fixButton = new SideButton(new AbstractAction() { … … 416 417 hasFixes = hasFixes || error.isFixable(); 417 418 if (addSelected) { 418 // sel.addAll(error.getPrimitives()); // was selecting already deleted primitives! see #6640419 419 // sel.addAll(error.getPrimitives()); // was selecting already deleted primitives! see #6640 420 sel.addAll(error.getSelectablePrimitives()); 420 421 } 421 422 } -
trunk/src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java
r5004 r5463 37 37 private final static String ellipsis = "…" + separator; 38 38 39 private final staticJLabel lblLayerName = new JLabel();40 private final staticJLabel lblFilename = new JLabel("");41 private final staticJTextField tfFilename = new JTextField();39 private final JLabel lblLayerName = new JLabel(); 40 private final JLabel lblFilename = new JLabel(""); 41 private final JTextField tfFilename = new JTextField(); 42 42 private final JButton btnFileChooser = new JButton(new LaunchFileChooserAction()); 43 43 … … 66 66 } 67 67 } 68 );68 ); 69 69 // hide border 70 70 tfFilename.setBorder(BorderFactory.createLineBorder(getBackground())); … … 163 163 /** makes the given path fit lblFilename, appends ellipsis on the left if it doesn’t fit. 164 164 * Idea: /home/user/josm → …/user/josm → …/josm; and take the first one that fits */ 165 static finalprivate String makePathFit(String t) {165 private String makePathFit(String t) { 166 166 boolean hasEllipsis = false; 167 167 while(t != null && !t.isEmpty()) { -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersTableColumnModel.java
r5283 r5463 20 20 /** small renderer class that handles the "should be uploaded/saved" texts. */ 21 21 private static class RecommendedActionsTableCell implements TableCellRenderer { 22 private final staticJPanel pnlEmpty = new JPanel();23 private final staticJLabel needsUpload = new JLabel(tr("should be uploaded"));24 private final staticJLabel needsSave = new JLabel(tr("should be saved"));22 private final JPanel pnlEmpty = new JPanel(); 23 private final JLabel needsUpload = new JLabel(tr("should be uploaded")); 24 private final JLabel needsSave = new JLabel(tr("should be saved")); 25 25 private final static GBC defaultCellStyle = GBC.eol().fill(GBC.HORIZONTAL).insets(2, 0, 2, 0); 26 26 -
trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java
r5018 r5463 26 26 import org.openstreetmap.josm.Main; 27 27 import org.openstreetmap.josm.tools.MultikeyShortcutAction.MultikeyInfo; 28 import org.openstreetmap.josm.tools.Shortcut;29 28 30 29 public class MultikeyActionsHandler { … … 34 33 35 34 private Map<MultikeyShortcutAction, MyAction> myActions = new HashMap<MultikeyShortcutAction,MyAction>(); 36 35 37 36 private class MyKeyEventDispatcher implements KeyEventDispatcher { 38 37 @Override … … 211 210 } 212 211 } 213 212 214 213 // unregister action and its shortcut completely 215 214 public void removeAction(MultikeyShortcutAction action) { … … 217 216 if (a!=null) { 218 217 Main.unregisterActionShortcut(a, a.shortcut); 219 myActions.remove(a );218 myActions.remove(action); 220 219 } 221 220 }
Note:
See TracChangeset
for help on using the changeset viewer.