Changeset 5735 in josm
- Timestamp:
- 2013-02-20T21:34:12+01:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r5734 r5735 12 12 import java.awt.Toolkit; 13 13 import java.awt.event.AWTEventListener; 14 import java.awt.event.ActionEvent; 15 import java.awt.event.ActionListener; 14 16 import java.awt.event.InputEvent; 15 17 import java.awt.event.KeyEvent; … … 50 52 import org.openstreetmap.josm.gui.layer.Layer; 51 53 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 54 import org.openstreetmap.josm.gui.util.GuiHelper; 52 55 import org.openstreetmap.josm.tools.ImageProvider; 53 56 import org.openstreetmap.josm.tools.Pair; … … 440 443 selectPrims(NavigatableComponent.asColl(toSelect), false, false); 441 444 useLastMoveCommandIfPossible(); 445 // Schedule a timer to update status line "initialMoveDelay+1" ms in the future 446 GuiHelper.scheduleTimer(initialMoveDelay+1, new ActionListener() { 447 public void actionPerformed(ActionEvent evt) { 448 updateStatusLine(); 449 } 450 }, false); 442 451 break; 443 452 case select: … … 853 862 @Override 854 863 public String getModeHelpText() { 855 if (mode == Mode.select && mouseDownButton == MouseEvent.BUTTON1 && mouseReleaseTime < mouseDownTime) 856 return tr("Release the mouse button to select the objects in the rectangle."); 857 else if (mode == Mode.move) { 858 final boolean canMerge = getCurrentDataSet()!=null && !getCurrentDataSet().getSelectedNodes().isEmpty(); 859 final String mergeHelp = canMerge ? (" " + tr("Ctrl to merge with nearest node.")) : ""; 860 return tr("Release the mouse button to stop moving.") + mergeHelp; 861 } else if (mode == Mode.rotate) 862 return tr("Release the mouse button to stop rotating."); 863 else if (mode == Mode.scale) 864 return tr("Release the mouse button to stop scaling."); 865 else 866 return tr("Move objects by dragging; Shift to add to selection (Ctrl to toggle); Shift-Ctrl to rotate selected; Alt-Ctrl to scale selected; or change selection"); 864 if (mouseDownButton == MouseEvent.BUTTON1 && mouseReleaseTime < mouseDownTime) { 865 if (mode == Mode.select) 866 return tr("Release the mouse button to select the objects in the rectangle."); 867 else if (mode == Mode.move && (System.currentTimeMillis() - mouseDownTime >= initialMoveDelay)) { 868 final boolean canMerge = getCurrentDataSet()!=null && !getCurrentDataSet().getSelectedNodes().isEmpty(); 869 final String mergeHelp = canMerge ? (" " + tr("Ctrl to merge with nearest node.")) : ""; 870 return tr("Release the mouse button to stop moving.") + mergeHelp; 871 } else if (mode == Mode.rotate) 872 return tr("Release the mouse button to stop rotating."); 873 else if (mode == Mode.scale) 874 return tr("Release the mouse button to stop scaling."); 875 } 876 return tr("Move objects by dragging; Shift to add to selection (Ctrl to toggle); Shift-Ctrl to rotate selected; Alt-Ctrl to scale selected; or change selection"); 867 877 } 868 878 -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r5493 r5735 11 11 import java.awt.Toolkit; 12 12 import java.awt.Window; 13 import java.awt.event.ActionEvent; 14 import java.awt.event.ActionListener; 13 15 import java.awt.event.HierarchyEvent; 14 16 import java.awt.event.HierarchyListener; … … 21 23 import javax.swing.JOptionPane; 22 24 import javax.swing.SwingUtilities; 25 import javax.swing.Timer; 23 26 24 27 import org.openstreetmap.josm.Main; … … 138 141 return pane; 139 142 } 143 144 /** 145 * Schedules a new Timer to be run in the future (once or several times). 146 * @param initialDelay milliseconds for the initial and between-event delay if repeatable 147 * @param actionListener an initial listener; can be null 148 * @param repeats specify false to make the timer stop after sending its first action event 149 * @return The (started) timer. 150 * @since 5735 151 */ 152 public static final Timer scheduleTimer(int initialDelay, ActionListener actionListener, boolean repeats) { 153 Timer timer = new Timer(initialDelay, actionListener); 154 timer.setRepeats(repeats); 155 timer.start(); 156 return timer; 157 } 140 158 }
Note:
See TracChangeset
for help on using the changeset viewer.