-
commit a51a99e7d853a3449b4e127d9a33e4d6f0a786e4
Author: Simon Legner <Simon.Legner@gmail.com>
Date: 2020-05-31 13:13:28 +0200
fix #19327 - Deprecate JosmAction constructors, use setters
diff --git a/src/org/openstreetmap/josm/actions/AboutAction.java b/src/org/openstreetmap/josm/actions/AboutAction.java
index 505db8eb7..464db094f 100644
a
|
b
|
|
61 | 61 | * Constructs a new {@code AboutAction}. |
62 | 62 | */ |
63 | 63 | public AboutAction() { |
64 | | super(tr("About"), "logo", tr("Display the about screen."), |
65 | | Shortcut.registerShortcut("system:about", tr("About"), |
66 | | KeyEvent.VK_F1, Shortcut.SHIFT), true, false); |
| 64 | super(false); |
| 65 | setName(tr("About")); |
| 66 | setIcon("logo"); |
| 67 | setShortcut(Shortcut.registerShortcut("system:about", tr("About"), KeyEvent.VK_F1, Shortcut.SHIFT)); |
| 68 | setTooltip(tr("Display the about screen.")); |
| 69 | registerInToolbar("logo"); |
67 | 70 | } |
68 | 71 | |
69 | 72 | JPanel buildAboutPanel() { |
-
diff --git a/src/org/openstreetmap/josm/actions/AbstractInfoAction.java b/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
index f07f39595..a0a8fa625 100644
a
|
b
|
|
17 | 17 | import org.openstreetmap.josm.gui.MainApplication; |
18 | 18 | import org.openstreetmap.josm.tools.Logging; |
19 | 19 | import org.openstreetmap.josm.tools.OpenBrowser; |
20 | | import org.openstreetmap.josm.tools.Shortcut; |
21 | 20 | |
22 | 21 | /** |
23 | 22 | * Abstract base class for info actions, opening an URL describing a particular object. |
… |
… |
public AbstractInfoAction(boolean installAdapters) {
|
33 | 32 | super(installAdapters); |
34 | 33 | } |
35 | 34 | |
36 | | /** |
37 | | * Constructs a new {@code AbstractInfoAction}. |
38 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
39 | | * @param iconName the filename of the icon to use |
40 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
41 | | * that html is not supported for menu actions on some platforms. |
42 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
43 | | * do want a shortcut, remember you can always register it with group=none, so you |
44 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
45 | | * the user CANNOT configure a shortcut for your action. |
46 | | * @param register register this action for the toolbar preferences? |
47 | | * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null |
48 | | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
49 | | */ |
50 | | public AbstractInfoAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, |
51 | | String toolbarId, boolean installAdapters) { |
52 | | super(name, iconName, tooltip, shortcut, register, toolbarId, installAdapters); |
53 | | } |
54 | | |
55 | 35 | /** |
56 | 36 | * Asks user confirmation before launching a large number of browser windows. |
57 | 37 | * @param numBrowsers the number of browser windows to open |
-
diff --git a/src/org/openstreetmap/josm/actions/AbstractMergeAction.java b/src/org/openstreetmap/josm/actions/AbstractMergeAction.java
index 3da551439..90a722208 100644
a
|
b
|
|
19 | 19 | import org.openstreetmap.josm.gui.layer.Layer; |
20 | 20 | import org.openstreetmap.josm.gui.widgets.JosmComboBox; |
21 | 21 | import org.openstreetmap.josm.tools.GBC; |
22 | | import org.openstreetmap.josm.tools.Shortcut; |
23 | 22 | import org.openstreetmap.josm.tools.Utils; |
24 | 23 | |
25 | 24 | /** |
… |
… |
public TargetLayerDialogResult(T sel, boolean ch) {
|
84 | 83 | } |
85 | 84 | } |
86 | 85 | |
87 | | /** |
88 | | * Constructs a new {@code AbstractMergeAction}. |
89 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
90 | | * @param iconName the filename of the icon to use |
91 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
92 | | * that html is not supported for menu actions on some platforms. |
93 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
94 | | * do want a shortcut, remember you can always register it with group=none, so you |
95 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
96 | | * the user CANNOT configure a shortcut for your action. |
97 | | * @param register register this action for the toolbar preferences? |
98 | | */ |
99 | | public AbstractMergeAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register) { |
100 | | super(name, iconName, tooltip, shortcut, register); |
101 | | } |
102 | | |
103 | | /** |
104 | | * Constructs a new {@code AbstractMergeAction}. |
105 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
106 | | * @param iconName the filename of the icon to use |
107 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
108 | | * that html is not supported for menu actions on some platforms. |
109 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
110 | | * do want a shortcut, remember you can always register it with group=none, so you |
111 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
112 | | * the user CANNOT configure a shortcut for your action. |
113 | | * @param register register this action for the toolbar preferences? |
114 | | * @param toolbar identifier for the toolbar preferences. The iconName is used, if this parameter is null |
115 | | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
116 | | */ |
117 | | public AbstractMergeAction(String name, String iconName, String tooltip, Shortcut shortcut, |
118 | | boolean register, String toolbar, boolean installAdapters) { |
119 | | super(name, iconName, tooltip, shortcut, register, toolbar, installAdapters); |
120 | | } |
121 | | |
122 | 86 | /** |
123 | 87 | * Ask user to choose the target layer and shows a checkbox. |
124 | 88 | * @param targetLayers list of candidate target layers. |
-
diff --git a/src/org/openstreetmap/josm/actions/AbstractPasteAction.java b/src/org/openstreetmap/josm/actions/AbstractPasteAction.java
index 00ee85c63..7bfac246a 100644
a
|
b
|
|
15 | 15 | import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; |
16 | 16 | import org.openstreetmap.josm.gui.datatransfer.OsmTransferHandler; |
17 | 17 | import org.openstreetmap.josm.tools.Logging; |
18 | | import org.openstreetmap.josm.tools.Shortcut; |
19 | 18 | |
20 | 19 | /** |
21 | 20 | * This is the base class for all actions that paste objects. |
… |
… |
|
28 | 27 | |
29 | 28 | /** |
30 | 29 | * Constructs a new {@link AbstractPasteAction}. |
31 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
32 | | * @param iconName the filename of the icon to use |
33 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
34 | | * that html is not supported for menu actions on some platforms. |
35 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
36 | | * do want a shortcut, remember you can always register it with group=none, so you |
37 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
38 | | * the user CANNOT configure a shortcut for your action. |
39 | | * @param registerInToolbar register this action for the toolbar preferences? |
40 | 30 | */ |
41 | | public AbstractPasteAction(String name, String iconName, String tooltip, Shortcut shortcut, |
42 | | boolean registerInToolbar) { |
43 | | this(name, iconName, tooltip, shortcut, registerInToolbar, null); |
44 | | } |
45 | | |
46 | | /** |
47 | | * Constructs a new {@link AbstractPasteAction}. |
48 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
49 | | * @param iconName the filename of the icon to use |
50 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
51 | | * that html is not supported for menu actions on some platforms. |
52 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
53 | | * do want a shortcut, remember you can always register it with group=none, so you |
54 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
55 | | * the user CANNOT configure a shortcut for your action. |
56 | | * @param registerInToolbar register this action for the toolbar preferences? |
57 | | * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null |
58 | | */ |
59 | | public AbstractPasteAction(String name, String iconName, String tooltip, Shortcut shortcut, |
60 | | boolean registerInToolbar, String toolbarId) { |
61 | | super(name, iconName, tooltip, shortcut, registerInToolbar, toolbarId, true); |
| 31 | public AbstractPasteAction() { |
62 | 32 | transferHandler = new OsmTransferHandler(); |
63 | 33 | ClipboardUtils.getClipboard().addFlavorListener(this); |
64 | 34 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/AbstractUploadAction.java b/src/org/openstreetmap/josm/actions/AbstractUploadAction.java
index 234c0ac41..a4066c19a 100644
a
|
b
|
|
6 | 6 | import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; |
7 | 7 | import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; |
8 | 8 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
9 | | import org.openstreetmap.josm.tools.Shortcut; |
10 | 9 | |
11 | 10 | /** |
12 | 11 | * Abstract super-class of all upload actions. |
… |
… |
|
15 | 14 | */ |
16 | 15 | public abstract class AbstractUploadAction extends JosmAction { |
17 | 16 | |
18 | | /** |
19 | | * Constructs a new {@code AbstractUploadAction}. |
20 | | * |
21 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
22 | | * @param iconName the filename of the icon to use |
23 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
24 | | * that html is not supported for menu actions on some platforms. |
25 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
26 | | * do want a shortcut, remember you can always register it with group=none, so you |
27 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
28 | | * the user CANNOT configure a shortcut for your action. |
29 | | * @param registerInToolbar register this action for the toolbar preferences? |
30 | | */ |
31 | | public AbstractUploadAction(String name, String iconName, String tooltip, Shortcut shortcut, |
32 | | boolean registerInToolbar) { |
33 | | super(name, iconName, tooltip, shortcut, registerInToolbar); |
34 | | } |
35 | | |
36 | 17 | private final PropertyChangeListener updateOnRequireUploadChange = evt -> { |
37 | 18 | if (OsmDataLayer.REQUIRES_UPLOAD_TO_SERVER_PROP.equals(evt.getPropertyName())) { |
38 | 19 | updateEnabledState(); |
-
diff --git a/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java b/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
index e0e8dee82..f3c7344e5 100644
a
|
b
|
|
71 | 71 | * @param info The imagery info |
72 | 72 | */ |
73 | 73 | public AddImageryLayerAction(ImageryInfo info) { |
74 | | super(info.getMenuName(), /* ICON */"imagery_menu", info.getToolTipText(), null, |
75 | | true, ToolbarPreferences.IMAGERY_PREFIX + info.getToolbarName(), false); |
| 74 | super(false); |
| 75 | setName(info.getMenuName()); |
| 76 | setIcon(/* ICON */ "imagery_menu"); |
| 77 | setTooltip(info.getToolTipText()); |
| 78 | registerInToolbar(ToolbarPreferences.IMAGERY_PREFIX + info.getToolbarName()); |
76 | 79 | setHelpId(ht("/Preferences/Imagery")); |
77 | 80 | this.info = info; |
78 | | installAdapters(); |
79 | 81 | |
80 | 82 | // change toolbar icon from if specified |
81 | 83 | String icon = info.getIcon(); |
-
diff --git a/src/org/openstreetmap/josm/actions/AddNodeAction.java b/src/org/openstreetmap/josm/actions/AddNodeAction.java
index 542164d70..e036ea0f3 100644
a
|
b
|
|
33 | 33 | * Constructs a new {@code AddNodeAction}. |
34 | 34 | */ |
35 | 35 | public AddNodeAction() { |
36 | | super(tr("Add Node..."), "addnode", tr("Add a node by entering latitude / longitude or easting / northing."), |
37 | | Shortcut.registerShortcut("addnode", tr("Edit: {0}", tr("Add Node...")), |
38 | | KeyEvent.VK_D, Shortcut.SHIFT), true); |
| 36 | setName(tr("Add Node...")); |
| 37 | setIcon("addnode"); |
| 38 | setShortcut(Shortcut.registerShortcut("addnode", tr("Edit: {0}", tr("Add Node...")), KeyEvent.VK_D, Shortcut.SHIFT)); |
| 39 | setTooltip(tr("Add a node by entering latitude / longitude or easting / northing.")); |
| 40 | registerInToolbar("addnode"); |
39 | 41 | setHelpId(ht("/Action/AddNode")); |
40 | 42 | } |
41 | 43 | |
-
diff --git a/src/org/openstreetmap/josm/actions/AlignInCircleAction.java b/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
index 85f25eee9..1ca87e521 100644
a
|
b
|
|
47 | 47 | * Constructs a new {@code AlignInCircleAction}. |
48 | 48 | */ |
49 | 49 | public AlignInCircleAction() { |
50 | | super(tr("Align Nodes in Circle"), "aligncircle", tr("Move the selected nodes into a circle."), |
51 | | Shortcut.registerShortcut("tools:aligncircle", tr("Tool: {0}", tr("Align Nodes in Circle")), |
52 | | KeyEvent.VK_O, Shortcut.DIRECT), true); |
| 50 | setName(tr("Align Nodes in Circle")); |
| 51 | setIcon("aligncircle"); |
| 52 | setShortcut(Shortcut.registerShortcut("tools:aligncircle", tr("Tool: {0}", tr("Align Nodes in Circle")), |
| 53 | KeyEvent.VK_O, Shortcut.DIRECT)); |
| 54 | setTooltip(tr("Move the selected nodes into a circle.")); |
| 55 | registerInToolbar("aligncircle"); |
53 | 56 | setHelpId(ht("/Action/AlignInCircle")); |
54 | 57 | } |
55 | 58 | |
-
diff --git a/src/org/openstreetmap/josm/actions/AlignInLineAction.java b/src/org/openstreetmap/josm/actions/AlignInLineAction.java
index 9bf800da8..60debb6e7 100644
a
|
b
|
|
54 | 54 | * Constructs a new {@code AlignInLineAction}. |
55 | 55 | */ |
56 | 56 | public AlignInLineAction() { |
57 | | super(tr("Align Nodes in Line"), "alignline", tr("Move the selected nodes in to a line."), |
58 | | Shortcut.registerShortcut("tools:alignline", tr("Tool: {0}", tr("Align Nodes in Line")), KeyEvent.VK_L, Shortcut.DIRECT), true); |
| 57 | setName(tr("Align Nodes in Line")); |
| 58 | setIcon("alignline"); |
| 59 | setShortcut(Shortcut.registerShortcut("tools:alignline", tr("Tool: {0}", tr("Align Nodes in Line")), KeyEvent.VK_L, Shortcut.DIRECT)); |
| 60 | setTooltip(tr("Move the selected nodes in to a line.")); |
| 61 | registerInToolbar("alignline"); |
59 | 62 | setHelpId(ht("/Action/AlignInLine")); |
60 | 63 | } |
61 | 64 | |
-
diff --git a/src/org/openstreetmap/josm/actions/AutoScaleAction.java b/src/org/openstreetmap/josm/actions/AutoScaleAction.java
index 989554605..92b72da5d 100644
a
|
b
|
private AutoScaleAction(AutoScaleMode mode, boolean marker) {
|
198 | 198 | * @since 14221 |
199 | 199 | */ |
200 | 200 | public AutoScaleAction(final AutoScaleMode mode) { |
201 | | super(tr("Zoom to {0}", mode.getLocalizedLabel()), "dialogs/autoscale/" + mode.getEnglishLabel(), |
202 | | tr("Zoom the view to {0}.", mode.getLocalizedLabel()), |
203 | | Shortcut.registerShortcut("view:zoom" + mode.getEnglishLabel(), |
204 | | tr("View: {0}", tr("Zoom to {0}", mode.getLocalizedLabel())), |
205 | | getModeShortcut(mode.getEnglishLabel()), Shortcut.DIRECT), true, null, false); |
| 201 | super(false); |
| 202 | setName(tr("Zoom to {0}", mode.getLocalizedLabel())); |
| 203 | setTooltip(tr("Zoom the view to {0}.", mode.getLocalizedLabel())); |
| 204 | String iconName = "dialogs/autoscale/" + mode.getEnglishLabel(); |
| 205 | setIcon(iconName); |
| 206 | registerInToolbar(iconName); |
| 207 | setShortcut(Shortcut.registerShortcut("view:zoom" + mode.getEnglishLabel(), |
| 208 | tr("View: {0}", tr("Zoom to {0}", mode.getLocalizedLabel())), |
| 209 | getModeShortcut(mode.getEnglishLabel()), Shortcut.DIRECT)); |
206 | 210 | String label = mode.getEnglishLabel(); |
207 | 211 | String modeHelp = Character.toUpperCase(label.charAt(0)) + label.substring(1); |
208 | 212 | setHelpId("Action/AutoScale/" + modeHelp); |
-
diff --git a/src/org/openstreetmap/josm/actions/ChangesetManagerToggleAction.java b/src/org/openstreetmap/josm/actions/ChangesetManagerToggleAction.java
index 46e62eb90..4272f2c4b 100644
a
|
b
|
|
25 | 25 | * Constructs a new {@code ChangesetManagerToggleAction}. |
26 | 26 | */ |
27 | 27 | public ChangesetManagerToggleAction() { |
28 | | super(tr("Changeset Manager"), |
29 | | new ImageProvider("dialogs/changeset/changesetmanager").setOptional(true), |
30 | | tr("Toggle visibility of Changeset Manager window"), |
31 | | Shortcut.registerShortcut("menu:windows:changesetdialog", |
32 | | tr("Toggle visibility of Changeset Manager window"), KeyEvent.VK_C, Shortcut.ALT_CTRL), |
33 | | true /* register shortcut */, "dialogs/changeset/changesetmanager", false); |
| 28 | super(false); |
| 29 | setName(tr("Changeset Manager")); |
| 30 | setIcon(new ImageProvider("dialogs/changeset/changesetmanager").setOptional(true)); |
| 31 | setShortcut(Shortcut.registerShortcut("menu:windows:changesetdialog", |
| 32 | tr("Toggle visibility of Changeset Manager window"), KeyEvent.VK_C, Shortcut.ALT_CTRL)); |
| 33 | setTooltip(tr("Toggle visibility of Changeset Manager window")); |
| 34 | registerInToolbar("dialogs/changeset/changesetmanager"); |
34 | 35 | notifySelectedState(); |
35 | 36 | changesetCacheManagerClosedHandler = new ChangesetCacheManagerClosedHandler(); |
36 | 37 | setHelpId(ht("/Dialog/ChangesetManager")); |
-
diff --git a/src/org/openstreetmap/josm/actions/CloseChangesetAction.java b/src/org/openstreetmap/josm/actions/CloseChangesetAction.java
index 02e8c0d45..cfb6948f0 100644
a
|
b
|
|
45 | 45 | * Constructs a new {@code CloseChangesetAction}. |
46 | 46 | */ |
47 | 47 | public CloseChangesetAction() { |
48 | | super(tr("Close open changesets..."), |
49 | | "closechangeset", |
50 | | tr("Close open changesets"), |
51 | | Shortcut.registerShortcut("system:closechangeset", |
52 | | tr("File: {0}", tr("Close open changesets")), |
53 | | KeyEvent.VK_Q, Shortcut.ALT_CTRL), |
54 | | true, false |
55 | | ); |
| 48 | super(false); |
| 49 | setName(tr("Close open changesets...")); |
| 50 | setIcon("closechangeset"); |
| 51 | setShortcut(Shortcut.registerShortcut("system:closechangeset", tr("File: {0}", tr("Close open changesets")), |
| 52 | KeyEvent.VK_Q, Shortcut.ALT_CTRL)); |
| 53 | setTooltip(tr("Close open changesets")); |
| 54 | registerInToolbar("closechangeset"); |
56 | 55 | setHelpId(ht("/Action/CloseChangeset")); |
57 | 56 | setEnabled(!NetworkManager.isOffline(OnlineResource.OSM_API)); |
58 | 57 | |
-
diff --git a/src/org/openstreetmap/josm/actions/CombineWayAction.java b/src/org/openstreetmap/josm/actions/CombineWayAction.java
index 1cfa93010..89f10fa38 100644
a
|
b
|
|
62 | 62 | * Constructs a new {@code CombineWayAction}. |
63 | 63 | */ |
64 | 64 | public CombineWayAction() { |
65 | | super(tr("Combine Way"), "combineway", tr("Combine several ways into one."), |
66 | | Shortcut.registerShortcut("tools:combineway", tr("Tool: {0}", tr("Combine Way")), KeyEvent.VK_C, Shortcut.DIRECT), true); |
| 65 | setName(tr("Combine Way")); |
| 66 | setIcon("combineway"); |
| 67 | setShortcut(Shortcut.registerShortcut("tools:combineway", tr("Tool: {0}", tr("Combine Way")), KeyEvent.VK_C, Shortcut.DIRECT)); |
| 68 | setTooltip(tr("Combine several ways into one.")); |
| 69 | registerInToolbar("combineway"); |
67 | 70 | setHelpId(ht("/Action/CombineWay")); |
68 | 71 | } |
69 | 72 | |
-
diff --git a/src/org/openstreetmap/josm/actions/CopyAction.java b/src/org/openstreetmap/josm/actions/CopyAction.java
index 4eeacea9a..8d7faac10 100644
a
|
b
|
|
30 | 30 | * Constructs a new {@code CopyAction}. |
31 | 31 | */ |
32 | 32 | public CopyAction() { |
33 | | super(tr("Copy"), "copy", |
34 | | tr("Copy selected objects to paste buffer."), |
35 | | Shortcut.registerShortcut("system:copy", tr("Edit: {0}", tr("Copy")), KeyEvent.VK_C, Shortcut.CTRL), true); |
| 33 | setName(tr("Copy")); |
| 34 | setIcon("copy"); |
| 35 | setShortcut(Shortcut.registerShortcut("system:copy", tr("Edit: {0}", tr("Copy")), KeyEvent.VK_C, Shortcut.CTRL)); |
| 36 | setTooltip(tr("Copy selected objects to paste buffer.")); |
| 37 | registerInToolbar("copy"); |
36 | 38 | setHelpId(ht("/Action/Copy")); |
37 | 39 | // CUA shortcut for copy (https://en.wikipedia.org/wiki/IBM_Common_User_Access#Description) |
38 | 40 | MainApplication.registerActionShortcut(this, |
-
diff --git a/src/org/openstreetmap/josm/actions/CopyCoordinatesAction.java b/src/org/openstreetmap/josm/actions/CopyCoordinatesAction.java
index 7fc45ff7c..7e0e9bc58 100644
a
|
b
|
|
27 | 27 | * Constructs a new {@code CopyCoordinatesAction}. |
28 | 28 | */ |
29 | 29 | public CopyCoordinatesAction() { |
30 | | super(tr("Copy Coordinates"), null, |
31 | | tr("Copy coordinates of selected nodes to clipboard."), |
32 | | Shortcut.registerShortcut("copy:coordinates", tr("Edit: {0}", tr("Copy Coordinates")), |
33 | | KeyEvent.VK_C, Shortcut.CTRL_SHIFT), |
34 | | false); |
| 30 | setName(tr("Copy Coordinates")); |
| 31 | setShortcut(Shortcut.registerShortcut("copy:coordinates", tr("Edit: {0}", tr("Copy Coordinates")), KeyEvent.VK_C, Shortcut.CTRL_SHIFT)); |
| 32 | setTooltip(tr("Copy coordinates of selected nodes to clipboard.")); |
35 | 33 | setToolbarId("copy/coordinates"); |
36 | 34 | } |
37 | 35 | |
-
diff --git a/src/org/openstreetmap/josm/actions/CreateCircleAction.java b/src/org/openstreetmap/josm/actions/CreateCircleAction.java
index 594167bc2..e3e541942 100644
a
|
b
|
|
56 | 56 | * Constructs a new {@code CreateCircleAction}. |
57 | 57 | */ |
58 | 58 | public CreateCircleAction() { |
59 | | super(tr("Create Circle"), "aligncircle", tr("Create a circle from three selected nodes."), |
60 | | Shortcut.registerShortcut("tools:createcircle", tr("Tool: {0}", tr("Create Circle")), |
61 | | KeyEvent.VK_O, Shortcut.SHIFT), true, "createcircle", true); |
| 59 | setName(tr("Create Circle")); |
| 60 | setIcon("aligncircle"); |
| 61 | setShortcut(Shortcut.registerShortcut("tools:createcircle", tr("Tool: {0}", tr("Create Circle")), KeyEvent.VK_O, Shortcut.SHIFT)); |
| 62 | setTooltip(tr("Create a circle from three selected nodes.")); |
| 63 | registerInToolbar("createcircle"); |
62 | 64 | setHelpId(ht("/Action/CreateCircle")); |
63 | 65 | } |
64 | 66 | |
-
diff --git a/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java b/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
index 0bc9f4958..badf05c54 100644
a
|
b
|
|
79 | 79 | * @param update {@code true} if the multipolygon must be updated, {@code false} if it must be created |
80 | 80 | */ |
81 | 81 | public CreateMultipolygonAction(final boolean update) { |
82 | | super(getName(update), /* ICON */ "multipoly_create", getName(update), |
83 | | /* at least three lines for each shortcut or the server extractor fails */ |
84 | | update ? Shortcut.registerShortcut("tools:multipoly_update", |
85 | | tr("Tool: {0}", getName(true)), |
86 | | KeyEvent.VK_B, Shortcut.CTRL_SHIFT) |
87 | | : Shortcut.registerShortcut("tools:multipoly_create", |
88 | | tr("Tool: {0}", getName(false)), |
89 | | KeyEvent.VK_B, Shortcut.CTRL), |
90 | | true, update ? "multipoly_update" : "multipoly_create", true); |
| 82 | setName(getName(update)); |
| 83 | setTooltip(getName(update)); |
| 84 | setIcon(/* ICON */ "multipoly_create"); |
| 85 | |
| 86 | /* at least three lines for each shortcut or the server extractor fails */ |
| 87 | setShortcut(update ? Shortcut.registerShortcut("tools:multipoly_update", |
| 88 | tr("Tool: {0}", getName(true)), |
| 89 | KeyEvent.VK_B, Shortcut.CTRL_SHIFT) |
| 90 | : Shortcut.registerShortcut("tools:multipoly_create", |
| 91 | tr("Tool: {0}", getName(false)), |
| 92 | KeyEvent.VK_B, Shortcut.CTRL)); |
| 93 | registerInToolbar(update ? "multipoly_update" : "multipoly_create"); |
91 | 94 | this.update = update; |
92 | 95 | } |
93 | 96 | |
-
diff --git a/src/org/openstreetmap/josm/actions/DeleteAction.java b/src/org/openstreetmap/josm/actions/DeleteAction.java
index a3c556b76..1b345c903 100644
a
|
b
|
public boolean confirmDeletionFromRelation(Collection<RelationToChildReference>
|
60 | 60 | * Constructs a new {@code DeleteAction}. |
61 | 61 | */ |
62 | 62 | public DeleteAction() { |
63 | | super(tr("Delete"), "dialogs/delete", tr("Delete selected objects."), |
64 | | Shortcut.registerShortcut("system:delete", tr("Edit: {0}", tr("Delete")), KeyEvent.VK_DELETE, Shortcut.DIRECT), true); |
| 63 | setName(tr("Delete")); |
| 64 | setIcon("dialogs/delete"); |
| 65 | setShortcut(Shortcut.registerShortcut("system:delete", tr("Edit: {0}", tr("Delete")), KeyEvent.VK_DELETE, Shortcut.DIRECT)); |
| 66 | setTooltip(tr("Delete selected objects.")); |
| 67 | registerInToolbar("dialogs/delete"); |
65 | 68 | setHelpId(ht("/Action/Delete")); |
66 | 69 | } |
67 | 70 | |
-
diff --git a/src/org/openstreetmap/josm/actions/DeleteLayerAction.java b/src/org/openstreetmap/josm/actions/DeleteLayerAction.java
index e4fc253c2..972e0845d 100644
a
|
b
|
|
21 | 21 | * Constructs a {@link DeleteLayerAction} which will delete the active layer. |
22 | 22 | */ |
23 | 23 | public DeleteLayerAction() { |
24 | | super(tr("Delete Layer"), "dialogs/delete", tr("Delete the active layer. Does not delete the associated file."), |
25 | | Shortcut.registerShortcut("system:deletelayer", tr("File: {0}", tr("Delete Layer")), KeyEvent.VK_F4, Shortcut.CTRL), |
26 | | true, "delete-layer", true); |
| 24 | setName(tr("Delete Layer")); |
| 25 | setIcon("dialogs/delete"); |
| 26 | setShortcut(Shortcut.registerShortcut("system:deletelayer", tr("File: {0}", tr("Delete Layer")), KeyEvent.VK_F4, Shortcut.CTRL)); |
| 27 | setTooltip(tr("Delete the active layer. Does not delete the associated file.")); |
| 28 | registerInToolbar("delete-layer"); |
27 | 29 | setHelpId(ht("/Action/DeleteLayer")); |
28 | 30 | } |
29 | 31 | |
-
diff --git a/src/org/openstreetmap/josm/actions/DialogsToggleAction.java b/src/org/openstreetmap/josm/actions/DialogsToggleAction.java
index d53e22fbc..a2673a02b 100644
a
|
b
|
|
10 | 10 | import org.openstreetmap.josm.gui.MainApplication; |
11 | 11 | import org.openstreetmap.josm.gui.MapFrame; |
12 | 12 | import org.openstreetmap.josm.spi.preferences.Config; |
13 | | import org.openstreetmap.josm.tools.ImageProvider; |
14 | 13 | import org.openstreetmap.josm.tools.Shortcut; |
15 | 14 | |
16 | 15 | /** |
… |
… |
|
27 | 26 | * Constructs a new {@code DialogsToggleAction}. |
28 | 27 | */ |
29 | 28 | public DialogsToggleAction() { |
30 | | super(tr("Dialogs panel"), |
31 | | (ImageProvider) null, /* no icon */ |
32 | | tr("Toggle dialogs panel, maximize mapview"), |
33 | | Shortcut.registerShortcut("menu:view:dialogspanel", tr("Toggle dialogs panel"), KeyEvent.VK_TAB, Shortcut.DIRECT), |
34 | | true, "dialogspanel", /* register in toolbar */ |
35 | | false |
36 | | ); |
| 29 | super(false); |
| 30 | setName(tr("Dialogs panel")); |
| 31 | setShortcut(Shortcut.registerShortcut("menu:view:dialogspanel", tr("Toggle dialogs panel"), KeyEvent.VK_TAB, Shortcut.DIRECT)); |
| 32 | setTooltip(tr("Toggle dialogs panel, maximize mapview")); |
| 33 | registerInToolbar("dialogspanel"); |
37 | 34 | setHelpId(ht("/ToggleDialogs")); |
38 | 35 | setSelected(Config.getPref().getBoolean("draw.dialogspanel", true)); |
39 | 36 | notifySelectedState(); |
-
diff --git a/src/org/openstreetmap/josm/actions/DiskAccessAction.java b/src/org/openstreetmap/josm/actions/DiskAccessAction.java
index c09fb2b7a..a9a1806bd 100644
a
|
b
|
|
16 | 16 | */ |
17 | 17 | public abstract class DiskAccessAction extends JosmAction { |
18 | 18 | |
| 19 | /** |
| 20 | * Constructs a new {@code DiskAccessAction}. |
| 21 | * @param installAdapters False, if you don't want to install layer changed and selection changed adapters |
| 22 | */ |
| 23 | public DiskAccessAction(boolean installAdapters) { |
| 24 | super(installAdapters); |
| 25 | } |
| 26 | |
19 | 27 | /** |
20 | 28 | * Constructs a new {@code DiskAccessAction}. |
21 | 29 | * |
… |
… |
|
24 | 32 | * @param tooltip A longer description of the action that will be displayed in the tooltip |
25 | 33 | * @param shortcut A ready-created shortcut object or {@code null} if you don't want a shortcut |
26 | 34 | * @since 1084 |
| 35 | * @deprecated use {@link #DiskAccessAction(boolean)} and setters |
27 | 36 | */ |
| 37 | @Deprecated |
28 | 38 | public DiskAccessAction(String name, String iconName, String tooltip, Shortcut shortcut) { |
29 | 39 | super(name, iconName, tooltip, shortcut, true); |
30 | 40 | } |
… |
… |
public DiskAccessAction(String name, String iconName, String tooltip, Shortcut s
|
40 | 50 | * @param toolbarId Identifier for the toolbar preferences. The iconName is used, if this parameter is null |
41 | 51 | * @param installAdapters False, if you don't want to install layer changed and selection changed adapters |
42 | 52 | * @since 5438 |
| 53 | * @deprecated use {@link #DiskAccessAction(boolean)} and setters |
43 | 54 | */ |
| 55 | @Deprecated |
44 | 56 | public DiskAccessAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, |
45 | 57 | String toolbarId, boolean installAdapters) { |
46 | 58 | super(name, iconName, tooltip, shortcut, register, toolbarId, installAdapters); |
-
diff --git a/src/org/openstreetmap/josm/actions/DistributeAction.java b/src/org/openstreetmap/josm/actions/DistributeAction.java
index fbc536f2e..0c50d9318 100644
a
|
b
|
|
37 | 37 | * Constructs a new {@code DistributeAction}. |
38 | 38 | */ |
39 | 39 | public DistributeAction() { |
40 | | super(tr("Distribute Nodes"), "distribute", |
41 | | tr("Distribute the selected nodes to equal distances along a line."), |
42 | | Shortcut.registerShortcut("tools:distribute", tr("Tool: {0}", tr("Distribute Nodes")), KeyEvent.VK_B, Shortcut.SHIFT), |
43 | | true); |
| 40 | setName(tr("Distribute Nodes")); |
| 41 | setIcon("distribute"); |
| 42 | setShortcut(Shortcut.registerShortcut("tools:distribute", tr("Tool: {0}", tr("Distribute Nodes")), KeyEvent.VK_B, Shortcut.SHIFT)); |
| 43 | setTooltip(tr("Distribute the selected nodes to equal distances along a line.")); |
| 44 | registerInToolbar("distribute"); |
44 | 45 | setHelpId(ht("/Action/DistributeNodes")); |
45 | 46 | } |
46 | 47 | |
-
diff --git a/src/org/openstreetmap/josm/actions/DownloadAction.java b/src/org/openstreetmap/josm/actions/DownloadAction.java
index f70cd1a6d..7519c3992 100644
a
|
b
|
|
24 | 24 | * Constructs a new {@code DownloadAction}. |
25 | 25 | */ |
26 | 26 | public DownloadAction() { |
27 | | super(tr("Download data..."), "download", tr("Download map data from a server of your choice"), |
28 | | Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download data")), KeyEvent.VK_DOWN, Shortcut.CTRL_SHIFT), |
29 | | true, false); |
| 27 | super(false); |
| 28 | setName(tr("Download data...")); |
| 29 | setIcon("download"); |
| 30 | setShortcut(Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download data")), KeyEvent.VK_DOWN, Shortcut.CTRL_SHIFT)); |
| 31 | setTooltip(tr("Download map data from a server of your choice")); |
| 32 | registerInToolbar("download"); |
30 | 33 | setHelpId(ht("/Action/Download")); |
31 | 34 | } |
32 | 35 | |
-
diff --git a/src/org/openstreetmap/josm/actions/DownloadAlongAction.java b/src/org/openstreetmap/josm/actions/DownloadAlongAction.java
index 17bd45fd1..9a9aaa55f 100644
a
|
b
|
|
32 | 32 | import org.openstreetmap.josm.spi.preferences.Config; |
33 | 33 | import org.openstreetmap.josm.tools.GBC; |
34 | 34 | import org.openstreetmap.josm.tools.Logging; |
35 | | import org.openstreetmap.josm.tools.Shortcut; |
36 | 35 | import org.openstreetmap.josm.tools.Utils; |
37 | 36 | |
38 | 37 | /** |
… |
… |
|
47 | 46 | */ |
48 | 47 | protected abstract PleaseWaitRunnable createTask(); |
49 | 48 | |
50 | | /** |
51 | | * Constructs a new {@code DownloadAlongAction} |
52 | | * @param name the action's text as displayed in the menu |
53 | | * @param iconName the filename of the icon to use |
54 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
55 | | * that html is not supported for menu actions on some platforms. |
56 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
57 | | * do want a shortcut, remember you can always register it with group=none, so you |
58 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
59 | | * the user CANNOT configure a shortcut for your action. |
60 | | * @param registerInToolbar register this action for the toolbar preferences? |
61 | | */ |
62 | | public DownloadAlongAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) { |
63 | | super(name, iconName, tooltip, shortcut, registerInToolbar); |
64 | | } |
65 | | |
66 | 49 | protected static void addToDownload(Area a, Rectangle2D r, Collection<Rectangle2D> results, double maxArea) { |
67 | 50 | Area tmp = new Area(r); |
68 | 51 | // intersect with sought-after area |
-
diff --git a/src/org/openstreetmap/josm/actions/DownloadAlongWayAction.java b/src/org/openstreetmap/josm/actions/DownloadAlongWayAction.java
index 0a30bccb0..a8f9cfa98 100644
a
|
b
|
|
35 | 35 | * Create new {@link DownloadAlongWayAction}. |
36 | 36 | */ |
37 | 37 | public DownloadAlongWayAction() { |
38 | | super(tr("Download along..."), "download_along_way", tr("Download OSM data along the selected ways."), |
39 | | Shortcut.registerShortcut("file:download_along", tr("File: {0}", tr("Download Along")), |
40 | | KeyEvent.VK_D, Shortcut.ALT_SHIFT), true); |
| 38 | setName(tr("Download along...")); |
| 39 | setIcon("download_along_way"); |
| 40 | setShortcut(Shortcut.registerShortcut("file:download_along", tr("File: {0}", tr("Download Along")), KeyEvent.VK_D, Shortcut.ALT_SHIFT)); |
| 41 | setTooltip(tr("Download OSM data along the selected ways.")); |
| 42 | registerInToolbar("download_along_way"); |
41 | 43 | } |
42 | 44 | |
43 | 45 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/DownloadNotesInViewAction.java b/src/org/openstreetmap/josm/actions/DownloadNotesInViewAction.java
index 7c2f68a94..e94936785 100644
a
|
b
|
|
22 | 22 | public final class DownloadNotesInViewAction extends JosmAction { |
23 | 23 | |
24 | 24 | private DownloadNotesInViewAction(String iconName) { |
25 | | super(tr("Download notes in current view"), iconName, tr("Download notes in current view"), null, false, |
26 | | "dialogs/notes/download_in_view", true); |
| 25 | setName(tr("Download notes in current view")); |
| 26 | setIcon(iconName); |
| 27 | setTooltip(tr("Download notes in current view")); |
| 28 | setToolbarId("dialogs/notes/download_in_view"); |
27 | 29 | } |
28 | 30 | |
29 | 31 | /** |
-
diff --git a/src/org/openstreetmap/josm/actions/DownloadOsmInViewAction.java b/src/org/openstreetmap/josm/actions/DownloadOsmInViewAction.java
index 0108a9dae..fb8bfc644 100644
a
|
b
|
|
26 | 26 | * Creates a new {@code DownloadOsmInViewAction}. |
27 | 27 | */ |
28 | 28 | public DownloadOsmInViewAction() { |
29 | | super(tr("Download in current view"), "download_in_view", tr("Download map data from the OSM server in current view"), null, false, |
30 | | "dialogs/download_in_view", true); |
| 29 | setName(tr("Download in current view")); |
| 30 | setIcon("download_in_view"); |
| 31 | setTooltip(tr("Download map data from the OSM server in current view")); |
| 32 | setToolbarId("dialogs/download_in_view"); |
31 | 33 | } |
32 | 34 | |
33 | 35 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java b/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java
index 263bf1ff6..e4e18507d 100644
a
|
b
|
|
32 | 32 | * Constructs a new {@code DownloadPrimitiveAction}. |
33 | 33 | */ |
34 | 34 | public DownloadPrimitiveAction() { |
35 | | super(tr("Download object..."), "downloadprimitive", tr("Download OSM object by ID"), |
36 | | SHORTCUT, true, false); |
| 35 | super(false); |
| 36 | setName(tr("Download object...")); |
| 37 | setIcon("downloadprimitive"); |
| 38 | setShortcut(SHORTCUT); |
| 39 | setTooltip(tr("Download OSM object by ID")); |
| 40 | registerInToolbar("downloadprimitive"); |
37 | 41 | setHelpId(ht("/Action/DownloadObject")); |
38 | 42 | } |
39 | 43 | |
-
diff --git a/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java b/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
index 69ac3d8e6..13d5b3dab 100644
a
|
b
|
|
25 | 25 | * Constructs a new {@code DownloadReferrersAction}. |
26 | 26 | */ |
27 | 27 | public DownloadReferrersAction() { |
28 | | super(tr("Download parent ways/relations..."), "download", |
29 | | tr("Download objects referring to one of the selected objects"), |
30 | | Shortcut.registerShortcut("file:downloadreferrers", |
31 | | tr("File: {0}", tr("Download parent ways/relations...")), KeyEvent.VK_D, Shortcut.ALT_CTRL), |
32 | | true, "downloadreferrers", true); |
| 28 | setName(tr("Download parent ways/relations...")); |
| 29 | setIcon("download"); |
| 30 | setShortcut(Shortcut.registerShortcut("file:downloadreferrers", |
| 31 | tr("File: {0}", tr("Download parent ways/relations...")), KeyEvent.VK_D, Shortcut.ALT_CTRL)); |
| 32 | setTooltip(tr("Download objects referring to one of the selected objects")); |
| 33 | registerInToolbar("downloadreferrers"); |
33 | 34 | setHelpId(ht("/Action/DownloadParentWaysAndRelation")); |
34 | 35 | } |
35 | 36 | |
-
diff --git a/src/org/openstreetmap/josm/actions/DuplicateAction.java b/src/org/openstreetmap/josm/actions/DuplicateAction.java
index 0918a773c..9ba84922a 100644
a
|
b
|
|
23 | 23 | * Constructs a new {@code DuplicateAction}. |
24 | 24 | */ |
25 | 25 | public DuplicateAction() { |
26 | | super(tr("Duplicate"), "duplicate", |
27 | | tr("Duplicate selection."), |
28 | | Shortcut.registerShortcut("system:duplicate", tr("Edit: {0}", tr("Duplicate")), KeyEvent.VK_D, Shortcut.CTRL), true); |
| 26 | setName(tr("Duplicate")); |
| 27 | setIcon("duplicate"); |
| 28 | setShortcut(Shortcut.registerShortcut("system:duplicate", tr("Edit: {0}", tr("Duplicate")), KeyEvent.VK_D, Shortcut.CTRL)); |
| 29 | setTooltip(tr("Duplicate selection.")); |
| 30 | registerInToolbar("duplicate"); |
29 | 31 | setHelpId(ht("/Action/Duplicate")); |
30 | 32 | } |
31 | 33 | |
-
diff --git a/src/org/openstreetmap/josm/actions/ExitAction.java b/src/org/openstreetmap/josm/actions/ExitAction.java
index 2e010cfc6..9aa368d80 100644
a
|
b
|
|
20 | 20 | * Construct the action with "Exit" as label |
21 | 21 | */ |
22 | 22 | public ExitAction() { |
23 | | super(tr("Exit"), "exit", tr("Exit the application."), |
24 | | Shortcut.registerShortcut("system:menuexit", tr("Exit"), KeyEvent.VK_Q, Shortcut.CTRL), true, false); |
| 23 | super(false); |
| 24 | setName(tr("Exit")); |
| 25 | setIcon("exit"); |
| 26 | setShortcut(Shortcut.registerShortcut("system:menuexit", tr("Exit"), KeyEvent.VK_Q, Shortcut.CTRL)); |
| 27 | setTooltip(tr("Exit the application.")); |
| 28 | registerInToolbar("exit"); |
25 | 29 | setHelpId(ht("/Action/Exit")); |
26 | 30 | } |
27 | 31 | |
-
diff --git a/src/org/openstreetmap/josm/actions/ExpertToggleAction.java b/src/org/openstreetmap/josm/actions/ExpertToggleAction.java
index 76c6e6837..4838a672d 100644
a
|
b
|
|
7 | 7 | import java.awt.event.ActionEvent; |
8 | 8 | |
9 | 9 | import org.openstreetmap.josm.data.preferences.BooleanProperty; |
10 | | import org.openstreetmap.josm.gui.MainApplication; |
11 | 10 | import org.openstreetmap.josm.tools.ImageProvider; |
12 | 11 | import org.openstreetmap.josm.tools.ListenerList; |
13 | 12 | |
… |
… |
public static synchronized boolean hasVisibilitySwitcher(Component c) {
|
109 | 108 | * Constructs a new {@code ExpertToggleAction}. |
110 | 109 | */ |
111 | 110 | public ExpertToggleAction() { |
112 | | super(tr("Expert Mode"), |
113 | | new ImageProvider("expert").setOptional(true), |
114 | | tr("Enable/disable expert mode"), |
115 | | null, |
116 | | false /* register toolbar */, null, false |
117 | | ); |
118 | | setToolbarId("expertmode"); |
119 | | if (MainApplication.getToolbar() != null) { |
120 | | MainApplication.getToolbar().register(this); |
121 | | } |
| 111 | super(false); |
| 112 | setName(tr("Expert Mode")); |
| 113 | setIcon(new ImageProvider("expert").setOptional(true)); |
| 114 | setTooltip(tr("Enable/disable expert mode")); |
| 115 | registerInToolbar("expertmode"); |
122 | 116 | setSelected(PREF_EXPERT.get()); |
123 | 117 | notifySelectedState(); |
124 | 118 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/FollowLineAction.java b/src/org/openstreetmap/josm/actions/FollowLineAction.java
index 3783bce34..a8cf356d7 100644
a
|
b
|
|
40 | 40 | * Constructs a new {@code FollowLineAction}. |
41 | 41 | */ |
42 | 42 | public FollowLineAction() { |
43 | | super( |
44 | | tr("Follow line"), |
45 | | "followline", |
46 | | tr("Continues drawing a line that shares nodes with another line."), |
47 | | Shortcut.registerShortcut("tools:followline", tr( |
48 | | "Tool: {0}", tr("Follow")), |
49 | | KeyEvent.VK_F, Shortcut.DIRECT), true); |
| 43 | setName(tr("Follow line")); |
| 44 | setIcon("followline"); |
| 45 | setShortcut(Shortcut.registerShortcut("tools:followline", tr("Tool: {0}", tr("Follow")), KeyEvent.VK_F, Shortcut.DIRECT)); |
| 46 | setTooltip(tr("Continues drawing a line that shares nodes with another line.")); |
| 47 | registerInToolbar("followline"); |
50 | 48 | } |
51 | 49 | |
52 | 50 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java b/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java
index 25e888b0d..ab3104d00 100644
a
|
b
|
|
36 | 36 | * Constructs a new {@code FullscreenToggleAction}. |
37 | 37 | */ |
38 | 38 | public FullscreenToggleAction() { |
39 | | super(tr("Fullscreen view"), |
40 | | null, /* no icon */ |
41 | | tr("Toggle fullscreen view"), |
42 | | Shortcut.registerShortcut("menu:view:fullscreen", tr("Toggle fullscreen view"), KeyEvent.VK_F11, Shortcut.DIRECT), |
43 | | false /* register */, null, false |
44 | | ); |
| 39 | super(false); |
| 40 | setName(tr("Fullscreen view")); |
| 41 | setShortcut(Shortcut.registerShortcut("menu:view:fullscreen", tr("Toggle fullscreen view"), KeyEvent.VK_F11, Shortcut.DIRECT)); |
| 42 | setTooltip(tr("Toggle fullscreen view")); |
45 | 43 | setHelpId(ht("/Action/FullscreenView")); |
46 | | setToolbarId("fullscreen"); |
47 | | MainApplication.getToolbar().register(this); |
| 44 | registerInToolbar("fullscreen"); |
48 | 45 | gd = GraphicsEnvironment.isHeadless() ? null : GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
49 | 46 | setSelected(Config.getPref().getBoolean("draw.fullscreen", false)); |
50 | 47 | notifySelectedState(); |
-
diff --git a/src/org/openstreetmap/josm/actions/GpxExportAction.java b/src/org/openstreetmap/josm/actions/GpxExportAction.java
index 601ec619e..5301d83f0 100644
a
|
b
|
|
33 | 33 | * Constructs a new {@code GpxExportAction}. |
34 | 34 | */ |
35 | 35 | public GpxExportAction() { |
36 | | super(tr("Export to GPX..."), "exportgpx", tr("Export the data to GPX file."), |
37 | | Shortcut.registerShortcut("file:exportgpx", tr("Export to GPX..."), KeyEvent.VK_E, Shortcut.CTRL)); |
| 36 | super(true); |
| 37 | setName(tr("Export to GPX...")); |
| 38 | setIcon("exportgpx"); |
| 39 | setShortcut(Shortcut.registerShortcut("file:exportgpx", tr("Export to GPX..."), KeyEvent.VK_E, Shortcut.CTRL)); |
| 40 | setTooltip(tr("Export the data to GPX file.")); |
| 41 | registerInToolbar("exportgpx"); |
38 | 42 | setHelpId(ht("/Action/GpxExport")); |
39 | 43 | } |
40 | 44 | |
41 | 45 | /** |
42 | 46 | * Deferring constructor for child classes. |
43 | 47 | * |
44 | | * @param name see {@code DiskAccessAction} |
45 | | * @param iconName see {@code DiskAccessAction} |
46 | | * @param tooltip see {@code DiskAccessAction} |
47 | | * @param shortcut see {@code DiskAccessAction} |
48 | | * @param register see {@code DiskAccessAction} |
49 | | * @param toolbarId see {@code DiskAccessAction} |
50 | 48 | * @param installAdapters see {@code DiskAccessAction} |
51 | 49 | * |
52 | 50 | * @since 13210 |
53 | 51 | */ |
54 | | protected GpxExportAction(String name, String iconName, String tooltip, Shortcut shortcut, |
55 | | boolean register, String toolbarId, boolean installAdapters) { |
56 | | super(name, iconName, tooltip, shortcut, register, toolbarId, installAdapters); |
| 52 | protected GpxExportAction(boolean installAdapters) { |
| 53 | super(installAdapters); |
57 | 54 | } |
58 | 55 | |
59 | 56 | /** |
-
diff --git a/src/org/openstreetmap/josm/actions/HelpAction.java b/src/org/openstreetmap/josm/actions/HelpAction.java
index fa2c4b9da..e0e04f32d 100644
a
|
b
|
public HelpAction() {
|
32 | 32 | } |
33 | 33 | |
34 | 34 | private HelpAction(boolean shortcut) { |
35 | | super(tr("Help"), "help", null, |
36 | | shortcut ? Shortcut.registerShortcut("system:help", tr("Help"), KeyEvent.VK_F1, Shortcut.DIRECT) : null, |
37 | | true, false); |
| 35 | super(false); |
| 36 | setName(tr("Help")); |
| 37 | setIcon("help"); |
| 38 | setShortcut(shortcut ? Shortcut.registerShortcut("system:help", tr("Help"), KeyEvent.VK_F1, Shortcut.DIRECT) : null); |
| 39 | registerInToolbar("help"); |
38 | 40 | setEnabled(!NetworkManager.isOffline(OnlineResource.JOSM_WEBSITE)); |
39 | 41 | } |
40 | 42 | |
-
diff --git a/src/org/openstreetmap/josm/actions/HistoryInfoAction.java b/src/org/openstreetmap/josm/actions/HistoryInfoAction.java
index d0a01cdd0..21d3debe9 100644
a
|
b
|
|
35 | 35 | * Constructs a new {@code HistoryInfoAction}. |
36 | 36 | */ |
37 | 37 | public HistoryInfoAction() { |
38 | | super(tr("History"), "dialogs/history", |
39 | | tr("Display history information about OSM ways, nodes, or relations."), |
40 | | SHORTCUT, true, "action/historyinfo", false); |
| 38 | super(false); |
| 39 | setName(tr("History")); |
| 40 | setIcon("dialogs/history"); |
| 41 | setShortcut(SHORTCUT); |
| 42 | setTooltip(tr("Display history information about OSM ways, nodes, or relations.")); |
| 43 | registerInToolbar("action/historyinfo"); |
41 | 44 | setHelpId(ht("/Action/ObjectHistory")); |
42 | 45 | setEnabled(true); |
43 | 46 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/HistoryInfoWebAction.java b/src/org/openstreetmap/josm/actions/HistoryInfoWebAction.java
index 860b9f928..f9a05b09f 100644
a
|
b
|
|
21 | 21 | * Constructs a new {@code HistoryInfoWebAction}. |
22 | 22 | */ |
23 | 23 | public HistoryInfoWebAction() { |
24 | | super(tr("History (web)"), "dialogs/history", |
25 | | tr("Display history information about OSM ways, nodes, or relations in web browser."), |
26 | | Shortcut.registerShortcut("core:historyinfoweb", |
27 | | tr("History (web)"), KeyEvent.VK_H, Shortcut.CTRL_SHIFT), |
28 | | true, "action/historyinfoweb", true); |
| 24 | super(true); |
| 25 | setName(tr("History (web)")); |
| 26 | setIcon("dialogs/history"); |
| 27 | setShortcut(Shortcut.registerShortcut("core:historyinfoweb", tr("History (web)"), KeyEvent.VK_H, Shortcut.CTRL_SHIFT)); |
| 28 | setTooltip(tr("Display history information about OSM ways, nodes, or relations in web browser.")); |
| 29 | registerInToolbar("action/historyinfoweb"); |
29 | 30 | setHelpId(ht("/Action/ObjectHistoryWeb")); |
30 | 31 | } |
31 | 32 | |
-
diff --git a/src/org/openstreetmap/josm/actions/InfoAction.java b/src/org/openstreetmap/josm/actions/InfoAction.java
index da04f5718..8cb398e90 100644
a
|
b
|
|
23 | 23 | * Constructs a new {@code InfoAction}. |
24 | 24 | */ |
25 | 25 | public InfoAction() { |
26 | | super(tr("Advanced info"), "info", |
27 | | tr("Display advanced object information about OSM nodes, ways, or relations."), |
28 | | Shortcut.registerShortcut("core:info", |
29 | | tr("Advanced info"), KeyEvent.VK_I, Shortcut.CTRL), |
30 | | true, "action/info", true); |
| 26 | setName(tr("Advanced info")); |
| 27 | setIcon("info"); |
| 28 | setShortcut(Shortcut.registerShortcut("core:info", tr("Advanced info"), KeyEvent.VK_I, Shortcut.CTRL)); |
| 29 | setTooltip(tr("Display advanced object information about OSM nodes, ways, or relations.")); |
| 30 | registerInToolbar("action/info"); |
31 | 31 | setHelpId(ht("/Action/InfoAboutElements")); |
32 | 32 | } |
33 | 33 | |
-
diff --git a/src/org/openstreetmap/josm/actions/InfoWebAction.java b/src/org/openstreetmap/josm/actions/InfoWebAction.java
index 53c4d6f2f..92182b539 100644
a
|
b
|
|
25 | 25 | * Constructs a new {@code InfoWebAction}. |
26 | 26 | */ |
27 | 27 | public InfoWebAction() { |
28 | | super(tr("Advanced info (web)"), "info", |
29 | | tr("Display object information about OSM nodes, ways, or relations in web browser."), |
30 | | Shortcut.registerShortcut("core:infoweb", |
31 | | tr("Advanced info (web)"), KeyEvent.VK_I, Shortcut.CTRL_SHIFT), |
32 | | true, "action/infoweb", true); |
| 28 | super(true); |
| 29 | setName(tr("Advanced info (web)")); |
| 30 | setIcon("info"); |
| 31 | setShortcut(Shortcut.registerShortcut("core:infoweb", tr("Advanced info (web)"), KeyEvent.VK_I, Shortcut.CTRL_SHIFT)); |
| 32 | setTooltip(tr("Display object information about OSM nodes, ways, or relations in web browser.")); |
| 33 | registerInToolbar("action/infoweb"); |
33 | 34 | setHelpId(ht("/Action/InfoAboutElementsWeb")); |
34 | 35 | } |
35 | 36 | |
-
diff --git a/src/org/openstreetmap/josm/actions/JoinAreasAction.java b/src/org/openstreetmap/josm/actions/JoinAreasAction.java
index 2f9bf7ee0..a5e04ffb4 100644
a
|
b
|
public JoinAreasAction() {
|
466 | 466 | * @since 11611 |
467 | 467 | */ |
468 | 468 | public JoinAreasAction(boolean addShortcutToolbarAdapters) { |
469 | | super(tr("Join overlapping Areas"), "joinareas", tr("Joins areas that overlap each other"), addShortcutToolbarAdapters ? |
470 | | Shortcut.registerShortcut("tools:joinareas", tr("Tool: {0}", tr("Join overlapping Areas")), KeyEvent.VK_J, Shortcut.SHIFT) |
471 | | : null, addShortcutToolbarAdapters, null, addShortcutToolbarAdapters); |
| 469 | super(addShortcutToolbarAdapters); |
| 470 | setName(tr("Join overlapping Areas")); |
| 471 | setIcon("joinareas"); |
| 472 | setTooltip(tr("Joins areas that overlap each other")); |
| 473 | setToolbarId("joinareas"); |
| 474 | if (addShortcutToolbarAdapters) { |
| 475 | setShortcut(Shortcut.registerShortcut("tools:joinareas", tr("Tool: {0}", tr("Join overlapping Areas")), |
| 476 | KeyEvent.VK_J, Shortcut.SHIFT)); |
| 477 | registerInToolbar("joinareas"); |
| 478 | } |
472 | 479 | addUndoRedo = addShortcutToolbarAdapters; |
473 | 480 | } |
474 | 481 | |
-
diff --git a/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java b/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
index 8f4180fa5..4c15f90bf 100644
a
|
b
|
|
52 | 52 | |
53 | 53 | protected final boolean joinWayToNode; |
54 | 54 | |
55 | | protected JoinNodeWayAction(boolean joinWayToNode, String name, String iconName, String tooltip, |
56 | | Shortcut shortcut, boolean registerInToolbar) { |
57 | | super(name, iconName, tooltip, shortcut, registerInToolbar); |
| 55 | protected JoinNodeWayAction(boolean joinWayToNode) { |
58 | 56 | this.joinWayToNode = joinWayToNode; |
59 | 57 | } |
60 | 58 | |
… |
… |
protected JoinNodeWayAction(boolean joinWayToNode, String name, String iconName,
|
63 | 61 | * @return the Join Node to Way action |
64 | 62 | */ |
65 | 63 | public static JoinNodeWayAction createJoinNodeToWayAction() { |
66 | | JoinNodeWayAction action = new JoinNodeWayAction(false, |
67 | | tr("Join Node to Way"), /* ICON */ "joinnodeway", |
68 | | tr("Include a node into the nearest way segments"), |
69 | | Shortcut.registerShortcut("tools:joinnodeway", tr("Tool: {0}", tr("Join Node to Way")), |
70 | | KeyEvent.VK_J, Shortcut.DIRECT), true); |
| 64 | JoinNodeWayAction action = new JoinNodeWayAction(false); |
| 65 | action.setName(tr("Join Node to Way")); |
| 66 | action.setIcon(/* ICON */ "joinnodeway"); |
| 67 | action.setShortcut(Shortcut.registerShortcut("tools:joinnodeway", tr("Tool: {0}", tr("Join Node to Way")), |
| 68 | KeyEvent.VK_J, Shortcut.DIRECT)); |
| 69 | action.setTooltip(tr("Include a node into the nearest way segments")); |
| 70 | action.registerInToolbar("joinnodeway"); |
71 | 71 | action.setHelpId(ht("/Action/JoinNodeWay")); |
72 | 72 | return action; |
73 | 73 | } |
… |
… |
public static JoinNodeWayAction createJoinNodeToWayAction() {
|
77 | 77 | * @return the Move Node onto Way action |
78 | 78 | */ |
79 | 79 | public static JoinNodeWayAction createMoveNodeOntoWayAction() { |
80 | | JoinNodeWayAction action = new JoinNodeWayAction(true, |
81 | | tr("Move Node onto Way"), /* ICON*/ "movenodeontoway", |
82 | | tr("Move the node onto the nearest way segments and include it"), |
83 | | Shortcut.registerShortcut("tools:movenodeontoway", tr("Tool: {0}", tr("Move Node onto Way")), |
84 | | KeyEvent.VK_N, Shortcut.DIRECT), true); |
| 80 | JoinNodeWayAction action = new JoinNodeWayAction(true); |
| 81 | action.setName(tr("Move Node onto Way")); |
| 82 | action.setIcon(/* ICON*/ "movenodeontoway"); |
| 83 | action.setShortcut(Shortcut.registerShortcut("tools:movenodeontoway", tr("Tool: {0}", tr("Move Node onto Way")), |
| 84 | KeyEvent.VK_N, Shortcut.DIRECT)); |
| 85 | action.setTooltip(tr("Move the node onto the nearest way segments and include it")); |
| 86 | action.registerInToolbar("movenodeontoway"); |
85 | 87 | action.setHelpId(ht("/Action/MoveNodeWay")); |
86 | 88 | return action; |
87 | 89 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/JosmAction.java b/src/org/openstreetmap/josm/actions/JosmAction.java
index 3a5b8bc69..107e6f40b 100644
a
|
b
|
|
6 | 6 | import java.awt.GridBagLayout; |
7 | 7 | import java.awt.event.KeyEvent; |
8 | 8 | import java.util.Collection; |
9 | | import java.util.List; |
10 | 9 | import java.util.concurrent.CancellationException; |
11 | 10 | import java.util.concurrent.ExecutionException; |
12 | 11 | import java.util.concurrent.Future; |
… |
… |
|
31 | 30 | import org.openstreetmap.josm.gui.layer.MainLayerManager; |
32 | 31 | import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeEvent; |
33 | 32 | import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; |
| 33 | import org.openstreetmap.josm.gui.preferences.ToolbarPreferences; |
34 | 34 | import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; |
35 | 35 | import org.openstreetmap.josm.gui.widgets.JMultilineLabel; |
36 | 36 | import org.openstreetmap.josm.tools.Destroyable; |
… |
… |
|
77 | 77 | * @param registerInToolbar register this action for the toolbar preferences? |
78 | 78 | * @param toolbarId identifier for the toolbar preferences |
79 | 79 | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
| 80 | * @deprecated use {@link #JosmAction(boolean)} and setters |
80 | 81 | */ |
| 82 | @Deprecated |
81 | 83 | public JosmAction(String name, ImageProvider icon, String tooltip, Shortcut shortcut, boolean registerInToolbar, |
82 | 84 | String toolbarId, boolean installAdapters) { |
83 | | super(name); |
84 | | if (icon != null) { |
85 | | ImageResource resource = icon.getResource(); |
86 | | if (resource != null) { |
87 | | try { |
88 | | resource.attachImageIcon(this, true); |
89 | | } catch (RuntimeException e) { |
90 | | Logging.warn("Unable to attach image icon {0} for action {1}", icon, name); |
91 | | Logging.error(e); |
92 | | } |
93 | | } |
94 | | } |
95 | | setHelpId(); |
96 | | sc = shortcut; |
97 | | if (sc != null && !sc.isAutomatic()) { |
98 | | MainApplication.registerActionShortcut(this, sc); |
99 | | } |
| 85 | this(installAdapters); |
| 86 | setName(name); |
| 87 | setIcon(icon); |
| 88 | setShortcut(shortcut); |
100 | 89 | setTooltip(tooltip); |
101 | | if (getValue("toolbar") == null) { |
| 90 | if (toolbarId != null && registerInToolbar) { |
| 91 | registerInToolbar(toolbarId); |
| 92 | } else if (toolbarId != null) { |
102 | 93 | setToolbarId(toolbarId); |
103 | 94 | } |
104 | | if (registerInToolbar && MainApplication.getToolbar() != null) { |
105 | | MainApplication.getToolbar().register(this); |
106 | | } |
107 | | if (installAdapters) { |
108 | | installAdapters(); |
109 | | } |
110 | 95 | } |
111 | 96 | |
112 | 97 | /** |
… |
… |
public JosmAction(String name, ImageProvider icon, String tooltip, Shortcut shor
|
125 | 110 | * @param registerInToolbar register this action for the toolbar preferences? |
126 | 111 | * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null |
127 | 112 | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
| 113 | * @deprecated use {@link #JosmAction(boolean)} and setters |
128 | 114 | */ |
| 115 | @Deprecated |
129 | 116 | public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar, |
130 | 117 | String toolbarId, boolean installAdapters) { |
131 | | this(name, iconName == null ? null : new ImageProvider(iconName).setOptional(true), tooltip, shortcut, registerInToolbar, |
132 | | toolbarId == null ? iconName : toolbarId, installAdapters); |
| 118 | this(installAdapters); |
| 119 | setName(name); |
| 120 | setIcon(iconName); |
| 121 | setShortcut(shortcut); |
| 122 | setTooltip(tooltip); |
| 123 | if (registerInToolbar) { |
| 124 | registerInToolbar(toolbarId == null ? iconName : toolbarId); |
| 125 | } else { |
| 126 | setToolbarId(toolbarId == null ? iconName : toolbarId); |
| 127 | } |
133 | 128 | } |
134 | 129 | |
135 | 130 | /** |
… |
… |
public JosmAction(String name, String iconName, String tooltip, Shortcut shortcu
|
147 | 142 | * the user CANNOT configure a shortcut for your action. |
148 | 143 | * @param registerInToolbar register this action for the toolbar preferences? |
149 | 144 | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
| 145 | * @deprecated use {@link #JosmAction(boolean)} and setters |
150 | 146 | */ |
| 147 | @Deprecated |
151 | 148 | public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar, boolean installAdapters) { |
152 | | this(name, iconName, tooltip, shortcut, registerInToolbar, null, installAdapters); |
| 149 | this(installAdapters); |
| 150 | setName(name); |
| 151 | setIcon(iconName); |
| 152 | setShortcut(shortcut); |
| 153 | setTooltip(tooltip); |
| 154 | if (registerInToolbar) { |
| 155 | registerInToolbar(iconName); |
| 156 | } else { |
| 157 | setToolbarId(iconName); |
| 158 | } |
153 | 159 | } |
154 | 160 | |
155 | 161 | /** |
… |
… |
public JosmAction(String name, String iconName, String tooltip, Shortcut shortcu
|
166 | 172 | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
167 | 173 | * the user CANNOT configure a shortcut for your action. |
168 | 174 | * @param registerInToolbar register this action for the toolbar preferences? |
| 175 | * @deprecated use setters |
169 | 176 | */ |
| 177 | @Deprecated |
170 | 178 | public JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) { |
171 | | this(name, iconName, tooltip, shortcut, registerInToolbar, null, true); |
| 179 | setName(name); |
| 180 | setIcon(iconName); |
| 181 | setShortcut(shortcut); |
| 182 | setTooltip(tooltip); |
| 183 | if (registerInToolbar) { |
| 184 | registerInToolbar(iconName); |
| 185 | } else { |
| 186 | setToolbarId(iconName); |
| 187 | } |
172 | 188 | } |
173 | 189 | |
174 | 190 | /** |
… |
… |
public JosmAction() {
|
182 | 198 | * Constructs a new {@code JosmAction}. |
183 | 199 | * |
184 | 200 | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
| 201 | * @see #setName(String) |
| 202 | * @see #setIcon(String) |
| 203 | * @see #setIcon(ImageProvider) |
| 204 | * @see #setShortcut(Shortcut) |
| 205 | * @see #setTooltip(String) |
| 206 | * @see #setHelpId(String) |
| 207 | * @see #registerInToolbar(String) |
185 | 208 | */ |
186 | 209 | public JosmAction(boolean installAdapters) { |
187 | 210 | setHelpId(); |
… |
… |
public JosmAction(boolean installAdapters) {
|
191 | 214 | } |
192 | 215 | |
193 | 216 | /** |
194 | | * Constructs a new {@code JosmAction}. |
195 | | * |
196 | | * Use this super constructor to setup your action. |
197 | | * |
| 217 | * Sets the name |
198 | 218 | * @param name the action's text as displayed on the menu (if it is added to a menu) |
| 219 | */ |
| 220 | protected final void setName(String name) { |
| 221 | putValue(NAME, name); |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Sets the toolbar identifier and registers this action in the toolbar |
| 226 | * |
| 227 | * @param toolbarId identifier for the toolbar preferences |
| 228 | * @see ToolbarPreferences#register(javax.swing.Action) |
| 229 | */ |
| 230 | protected final void registerInToolbar(String toolbarId) { |
| 231 | setToolbarId(toolbarId); |
| 232 | if (MainApplication.getToolbar() != null) { |
| 233 | MainApplication.getToolbar().register(this); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * Sets the shortcut |
| 239 | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
| 240 | * do want a shortcut, remember you can always register it with group=none, so you |
| 241 | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
| 242 | * the user CANNOT configure a shortcut for your action. |
| 243 | */ |
| 244 | protected final void setShortcut(Shortcut shortcut) { |
| 245 | sc = shortcut; |
| 246 | if (sc != null && !sc.isAutomatic()) { |
| 247 | MainApplication.registerActionShortcut(this, sc); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Sets the icon name |
199 | 253 | * @param iconName the filename of the icon to use |
200 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
201 | | * that html is not supported for menu actions on some platforms. |
202 | | * @param shortcuts ready-created shortcut objects |
203 | | * @since 14012 |
204 | 254 | */ |
205 | | public JosmAction(String name, String iconName, String tooltip, List<Shortcut> shortcuts) { |
206 | | this(name, iconName, tooltip, shortcuts.get(0), true, null, true); |
207 | | for (int i = 1; i < shortcuts.size(); i++) { |
208 | | MainApplication.registerActionShortcut(this, shortcuts.get(i)); |
| 255 | protected final void setIcon(String iconName) { |
| 256 | if (iconName == null) { |
| 257 | return; |
| 258 | } |
| 259 | ImageProvider icon = new ImageProvider(iconName).setOptional(true); |
| 260 | setIcon(icon); |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * Sets the icon |
| 265 | * @param icon the icon to use |
| 266 | */ |
| 267 | protected final void setIcon(ImageProvider icon) { |
| 268 | if (icon == null) { |
| 269 | return; |
| 270 | } |
| 271 | ImageResource resource = icon.getResource(); |
| 272 | if (resource == null) { |
| 273 | return; |
| 274 | } |
| 275 | try { |
| 276 | resource.attachImageIcon(this, true); |
| 277 | } catch (RuntimeException e) { |
| 278 | Logging.warn("Unable to attach image icon {0} for action {1}", icon, getValue(NAME)); |
| 279 | Logging.error(e); |
209 | 280 | } |
210 | 281 | } |
211 | 282 | |
… |
… |
protected void setHelpId(String helpId) {
|
304 | 375 | /** |
305 | 376 | * Sets the toolbar id. |
306 | 377 | * @param toolbarId toolbar id |
| 378 | * @see #registerInToolbar(String) |
307 | 379 | * @since 16138 |
308 | 380 | */ |
309 | 381 | protected void setToolbarId(String toolbarId) { |
… |
… |
public Shortcut getShortcut() {
|
326 | 398 | |
327 | 399 | /** |
328 | 400 | * Sets the tooltip text of this action. |
| 401 | * Make sure to call {@link #setShortcut(Shortcut)} first to have the shortcut included in the tooltip. |
329 | 402 | * @param tooltip The text to display in tooltip. Can be {@code null} |
330 | 403 | */ |
331 | 404 | public final void setTooltip(String tooltip) { |
-
diff --git a/src/org/openstreetmap/josm/actions/JumpToAction.java b/src/org/openstreetmap/josm/actions/JumpToAction.java
index 313d86a6e..90280b6ac 100644
a
|
b
|
|
32 | 32 | import org.openstreetmap.josm.io.NameFinder; |
33 | 33 | import org.openstreetmap.josm.spi.preferences.Config; |
34 | 34 | import org.openstreetmap.josm.tools.GBC; |
35 | | import org.openstreetmap.josm.tools.ImageProvider; |
36 | 35 | import org.openstreetmap.josm.tools.Logging; |
37 | 36 | import org.openstreetmap.josm.tools.OsmUrlToBounds; |
38 | 37 | import org.openstreetmap.josm.tools.Shortcut; |
… |
… |
|
53 | 52 | * Constructs a new {@code JumpToAction}. |
54 | 53 | */ |
55 | 54 | public JumpToAction() { |
56 | | super(tr("Jump to Position"), (ImageProvider) null, tr("Opens a dialog that allows to jump to a specific location"), |
57 | | Shortcut.registerShortcut("tools:jumpto", tr("Tool: {0}", tr("Jump to Position")), |
58 | | KeyEvent.VK_J, Shortcut.CTRL), true, "action/jumpto", false); |
| 55 | setName(tr("Jump to Position")); |
| 56 | setShortcut(Shortcut.registerShortcut("tools:jumpto", tr("Tool: {0}", tr("Jump to Position")), |
| 57 | KeyEvent.VK_J, Shortcut.CTRL)); |
| 58 | setTooltip(tr("Opens a dialog that allows to jump to a specific location")); |
| 59 | registerInToolbar("action/jumpto"); |
59 | 60 | // make this action listen to mapframe change events |
60 | 61 | MainApplication.addMapFrameListener((o, n) -> updateEnabledState()); |
61 | 62 | |
-
diff --git a/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java b/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java
index eff64286a..b919ae395 100644
a
|
b
|
private boolean isSelected() {
|
80 | 80 | * Constructs a new {@code MapRectifierWMSmenuAction}. |
81 | 81 | */ |
82 | 82 | public MapRectifierWMSmenuAction() { |
83 | | super(tr("Rectified Image..."), |
84 | | "OLmarker", |
85 | | tr("Download Rectified Images From Various Services"), |
86 | | Shortcut.registerShortcut("imagery:rectimg", |
87 | | tr("Imagery: {0}", tr("Rectified Image...")), |
88 | | KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), |
89 | | true |
90 | | ); |
| 83 | setName(tr("Rectified Image...")); |
| 84 | setIcon("OLmarker"); |
| 85 | setShortcut(Shortcut.registerShortcut("imagery:rectimg", tr("Imagery: {0}", tr("Rectified Image...")), |
| 86 | KeyEvent.CHAR_UNDEFINED, Shortcut.NONE)); |
| 87 | setTooltip(tr("Download Rectified Images From Various Services")); |
| 88 | registerInToolbar("OLmarker"); |
91 | 89 | setHelpId(ht("/Menu/Imagery")); |
92 | 90 | |
93 | 91 | // Add default services |
-
diff --git a/src/org/openstreetmap/josm/actions/MergeLayerAction.java b/src/org/openstreetmap/josm/actions/MergeLayerAction.java
index a12634d19..8403e5e63 100644
a
|
b
|
|
36 | 36 | * Constructs a new {@code MergeLayerAction}. |
37 | 37 | */ |
38 | 38 | public MergeLayerAction() { |
39 | | super(tr("Merge layer"), "dialogs/mergedown", |
40 | | tr("Merge the current layer into another layer"), |
41 | | Shortcut.registerShortcut("system:merge", tr("Edit: {0}", |
42 | | tr("Merge")), KeyEvent.VK_M, Shortcut.CTRL), |
43 | | true, "action/mergelayer", true); |
| 39 | setName(tr("Merge layer")); |
| 40 | setIcon("dialogs/mergedown"); |
| 41 | setShortcut(Shortcut.registerShortcut("system:merge", tr("Edit: {0}", tr("Merge")), KeyEvent.VK_M, Shortcut.CTRL)); |
| 42 | setTooltip(tr("Merge the current layer into another layer")); |
| 43 | registerInToolbar("action/mergelayer"); |
44 | 44 | setHelpId(ht("/Action/MergeLayer")); |
45 | 45 | } |
46 | 46 | |
-
diff --git a/src/org/openstreetmap/josm/actions/MergeNodesAction.java b/src/org/openstreetmap/josm/actions/MergeNodesAction.java
index a48b2d245..09e2467ad 100644
a
|
b
|
|
66 | 66 | * Constructs a new {@code MergeNodesAction}. |
67 | 67 | */ |
68 | 68 | public MergeNodesAction() { |
69 | | super(tr("Merge Nodes"), "mergenodes", tr("Merge nodes into the oldest one."), |
70 | | Shortcut.registerShortcut("tools:mergenodes", tr("Tool: {0}", tr("Merge Nodes")), KeyEvent.VK_M, Shortcut.DIRECT), true); |
| 69 | setName(tr("Merge Nodes")); |
| 70 | setIcon("mergenodes"); |
| 71 | setShortcut(Shortcut.registerShortcut("tools:mergenodes", tr("Tool: {0}", tr("Merge Nodes")), KeyEvent.VK_M, Shortcut.DIRECT)); |
| 72 | setTooltip(tr("Merge nodes into the oldest one.")); |
| 73 | registerInToolbar("mergenodes"); |
71 | 74 | setHelpId(ht("/Action/MergeNodes")); |
72 | 75 | } |
73 | 76 | |
-
diff --git a/src/org/openstreetmap/josm/actions/MergeSelectionAction.java b/src/org/openstreetmap/josm/actions/MergeSelectionAction.java
index 7e33b4f9a..29a69bd52 100644
a
|
b
|
|
29 | 29 | * Constructs a new {@code MergeSelectionAction}. |
30 | 30 | */ |
31 | 31 | public MergeSelectionAction() { |
32 | | super(tr("Merge selection"), "dialogs/mergedown", tr("Merge the currently selected objects into another layer"), |
33 | | Shortcut.registerShortcut("system:mergeselection", tr("Edit: {0}", tr("Merge selection")), |
34 | | KeyEvent.VK_M, Shortcut.CTRL_SHIFT), |
35 | | true /* register */ |
36 | | ); |
| 32 | setName(tr("Merge selection")); |
| 33 | setIcon("dialogs/mergedown"); |
| 34 | setShortcut(Shortcut.registerShortcut("system:mergeselection", tr("Edit: {0}", tr("Merge selection")), |
| 35 | KeyEvent.VK_M, Shortcut.CTRL_SHIFT)); |
| 36 | setTooltip(tr("Merge the currently selected objects into another layer")); |
| 37 | registerInToolbar("dialogs/mergedown"); |
37 | 38 | setHelpId(ht("/Action/MergeSelection")); |
38 | 39 | } |
39 | 40 | |
-
diff --git a/src/org/openstreetmap/josm/actions/MirrorAction.java b/src/org/openstreetmap/josm/actions/MirrorAction.java
index 8d152151c..031cfaff4 100644
a
|
b
|
|
36 | 36 | * Constructs a new {@code MirrorAction}. |
37 | 37 | */ |
38 | 38 | public MirrorAction() { |
39 | | super(tr("Mirror"), "mirror", tr("Mirror selected nodes and ways."), |
40 | | Shortcut.registerShortcut("tools:mirror", tr("Tool: {0}", tr("Mirror")), |
41 | | KeyEvent.VK_M, Shortcut.SHIFT), true); |
| 39 | setName(tr("Mirror")); |
| 40 | setIcon("mirror"); |
| 41 | setShortcut(Shortcut.registerShortcut("tools:mirror", tr("Tool: {0}", tr("Mirror")), KeyEvent.VK_M, Shortcut.SHIFT)); |
| 42 | setTooltip(tr("Mirror selected nodes and ways.")); |
| 43 | registerInToolbar("mirror"); |
42 | 44 | setHelpId(ht("/Action/Mirror")); |
43 | 45 | } |
44 | 46 | |
-
diff --git a/src/org/openstreetmap/josm/actions/MoveAction.java b/src/org/openstreetmap/josm/actions/MoveAction.java
index 568341ee4..02d0cbf1f 100644
a
|
b
|
Shortcut getShortcut() {
|
89 | 89 | * @param dir direction |
90 | 90 | */ |
91 | 91 | public MoveAction(Direction dir) { |
92 | | super(tr("Move {0}", dir.getLocalizedName()), dir.getIcon(), |
93 | | tr("Moves Objects {0}", dir.getLocalizedName()), |
94 | | dir.getShortcut(), true, dir.getToolbarName(), true); |
| 92 | setName(tr("Move {0}", dir.getLocalizedName())); |
| 93 | setIcon(dir.getIcon()); |
| 94 | setShortcut(dir.getShortcut()); |
| 95 | setTooltip(tr("Moves Objects {0}", dir.getLocalizedName())); |
| 96 | registerInToolbar(dir.getToolbarName()); |
95 | 97 | myDirection = dir; |
96 | 98 | setHelpId(ht("/Action/Move")); |
97 | 99 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/MoveNodeAction.java b/src/org/openstreetmap/josm/actions/MoveNodeAction.java
index edffab05e..7364331fa 100644
a
|
b
|
|
28 | 28 | * Constructs a new {@code MoveNodeAction}. |
29 | 29 | */ |
30 | 30 | public MoveNodeAction() { |
31 | | super(tr("Move Node..."), "movenode", tr("Edit latitude and longitude of a node."), |
32 | | Shortcut.registerShortcut("movenode", tr("Edit: {0}", tr("Move Node...")), |
33 | | KeyEvent.VK_M, Shortcut.NONE), true); |
| 31 | setName(tr("Move Node...")); |
| 32 | setIcon("movenode"); |
| 33 | setShortcut(Shortcut.registerShortcut("movenode", tr("Edit: {0}", tr("Move Node...")), KeyEvent.VK_M, Shortcut.NONE)); |
| 34 | setTooltip(tr("Edit latitude and longitude of a node.")); |
| 35 | registerInToolbar("movenode"); |
34 | 36 | setHelpId(ht("/Action/MoveNode")); |
35 | 37 | } |
36 | 38 | |
-
diff --git a/src/org/openstreetmap/josm/actions/NewAction.java b/src/org/openstreetmap/josm/actions/NewAction.java
index 21861d375..9f512689b 100644
a
|
b
|
|
21 | 21 | * Constructs a {@code NewAction}. |
22 | 22 | */ |
23 | 23 | public NewAction() { |
24 | | super(tr("New Layer"), "new", tr("Create a new map layer."), |
25 | | Shortcut.registerShortcut("system:new", tr("File: {0}", tr("New Layer")), KeyEvent.VK_N, Shortcut.CTRL), true, false); |
| 24 | super(false); |
| 25 | setName(tr("New Layer")); |
| 26 | setIcon("new"); |
| 27 | setShortcut(Shortcut.registerShortcut("system:new", tr("File: {0}", tr("New Layer")), KeyEvent.VK_N, Shortcut.CTRL)); |
| 28 | setTooltip(tr("Create a new map layer.")); |
| 29 | registerInToolbar("new"); |
26 | 30 | setHelpId(ht("/Action/NewLayer")); |
27 | 31 | } |
28 | 32 | |
-
diff --git a/src/org/openstreetmap/josm/actions/OpenFileAction.java b/src/org/openstreetmap/josm/actions/OpenFileAction.java
index 5e5f4d028..1599f7955 100644
a
|
b
|
|
65 | 65 | * Create an open action. The name is "Open a file". |
66 | 66 | */ |
67 | 67 | public OpenFileAction() { |
68 | | super(tr("Open..."), "open", tr("Open a file."), |
69 | | Shortcut.registerShortcut("system:open", tr("File: {0}", tr("Open...")), KeyEvent.VK_O, Shortcut.CTRL), |
70 | | true, null, false); |
| 68 | super(false); |
| 69 | setName(tr("Open...")); |
| 70 | setIcon("open"); |
| 71 | setShortcut(Shortcut.registerShortcut("system:open", tr("File: {0}", tr("Open...")), KeyEvent.VK_O, Shortcut.CTRL)); |
| 72 | setTooltip(tr("Open a file.")); |
| 73 | registerInToolbar("open"); |
71 | 74 | setHelpId(ht("/Action/Open")); |
72 | 75 | } |
73 | 76 | |
-
diff --git a/src/org/openstreetmap/josm/actions/OpenLocationAction.java b/src/org/openstreetmap/josm/actions/OpenLocationAction.java
index 823f57103..34ca98127 100644
a
|
b
|
|
83 | 83 | * Create an open action. The name is "Open a file". |
84 | 84 | */ |
85 | 85 | public OpenLocationAction() { |
| 86 | super(false); |
86 | 87 | /* I18N: Command to download a specific location/URL */ |
87 | | super(tr("Open Location..."), "openlocation", tr("Open an URL."), |
88 | | Shortcut.registerShortcut("system:open_location", tr("File: {0}", tr("Open Location...")), |
89 | | KeyEvent.VK_L, Shortcut.CTRL), true, false); |
| 88 | setName(tr("Open Location...")); |
| 89 | setIcon("openlocation"); |
| 90 | setShortcut(Shortcut.registerShortcut("system:open_location", tr("File: {0}", tr("Open Location...")), KeyEvent.VK_L, Shortcut.CTRL)); |
| 91 | setTooltip(tr("Open an URL.")); |
| 92 | registerInToolbar("openlocation"); |
90 | 93 | setHelpId(ht("/Action/OpenLocation")); |
91 | 94 | this.downloadTasks = new ArrayList<>(); |
92 | 95 | addDownloadTaskClass(DownloadOsmTask.class); |
-
diff --git a/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java b/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
index 2500af15d..12dba64a7 100644
a
|
b
|
|
60 | 60 | * Constructs a new {@code OrthogonalizeAction}. |
61 | 61 | */ |
62 | 62 | public OrthogonalizeAction() { |
63 | | super(tr("Orthogonalize Shape"), |
64 | | "ortho", |
65 | | tr("Move nodes so all angles are 90 or 180 degrees"), |
66 | | Shortcut.registerShortcut("tools:orthogonalize", tr("Tool: {0}", tr("Orthogonalize Shape")), |
67 | | KeyEvent.VK_Q, |
68 | | Shortcut.DIRECT), true); |
| 63 | setName(tr("Orthogonalize Shape")); |
| 64 | setIcon("ortho"); |
| 65 | setShortcut(Shortcut.registerShortcut("tools:orthogonalize", tr("Tool: {0}", tr("Orthogonalize Shape")), |
| 66 | KeyEvent.VK_Q, Shortcut.DIRECT)); |
| 67 | setTooltip(tr("Move nodes so all angles are 90 or 180 degrees")); |
| 68 | registerInToolbar("ortho"); |
69 | 69 | setHelpId(ht("/Action/OrthogonalizeShape")); |
70 | 70 | } |
71 | 71 | |
… |
… |
public OrthogonalizeAction() {
|
96 | 96 | * Constructor |
97 | 97 | */ |
98 | 98 | public Undo() { |
99 | | super(tr("Orthogonalize Shape / Undo"), "ortho", |
100 | | tr("Undo orthogonalization for certain nodes"), |
101 | | Shortcut.registerShortcut("tools:orthogonalizeUndo", tr("Tool: {0}", tr("Orthogonalize Shape / Undo")), |
102 | | KeyEvent.VK_Q, |
103 | | Shortcut.SHIFT), |
104 | | true, "action/orthogonalize/undo", true); |
| 99 | setName(tr("Orthogonalize Shape / Undo")); |
| 100 | setIcon("ortho"); |
| 101 | setShortcut(Shortcut.registerShortcut("tools:orthogonalizeUndo", tr("Tool: {0}", tr("Orthogonalize Shape / Undo")), |
| 102 | KeyEvent.VK_Q, Shortcut.SHIFT)); |
| 103 | setTooltip(tr("Undo orthogonalization for certain nodes")); |
| 104 | registerInToolbar("action/orthogonalize/undo"); |
105 | 105 | } |
106 | 106 | |
107 | 107 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/PasteAction.java b/src/org/openstreetmap/josm/actions/PasteAction.java
index 960ee45b5..0374c1cfa 100644
a
|
b
|
|
20 | 20 | * Constructs a new {@code PasteAction}. |
21 | 21 | */ |
22 | 22 | public PasteAction() { |
23 | | super(tr("Paste"), "paste", tr("Paste contents of clipboard."), |
24 | | Shortcut.registerShortcut("system:paste", tr("Edit: {0}", tr("Paste")), KeyEvent.VK_V, Shortcut.CTRL), true); |
| 23 | setName(tr("Paste")); |
| 24 | setIcon("paste"); |
| 25 | setShortcut(Shortcut.registerShortcut("system:paste", tr("Edit: {0}", tr("Paste")), KeyEvent.VK_V, Shortcut.CTRL)); |
| 26 | setTooltip(tr("Paste contents of clipboard.")); |
| 27 | registerInToolbar("paste"); |
25 | 28 | setHelpId(ht("/Action/Paste")); |
26 | 29 | // CUA shortcut for paste (https://en.wikipedia.org/wiki/IBM_Common_User_Access#Description) |
27 | 30 | MainApplication.registerActionShortcut(this, |
-
diff --git a/src/org/openstreetmap/josm/actions/PasteAtSourcePositionAction.java b/src/org/openstreetmap/josm/actions/PasteAtSourcePositionAction.java
index 70ddb2d11..839f4e716 100644
a
|
b
|
|
21 | 21 | * Constructs a new {@link PasteAtSourcePositionAction}. |
22 | 22 | */ |
23 | 23 | public PasteAtSourcePositionAction() { |
24 | | super(tr("Paste at source position"), "paste", tr("Paste contents of clipboard at the position they were copied from."), |
25 | | Shortcut.registerShortcut("menu:edit:pasteAtSource", tr("Edit: {0}", tr("Paste at source position")), |
26 | | KeyEvent.VK_V, Shortcut.ALT_CTRL), true, "pasteatsource"); |
| 24 | setName(tr("Paste at source position")); |
| 25 | setIcon("paste"); |
| 26 | setShortcut(Shortcut.registerShortcut("menu:edit:pasteAtSource", tr("Edit: {0}", tr("Paste at source position")), |
| 27 | KeyEvent.VK_V, Shortcut.ALT_CTRL)); |
| 28 | setTooltip(tr("Paste contents of clipboard at the position they were copied from.")); |
| 29 | registerInToolbar("pasteatsource"); |
27 | 30 | setHelpId(ht("/Action/Paste")); |
28 | 31 | } |
29 | 32 | |
-
diff --git a/src/org/openstreetmap/josm/actions/PasteTagsAction.java b/src/org/openstreetmap/josm/actions/PasteTagsAction.java
index 48beb83b9..e426724f8 100644
a
|
b
|
|
29 | 29 | * Constructs a new {@code PasteTagsAction}. |
30 | 30 | */ |
31 | 31 | public PasteTagsAction() { |
32 | | super(tr("Paste Tags"), "pastetags", |
33 | | tr("Apply tags of contents of paste buffer to all selected items."), |
34 | | Shortcut.registerShortcut("system:pastestyle", tr("Edit: {0}", tr("Paste Tags")), |
35 | | KeyEvent.VK_V, Shortcut.CTRL_SHIFT), true); |
| 32 | setName(tr("Paste Tags")); |
| 33 | setIcon("pastetags"); |
| 34 | setShortcut(Shortcut.registerShortcut("system:pastestyle", tr("Edit: {0}", tr("Paste Tags")), KeyEvent.VK_V, Shortcut.CTRL_SHIFT)); |
| 35 | setTooltip(tr("Apply tags of contents of paste buffer to all selected items.")); |
| 36 | registerInToolbar("pastetags"); |
36 | 37 | setHelpId(HELP); |
37 | 38 | } |
38 | 39 | |
-
diff --git a/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java b/src/org/openstreetmap/josm/actions/PreferenceToggleAction.java
index 3bf6ff91d..9d79069af 100644
a
|
b
|
|
28 | 28 | * @param pref the preference to toggle |
29 | 29 | */ |
30 | 30 | public PreferenceToggleAction(String name, String tooltip, BooleanProperty pref) { |
31 | | super(name, null, tooltip, null, false); |
| 31 | setName(name); |
| 32 | setTooltip(tooltip); |
32 | 33 | setToolbarId("toggle-" + pref.getKey()); |
33 | 34 | this.pref = pref; |
34 | 35 | checkbox = new JCheckBoxMenuItem(this); |
-
diff --git a/src/org/openstreetmap/josm/actions/PreferencesAction.java b/src/org/openstreetmap/josm/actions/PreferencesAction.java
index 471174309..80d282faf 100644
a
|
b
|
|
27 | 27 | |
28 | 28 | private PreferencesAction(String name, String icon, String tooltip, |
29 | 29 | Class<? extends TabPreferenceSetting> tab, Class<? extends SubPreferenceSetting> subTab) { |
30 | | super(name, icon, tooltip, null, false, "preference_" + Utils.<Class<?>>firstNonNull(tab, subTab).getName(), false); |
| 30 | super(false); |
| 31 | setName(name); |
| 32 | setIcon(icon); |
| 33 | setTooltip(tooltip); |
| 34 | setToolbarId("preference_" + Utils.<Class<?>>firstNonNull(tab, subTab).getName()); |
31 | 35 | this.tab = tab; |
32 | 36 | this.subTab = subTab; |
33 | 37 | } |
… |
… |
public static PreferencesAction forPreferenceSubTab(String name, String tooltip,
|
86 | 90 | * Create the preference action with "Preferences" as label. |
87 | 91 | */ |
88 | 92 | public PreferencesAction() { |
89 | | super(tr("Preferences..."), "preference", tr("Open a preferences dialog for global settings."), |
90 | | Shortcut.registerShortcut("system:preferences", tr("Preferences"), KeyEvent.VK_F12, Shortcut.DIRECT), true, false); |
| 93 | super(false); |
| 94 | setName(tr("Preferences...")); |
| 95 | setIcon("preference"); |
| 96 | setShortcut(Shortcut.registerShortcut("system:preferences", tr("Preferences"), KeyEvent.VK_F12, Shortcut.DIRECT)); |
| 97 | setTooltip(tr("Open a preferences dialog for global settings.")); |
| 98 | registerInToolbar("preference"); |
91 | 99 | setHelpId(ht("/Action/Preferences")); |
92 | 100 | this.tab = null; |
93 | 101 | this.subTab = null; |
-
diff --git a/src/org/openstreetmap/josm/actions/PurgeAction.java b/src/org/openstreetmap/josm/actions/PurgeAction.java
index c3305bb51..59fae99c8 100644
a
|
b
|
|
69 | 69 | */ |
70 | 70 | public PurgeAction() { |
71 | 71 | /* translator note: other expressions for "purge" might be "forget", "clean", "obliterate", "prune" */ |
72 | | super(tr("Purge..."), "purge", tr("Forget objects but do not delete them on server when uploading."), |
73 | | Shortcut.registerShortcut("system:purge", tr("Edit: {0}", tr("Purge")), KeyEvent.VK_P, Shortcut.CTRL_SHIFT), |
74 | | true); |
| 72 | setName(tr("Purge...")); |
| 73 | setIcon("purge"); |
| 74 | setShortcut(Shortcut.registerShortcut("system:purge", tr("Edit: {0}", tr("Purge")), KeyEvent.VK_P, Shortcut.CTRL_SHIFT)); |
| 75 | setTooltip(tr("Forget objects but do not delete them on server when uploading.")); |
| 76 | registerInToolbar("purge"); |
75 | 77 | setHelpId(HelpUtil.ht("/Action/Purge")); |
76 | 78 | } |
77 | 79 | |
-
diff --git a/src/org/openstreetmap/josm/actions/RedoAction.java b/src/org/openstreetmap/josm/actions/RedoAction.java
index 36284fb81..66443cd2c 100644
a
|
b
|
|
24 | 24 | * Construct the action with "Redo" as label. |
25 | 25 | */ |
26 | 26 | public RedoAction() { |
27 | | super(tr("Redo"), "redo", tr("Redo the last undone action."), |
28 | | Shortcut.registerShortcut("system:redo", tr("Edit: {0}", tr("Redo")), KeyEvent.VK_Y, Shortcut.CTRL), true); |
| 27 | setName(tr("Redo")); |
| 28 | setIcon("redo"); |
| 29 | setShortcut(Shortcut.registerShortcut("system:redo", tr("Edit: {0}", tr("Redo")), KeyEvent.VK_Y, Shortcut.CTRL)); |
| 30 | setTooltip(tr("Redo the last undone action.")); |
| 31 | registerInToolbar("redo"); |
29 | 32 | setEnabled(false); |
30 | 33 | setHelpId(ht("/Action/Redo")); |
31 | 34 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/ReorderImageryLayersAction.java b/src/org/openstreetmap/josm/actions/ReorderImageryLayersAction.java
index 0013696be..efbd21fa9 100644
a
|
b
|
|
8 | 8 | import java.util.stream.Collectors; |
9 | 9 | import java.util.stream.Stream; |
10 | 10 | |
| 11 | import org.openstreetmap.josm.gui.MainApplication; |
11 | 12 | import org.openstreetmap.josm.gui.layer.ImageryLayer; |
12 | 13 | import org.openstreetmap.josm.tools.KeyboardUtils; |
13 | 14 | import org.openstreetmap.josm.tools.Shortcut; |
… |
… |
|
22 | 23 | * Constructs a new {@code ReorderImageryLayersAction}. |
23 | 24 | */ |
24 | 25 | public ReorderImageryLayersAction() { |
25 | | super(tr("Reorder imagery layers"), "dialogs/reorderlayers", tr("Reorders non-overlay imagery layers."), |
26 | | Shortcut.registerMultiShortcuts("imagery:reorder", tr("Reorder imagery layers"), |
27 | | KeyboardUtils.getCharactersForKey('E', 0), Shortcut.DIRECT)); |
| 26 | setName(tr("Reorder imagery layers")); |
| 27 | setIcon("dialogs/reorderlayers"); |
| 28 | setTooltip(tr("Reorders non-overlay imagery layers.")); |
| 29 | registerInToolbar("dialogs/reorderlayers"); |
| 30 | List<Shortcut> shortcuts = Shortcut.registerMultiShortcuts("imagery:reorder", tr("Reorder imagery layers"), |
| 31 | KeyboardUtils.getCharactersForKey('E', 0), Shortcut.DIRECT); |
| 32 | setShortcut(shortcuts.get(0)); |
| 33 | for (int i = 1; i < shortcuts.size(); i++) { |
| 34 | MainApplication.registerActionShortcut(this, shortcuts.get(i)); |
| 35 | } |
28 | 36 | } |
29 | 37 | |
30 | 38 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/ReportBugAction.java b/src/org/openstreetmap/josm/actions/ReportBugAction.java
index 336fb37ce..e5105880c 100644
a
|
b
|
public ReportBugAction() {
|
29 | 29 | * @param text The text to send |
30 | 30 | */ |
31 | 31 | public ReportBugAction(String text) { |
32 | | super(tr("Report bug"), "bug", tr("Report a ticket to JOSM bugtracker"), |
33 | | Shortcut.registerShortcut("reportbug", tr("Report a ticket to JOSM bugtracker"), |
34 | | KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), true, false); |
| 32 | super(false); |
| 33 | setName(tr("Report bug")); |
| 34 | setIcon("bug"); |
| 35 | setShortcut(Shortcut.registerShortcut("reportbug", tr("Report a ticket to JOSM bugtracker"), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE)); |
| 36 | setTooltip(tr("Report a ticket to JOSM bugtracker")); |
| 37 | registerInToolbar("bug"); |
35 | 38 | this.text = text; |
36 | 39 | } |
37 | 40 | |
-
diff --git a/src/org/openstreetmap/josm/actions/RestartAction.java b/src/org/openstreetmap/josm/actions/RestartAction.java
index 7d35582bd..830d7b071 100644
a
|
b
|
|
47 | 47 | * Constructs a new {@code RestartAction}. |
48 | 48 | */ |
49 | 49 | public RestartAction() { |
50 | | super(tr("Restart"), "restart", tr("Restart the application."), |
51 | | Shortcut.registerShortcut("file:restart", tr("File: {0}", tr("Restart")), KeyEvent.VK_J, Shortcut.ALT_CTRL_SHIFT), false, false); |
| 50 | super(false); |
| 51 | setName(tr("Restart")); |
| 52 | setIcon("restart"); |
| 53 | setShortcut(Shortcut.registerShortcut("file:restart", tr("File: {0}", tr("Restart")), KeyEvent.VK_J, Shortcut.ALT_CTRL_SHIFT)); |
| 54 | setTooltip(tr("Restart the application.")); |
| 55 | setToolbarId("restart"); |
52 | 56 | setHelpId(ht("/Action/Restart")); |
53 | | setToolbarId("action/restart"); |
54 | | if (MainApplication.getToolbar() != null) { |
55 | | MainApplication.getToolbar().register(this); |
56 | | } |
| 57 | registerInToolbar("action/restart"); |
57 | 58 | setEnabled(isRestartSupported()); |
58 | 59 | } |
59 | 60 | |
-
diff --git a/src/org/openstreetmap/josm/actions/ReverseWayAction.java b/src/org/openstreetmap/josm/actions/ReverseWayAction.java
index 75d714c4e..f17b275c3 100644
a
|
b
|
public Command getReverseCommand() {
|
104 | 104 | * Creates a new {@link ReverseWayAction} and binds the shortcut |
105 | 105 | */ |
106 | 106 | public ReverseWayAction() { |
107 | | super(tr("Reverse Ways"), "wayflip", tr("Reverse the direction of all selected ways."), |
108 | | Shortcut.registerShortcut("tools:reverse", tr("Tool: {0}", tr("Reverse Ways")), KeyEvent.VK_R, Shortcut.DIRECT), true); |
| 107 | setName(tr("Reverse Ways")); |
| 108 | setIcon("wayflip"); |
| 109 | setShortcut(Shortcut.registerShortcut("tools:reverse", tr("Tool: {0}", tr("Reverse Ways")), KeyEvent.VK_R, Shortcut.DIRECT)); |
| 110 | setTooltip(tr("Reverse the direction of all selected ways.")); |
| 111 | registerInToolbar("wayflip"); |
109 | 112 | setHelpId(ht("/Action/ReverseWays")); |
110 | 113 | } |
111 | 114 | |
-
diff --git a/src/org/openstreetmap/josm/actions/SaveAction.java b/src/org/openstreetmap/josm/actions/SaveAction.java
index 1eb7293df..a6b5b9af7 100644
a
|
b
|
|
48 | 48 | * Construct the action with "Save" as label. |
49 | 49 | */ |
50 | 50 | private SaveAction() { |
51 | | super(tr("Save"), "save", tr("Save the current data."), |
52 | | Shortcut.registerShortcut("system:save", tr("File: {0}", tr("Save")), KeyEvent.VK_S, Shortcut.CTRL), |
53 | | true); |
| 51 | super(true); |
| 52 | setName(tr("Save")); |
| 53 | setIcon("save"); |
| 54 | setShortcut(Shortcut.registerShortcut("system:save", tr("File: {0}", tr("Save")), KeyEvent.VK_S, Shortcut.CTRL)); |
| 55 | setTooltip(tr("Save the current data.")); |
| 56 | registerInToolbar("save"); |
54 | 57 | setHelpId(ht("/Action/Save")); |
55 | 58 | } |
56 | 59 | |
-
diff --git a/src/org/openstreetmap/josm/actions/SaveActionBase.java b/src/org/openstreetmap/josm/actions/SaveActionBase.java
index a7df83856..1805b6388 100644
a
|
b
|
|
42 | 42 | * @param iconName The filename of the icon to use |
43 | 43 | * @param tooltip A longer description of the action that will be displayed in the tooltip |
44 | 44 | * @param shortcut A ready-created shortcut object or {@code null} if you don't want a shortcut |
| 45 | * @deprecated use {@link #SaveActionBase(boolean)} and setters |
45 | 46 | */ |
| 47 | @Deprecated |
46 | 48 | public SaveActionBase(String name, String iconName, String tooltip, Shortcut shortcut) { |
47 | 49 | super(name, iconName, tooltip, shortcut); |
48 | 50 | } |
… |
… |
public SaveActionBase(String name, String iconName, String tooltip, Shortcut sho
|
55 | 57 | * @param shortcut A ready-created shortcut object or {@code null} if you don't want a shortcut |
56 | 58 | * @param quiet whether the quiet exporter is called |
57 | 59 | * @since 15496 |
| 60 | * @deprecated use {@link #SaveActionBase(boolean)} and setters |
58 | 61 | */ |
| 62 | @Deprecated |
59 | 63 | public SaveActionBase(String name, String iconName, String tooltip, Shortcut shortcut, boolean quiet) { |
60 | 64 | super(name, iconName, tooltip, shortcut); |
61 | 65 | this.quiet = quiet; |
62 | 66 | } |
63 | 67 | |
| 68 | /** |
| 69 | * Constructs a new {@code SaveActionBase}. |
| 70 | * @param quiet whether the quiet exporter is called |
| 71 | */ |
| 72 | public SaveActionBase(boolean quiet) { |
| 73 | super(true); |
| 74 | this.quiet = quiet; |
| 75 | } |
| 76 | |
64 | 77 | @Override |
65 | 78 | public void actionPerformed(ActionEvent e) { |
66 | 79 | if (!isEnabled()) |
-
diff --git a/src/org/openstreetmap/josm/actions/SaveAsAction.java b/src/org/openstreetmap/josm/actions/SaveAsAction.java
index 1615711af..676f07045 100644
a
|
b
|
|
22 | 22 | * Construct the action with "Save" as label. |
23 | 23 | */ |
24 | 24 | public SaveAsAction() { |
25 | | super(tr("Save As..."), "save_as", tr("Save the current data to a new file."), |
26 | | Shortcut.registerShortcut("system:saveas", tr("File: {0}", tr("Save As...")), |
27 | | KeyEvent.VK_S, Shortcut.CTRL_SHIFT), false); |
| 25 | super(false); |
| 26 | setName(tr("Save As...")); |
| 27 | setIcon("save_as"); |
| 28 | setShortcut(Shortcut.registerShortcut("system:saveas", tr("File: {0}", tr("Save As...")), KeyEvent.VK_S, Shortcut.CTRL_SHIFT)); |
| 29 | setTooltip(tr("Save the current data to a new file.")); |
| 30 | registerInToolbar("save_as"); |
28 | 31 | setHelpId(ht("/Action/SaveAs")); |
29 | 32 | } |
30 | 33 | |
-
diff --git a/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java b/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
index cdde8b15a..41ec9b00c 100644
a
|
b
|
|
34 | 34 | |
35 | 35 | /** Constructs a new note search action */ |
36 | 36 | public SearchNotesDownloadAction() { |
37 | | super(tr("Search Notes..."), "note_search", tr("Download notes from the note search API"), null, false, false); |
| 37 | super(false); |
| 38 | setName(tr("Search Notes...")); |
| 39 | setIcon("note_search"); |
| 40 | setTooltip(tr("Download notes from the note search API")); |
| 41 | setToolbarId("note_search"); |
38 | 42 | } |
39 | 43 | |
40 | 44 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/SelectAllAction.java b/src/org/openstreetmap/josm/actions/SelectAllAction.java
index b13f057a6..27ed48705 100644
a
|
b
|
|
19 | 19 | * Constructs a new {@code SelectAllAction}. |
20 | 20 | */ |
21 | 21 | public SelectAllAction() { |
22 | | super(tr("Select All"), "selectall", tr("Select all undeleted objects in the data layer. This selects incomplete objects too."), |
23 | | Shortcut.registerShortcut("system:selectall", tr("Edit: {0}", tr("Select All")), KeyEvent.VK_A, Shortcut.CTRL), true); |
| 22 | setName(tr("Select All")); |
| 23 | setIcon("selectall"); |
| 24 | setShortcut(Shortcut.registerShortcut("system:selectall", tr("Edit: {0}", tr("Select All")), KeyEvent.VK_A, Shortcut.CTRL)); |
| 25 | setTooltip(tr("Select all undeleted objects in the data layer. This selects incomplete objects too.")); |
| 26 | registerInToolbar("selectall"); |
24 | 27 | setHelpId(ht("/Action/SelectAll")); |
25 | 28 | } |
26 | 29 | |
-
diff --git a/src/org/openstreetmap/josm/actions/SelectNonBranchingWaySequencesAction.java b/src/org/openstreetmap/josm/actions/SelectNonBranchingWaySequencesAction.java
index c6116a6f2..89b1448ee 100644
a
|
b
|
|
20 | 20 | * Creates a new {@link SelectNonBranchingWaySequencesAction} |
21 | 21 | */ |
22 | 22 | public SelectNonBranchingWaySequencesAction() { |
23 | | super(tr("Non-branching way sequences"), |
24 | | "way-select", |
25 | | tr("Select non-branching sequences of ways"), |
26 | | Shortcut.registerShortcut("wayselector:wayselect", tr("Non-branching way sequences"), KeyEvent.VK_W, Shortcut.SHIFT), |
27 | | true); |
| 23 | setName(tr("Non-branching way sequences")); |
| 24 | setIcon("way-select"); |
| 25 | setShortcut(Shortcut.registerShortcut("wayselector:wayselect", tr("Non-branching way sequences"), KeyEvent.VK_W, Shortcut.SHIFT)); |
| 26 | setTooltip(tr("Select non-branching sequences of ways")); |
| 27 | registerInToolbar("way-select"); |
28 | 28 | } |
29 | 29 | |
30 | 30 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/SessionLoadAction.java b/src/org/openstreetmap/josm/actions/SessionLoadAction.java
index 491d3764c..58ee5911b 100644
a
|
b
|
|
49 | 49 | * Constructs a new {@code SessionLoadAction}. |
50 | 50 | */ |
51 | 51 | public SessionLoadAction() { |
52 | | super(tr("Load Session"), "open", tr("Load a session from file."), null, true, "load-session", true); |
| 52 | super(true); |
| 53 | setName(tr("Load Session")); |
| 54 | setIcon("open"); |
| 55 | setTooltip(tr("Load a session from file.")); |
| 56 | registerInToolbar("load-session"); |
53 | 57 | setHelpId(ht("/Action/SessionLoad")); |
54 | 58 | } |
55 | 59 | |
-
diff --git a/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java b/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
index a34a5aee2..f279284f7 100644
a
|
b
|
public SessionSaveAsAction() {
|
72 | 72 | * @param installAdapters False, if you don't want to install layer changed and selection changed adapters |
73 | 73 | */ |
74 | 74 | protected SessionSaveAsAction(boolean toolbar, boolean installAdapters) { |
75 | | super(tr("Save Session As..."), "session", tr("Save the current session to a new file."), |
76 | | null, toolbar, "save_as-session", installAdapters); |
| 75 | super(installAdapters); |
| 76 | setName(tr("Save Session As...")); |
| 77 | setIcon("session"); |
| 78 | if (toolbar) { |
| 79 | registerInToolbar("save_as-session"); |
| 80 | } |
| 81 | setTooltip(tr("Save the current session to a new file.")); |
77 | 82 | setHelpId(ht("/Action/SessionSaveAs")); |
78 | 83 | MainApplication.addMapFrameListener(this); |
79 | 84 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java b/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
index 4ae68d504..7c29bd4d4 100644
a
|
b
|
|
61 | 61 | * Constructs a new {@code ShowStatusReportAction} |
62 | 62 | */ |
63 | 63 | public ShowStatusReportAction() { |
64 | | super( |
65 | | tr("Show Status Report"), |
66 | | "clock", |
67 | | tr("Show status report with useful information that can be attached to bugs"), |
68 | | Shortcut.registerShortcut("help:showstatusreport", tr("Help: {0}", |
69 | | tr("Show Status Report")), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), true, "help/showstatusreport", false); |
70 | | |
| 64 | super(false); |
| 65 | setName(tr("Show Status Report")); |
| 66 | setIcon("clock"); |
| 67 | setShortcut(Shortcut.registerShortcut("help:showstatusreport", tr("Help: {0}", |
| 68 | tr("Show Status Report")), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE)); |
| 69 | setTooltip(tr("Show status report with useful information that can be attached to bugs")); |
| 70 | registerInToolbar("help/showstatusreport"); |
71 | 71 | setHelpId(ht("/Action/ShowStatusReport")); |
72 | 72 | } |
73 | 73 | |
-
diff --git a/src/org/openstreetmap/josm/actions/SimplifyWayAction.java b/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
index ebf0eb28b..70fa84b30 100644
a
|
b
|
|
61 | 61 | * Constructs a new {@code SimplifyWayAction}. |
62 | 62 | */ |
63 | 63 | public SimplifyWayAction() { |
64 | | super(tr("Simplify Way"), "simplify", tr("Delete unnecessary nodes from a way."), |
65 | | Shortcut.registerShortcut("tools:simplify", tr("Tool: {0}", tr("Simplify Way")), KeyEvent.VK_Y, Shortcut.SHIFT), true); |
| 64 | setName(tr("Simplify Way")); |
| 65 | setIcon("simplify"); |
| 66 | setShortcut(Shortcut.registerShortcut("tools:simplify", tr("Tool: {0}", tr("Simplify Way")), KeyEvent.VK_Y, Shortcut.SHIFT)); |
| 67 | setTooltip(tr("Delete unnecessary nodes from a way.")); |
| 68 | registerInToolbar("simplify"); |
66 | 69 | setHelpId(ht("/Action/SimplifyWay")); |
67 | 70 | } |
68 | 71 | |
-
diff --git a/src/org/openstreetmap/josm/actions/SplitWayAction.java b/src/org/openstreetmap/josm/actions/SplitWayAction.java
index ee698e56e..b313cfb47 100644
a
|
b
|
|
54 | 54 | * Create a new SplitWayAction. |
55 | 55 | */ |
56 | 56 | public SplitWayAction() { |
57 | | super(tr("Split Way"), "splitway", tr("Split a way at the selected node."), |
58 | | Shortcut.registerShortcut("tools:splitway", tr("Tool: {0}", tr("Split Way")), KeyEvent.VK_P, Shortcut.DIRECT), true); |
| 57 | setName(tr("Split Way")); |
| 58 | setIcon("splitway"); |
| 59 | setShortcut(Shortcut.registerShortcut("tools:splitway", tr("Tool: {0}", tr("Split Way")), KeyEvent.VK_P, Shortcut.DIRECT)); |
| 60 | setTooltip(tr("Split a way at the selected node.")); |
| 61 | registerInToolbar("splitway"); |
59 | 62 | setHelpId(ht("/Action/SplitWay")); |
60 | 63 | } |
61 | 64 | |
-
diff --git a/src/org/openstreetmap/josm/actions/TaggingPresetSearchAction.java b/src/org/openstreetmap/josm/actions/TaggingPresetSearchAction.java
index 0f7ea1d7c..a4bc51a8c 100644
a
|
b
|
|
6 | 6 | import java.awt.event.ActionEvent; |
7 | 7 | import java.awt.event.KeyEvent; |
8 | 8 | |
9 | | import org.openstreetmap.josm.gui.MainApplication; |
10 | 9 | import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSearchDialog; |
11 | 10 | import org.openstreetmap.josm.tools.Shortcut; |
12 | 11 | |
… |
… |
|
21 | 20 | * Constructs a new {@code TaggingPresetSearchAction}. |
22 | 21 | */ |
23 | 22 | public TaggingPresetSearchAction() { |
24 | | super(tr("Search preset..."), "dialogs/search", tr("Show preset search dialog"), |
25 | | Shortcut.registerShortcut("preset:search", tr("Search presets"), KeyEvent.VK_F3, Shortcut.DIRECT), false); |
26 | | setToolbarId("presets/search"); |
27 | | MainApplication.getToolbar().register(this); |
| 23 | setName(tr("Search preset...")); |
| 24 | setIcon("dialogs/search"); |
| 25 | setShortcut(Shortcut.registerShortcut("preset:search", tr("Search presets"), KeyEvent.VK_F3, Shortcut.DIRECT)); |
| 26 | setTooltip(tr("Show preset search dialog")); |
| 27 | setToolbarId("dialogs/search"); |
| 28 | registerInToolbar("presets/search"); |
28 | 29 | } |
29 | 30 | |
30 | 31 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/ToggleAction.java b/src/org/openstreetmap/josm/actions/ToggleAction.java
index 9c64775dd..d5065e7ab 100644
a
|
b
|
|
24 | 24 | |
25 | 25 | private final transient Set<ButtonModel> buttonModels = new HashSet<>(); |
26 | 26 | |
| 27 | /** |
| 28 | * Constructs a {@code ToggleAction}. |
| 29 | * |
| 30 | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
| 31 | */ |
| 32 | public ToggleAction(boolean installAdapters) { |
| 33 | super(installAdapters); |
| 34 | // It is required to set the SELECTED_KEY to a non-null value in order to let Swing components update it |
| 35 | setSelected(false); |
| 36 | } |
| 37 | |
27 | 38 | /** |
28 | 39 | * Constructs a {@code ToggleAction}. |
29 | 40 | * |
… |
… |
|
38 | 49 | * @param registerInToolbar register this action for the toolbar preferences? |
39 | 50 | * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null |
40 | 51 | * @param installAdapters false, if you don't want to install layer changed and selection changed adapters |
| 52 | * @deprecated use {@link JosmAction#JosmAction(boolean)} and setters |
41 | 53 | */ |
| 54 | @Deprecated |
42 | 55 | public ToggleAction(String name, ImageProvider icon, String tooltip, Shortcut shortcut, boolean registerInToolbar, |
43 | 56 | String toolbarId, boolean installAdapters) { |
44 | 57 | super(name, icon, tooltip, shortcut, registerInToolbar, toolbarId, installAdapters); |
… |
… |
public ToggleAction(String name, ImageProvider icon, String tooltip, Shortcut sh
|
58 | 71 | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
59 | 72 | * the user CANNOT configure a shortcut for your action. |
60 | 73 | * @param registerInToolbar register this action for the toolbar preferences? |
| 74 | * @deprecated use setters |
61 | 75 | */ |
| 76 | @Deprecated |
62 | 77 | public ToggleAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) { |
63 | 78 | super(name, iconName, tooltip, shortcut, registerInToolbar); |
64 | 79 | // It is required to set the SELECTED_KEY to a non-null value in order to let Swing components update it |
-
diff --git a/src/org/openstreetmap/josm/actions/UnGlueAction.java b/src/org/openstreetmap/josm/actions/UnGlueAction.java
index 2aef02a45..6ef6bf06a 100644
a
|
b
|
|
59 | 59 | * Create a new UnGlueAction. |
60 | 60 | */ |
61 | 61 | public UnGlueAction() { |
62 | | super(tr("UnGlue Ways"), "unglueways", tr("Duplicate nodes that are used by multiple ways."), |
63 | | Shortcut.registerShortcut("tools:unglue", tr("Tool: {0}", tr("UnGlue Ways")), KeyEvent.VK_G, Shortcut.DIRECT), true); |
| 62 | setName(tr("UnGlue Ways")); |
| 63 | setIcon("unglueways"); |
| 64 | setShortcut(Shortcut.registerShortcut("tools:unglue", tr("Tool: {0}", tr("UnGlue Ways")), KeyEvent.VK_G, Shortcut.DIRECT)); |
| 65 | setTooltip(tr("Duplicate nodes that are used by multiple ways.")); |
| 66 | registerInToolbar("unglueways"); |
64 | 67 | setHelpId(ht("/Action/UnGlue")); |
65 | 68 | } |
66 | 69 | |
-
diff --git a/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java b/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
index 073b09e1f..4a284b53b 100644
a
|
b
|
|
35 | 35 | * Constructs a new {@code UnJoinNodeWayAction}. |
36 | 36 | */ |
37 | 37 | public UnJoinNodeWayAction() { |
38 | | super(tr("Disconnect Node from Way"), "unjoinnodeway", |
39 | | tr("Disconnect nodes from a way they currently belong to"), |
40 | | Shortcut.registerShortcut("tools:unjoinnodeway", |
41 | | tr("Tool: {0}", tr("Disconnect Node from Way")), KeyEvent.VK_J, Shortcut.ALT), true); |
| 38 | setName(tr("Disconnect Node from Way")); |
| 39 | setIcon("unjoinnodeway"); |
| 40 | setShortcut(Shortcut.registerShortcut("tools:unjoinnodeway", tr("Tool: {0}", tr("Disconnect Node from Way")), |
| 41 | KeyEvent.VK_J, Shortcut.ALT)); |
| 42 | setTooltip(tr("Disconnect nodes from a way they currently belong to")); |
| 43 | registerInToolbar("unjoinnodeway"); |
42 | 44 | setHelpId(ht("/Action/UnJoinNodeWay")); |
43 | 45 | } |
44 | 46 | |
-
diff --git a/src/org/openstreetmap/josm/actions/UndoAction.java b/src/org/openstreetmap/josm/actions/UndoAction.java
index 751d16e28..6ce1c3169 100644
a
|
b
|
|
24 | 24 | * Construct the action with "Undo" as label. |
25 | 25 | */ |
26 | 26 | public UndoAction() { |
27 | | super(tr("Undo"), "undo", tr("Undo the last action."), |
28 | | Shortcut.registerShortcut("system:undo", tr("Edit: {0}", tr("Undo")), KeyEvent.VK_Z, Shortcut.CTRL), true); |
| 27 | setName(tr("Undo")); |
| 28 | setIcon("undo"); |
| 29 | setShortcut(Shortcut.registerShortcut("system:undo", tr("Edit: {0}", tr("Undo")), KeyEvent.VK_Z, Shortcut.CTRL)); |
| 30 | setTooltip(tr("Undo the last action.")); |
| 31 | registerInToolbar("undo"); |
29 | 32 | setEnabled(false); |
30 | 33 | setHelpId(ht("/Action/Undo")); |
31 | 34 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/UnselectAllAction.java b/src/org/openstreetmap/josm/actions/UnselectAllAction.java
index 8f8d37357..06015f9d3 100644
a
|
b
|
|
18 | 18 | * Constructs a new {@code UnselectAllAction}. |
19 | 19 | */ |
20 | 20 | public UnselectAllAction() { |
21 | | super(tr("Unselect All"), "unselectall", tr("Unselect all objects."), |
22 | | Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}", |
23 | | tr("Unselect All")), KeyEvent.VK_ESCAPE, Shortcut.DIRECT), true); |
24 | | |
| 21 | setName(tr("Unselect All")); |
| 22 | setIcon("unselectall"); |
| 23 | setShortcut(Shortcut.registerShortcut("edit:unselectall", tr("Edit: {0}", tr("Unselect All")), KeyEvent.VK_ESCAPE, Shortcut.DIRECT)); |
| 24 | setTooltip(tr("Unselect all objects.")); |
| 25 | registerInToolbar("unselectall"); |
25 | 26 | setHelpId(ht("/Action/UnselectAll")); |
26 | 27 | } |
27 | 28 | |
-
diff --git a/src/org/openstreetmap/josm/actions/UpdateDataAction.java b/src/org/openstreetmap/josm/actions/UpdateDataAction.java
index d4a37f99a..f77c0d7ad 100644
a
|
b
|
|
31 | 31 | * Constructs a new {@code UpdateDataAction}. |
32 | 32 | */ |
33 | 33 | public UpdateDataAction() { |
34 | | super(tr("Update data"), |
35 | | "updatedata", |
36 | | tr("Updates the objects in the active data layer from the server."), |
37 | | Shortcut.registerShortcut("file:updatedata", |
38 | | tr("File: {0}", tr("Update data")), |
39 | | KeyEvent.VK_U, Shortcut.CTRL), |
40 | | true); |
| 34 | setName(tr("Update data")); |
| 35 | setIcon("updatedata"); |
| 36 | setShortcut(Shortcut.registerShortcut("file:updatedata", tr("File: {0}", tr("Update data")), KeyEvent.VK_U, Shortcut.CTRL)); |
| 37 | setTooltip(tr("Updates the objects in the active data layer from the server.")); |
| 38 | registerInToolbar("updatedata"); |
41 | 39 | setHelpId(ht("/Action/UpdateData")); |
42 | 40 | } |
43 | 41 | |
-
diff --git a/src/org/openstreetmap/josm/actions/UpdateModifiedAction.java b/src/org/openstreetmap/josm/actions/UpdateModifiedAction.java
index 59b257612..b8640670c 100644
a
|
b
|
|
25 | 25 | * Constructs a new {@code UpdateModifiedAction}. |
26 | 26 | */ |
27 | 27 | public UpdateModifiedAction() { |
28 | | super(tr("Update modified"), "updatedata", |
29 | | tr("Updates the currently modified objects from the server (re-downloads data)"), |
30 | | Shortcut.registerShortcut("file:updatemodified", |
31 | | tr("File: {0}", tr("Update modified")), KeyEvent.VK_M, |
32 | | Shortcut.ALT_CTRL), |
33 | | true, "updatemodified"); |
| 28 | super(false); |
| 29 | setName(tr("Update modified")); |
| 30 | setIcon("updatedata"); |
| 31 | setShortcut(Shortcut.registerShortcut("file:updatemodified", |
| 32 | tr("File: {0}", tr("Update modified")), KeyEvent.VK_M, Shortcut.ALT_CTRL)); |
| 33 | setTooltip(tr("Updates the currently modified objects from the server (re-downloads data)")); |
| 34 | registerInToolbar("updatemodified"); |
34 | 35 | setHelpId(ht("/Action/UpdateModified")); |
35 | 36 | } |
36 | 37 | |
-
diff --git a/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java b/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
index a692dcf2f..11694e982 100644
a
|
b
|
public static void updatePrimitive(PrimitiveId id) {
|
85 | 85 | * Constructs a new {@code UpdateSelectionAction}. |
86 | 86 | */ |
87 | 87 | public UpdateSelectionAction() { |
88 | | super(tr("Update selection"), "updatedata", |
89 | | tr("Updates the currently selected objects from the server (re-downloads data)"), |
90 | | Shortcut.registerShortcut("file:updateselection", |
91 | | tr("File: {0}", tr("Update selection")), KeyEvent.VK_U, |
92 | | Shortcut.ALT_CTRL), |
93 | | true, "updateselection", true); |
| 88 | setName(tr("Update selection")); |
| 89 | setIcon("updatedata"); |
| 90 | setShortcut(Shortcut.registerShortcut("file:updateselection", |
| 91 | tr("File: {0}", tr("Update selection")), KeyEvent.VK_U, Shortcut.ALT_CTRL)); |
| 92 | setTooltip(tr("Updates the currently selected objects from the server (re-downloads data)")); |
| 93 | registerInToolbar("updateselection"); |
94 | 94 | setHelpId(ht("/Action/UpdateSelection")); |
95 | 95 | } |
96 | 96 | |
97 | | /** |
98 | | * Constructs a new {@code UpdateSelectionAction}. |
99 | | * |
100 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
101 | | * @param iconName the filename of the icon to use |
102 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. Please note |
103 | | * that html is not supported for menu actions on some platforms. |
104 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut. But you always |
105 | | * do want a shortcut, remember you can always register it with group=none, so you |
106 | | * won't be assigned a shortcut unless the user configures one. If you pass null here, |
107 | | * the user CANNOT configure a shortcut for your action. |
108 | | * @param register register this action for the toolbar preferences? |
109 | | * @param toolbarId identifier for the toolbar preferences. The iconName is used, if this parameter is null |
110 | | */ |
111 | | public UpdateSelectionAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, String toolbarId) { |
112 | | super(name, iconName, tooltip, shortcut, register, toolbarId, true); |
| 97 | protected UpdateSelectionAction(boolean installAdapters) { |
| 98 | super(installAdapters); |
113 | 99 | } |
114 | 100 | |
115 | 101 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/UploadAction.java b/src/org/openstreetmap/josm/actions/UploadAction.java
index 406d40572..beae81a7c 100644
a
|
b
|
public static void unregisterUploadHook(UploadHook hook) {
|
140 | 140 | * Constructs a new {@code UploadAction}. |
141 | 141 | */ |
142 | 142 | public UploadAction() { |
143 | | super(tr("Upload data..."), "upload", tr("Upload all changes in the active data layer to the OSM server"), |
144 | | Shortcut.registerShortcut("file:upload", tr("File: {0}", tr("Upload data")), KeyEvent.VK_UP, Shortcut.CTRL_SHIFT), true); |
| 143 | setName(tr("Upload data...")); |
| 144 | setIcon("upload"); |
| 145 | setShortcut(Shortcut.registerShortcut("file:upload", tr("File: {0}", tr("Upload data")), KeyEvent.VK_UP, Shortcut.CTRL_SHIFT)); |
| 146 | setTooltip(tr("Upload all changes in the active data layer to the OSM server")); |
| 147 | registerInToolbar("upload"); |
145 | 148 | setHelpId(ht("/Action/Upload")); |
146 | 149 | } |
147 | 150 | |
-
diff --git a/src/org/openstreetmap/josm/actions/UploadSelectionAction.java b/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
index f93942a6c..eab0594c6 100644
a
|
b
|
|
44 | 44 | * Constructs a new {@code UploadSelectionAction}. |
45 | 45 | */ |
46 | 46 | public UploadSelectionAction() { |
47 | | super( |
48 | | tr("Upload selection..."), |
49 | | "uploadselection", |
50 | | tr("Upload all changes in the current selection to the OSM server."), |
51 | | // CHECKSTYLE.OFF: LineLength |
52 | | Shortcut.registerShortcut("file:uploadSelection", tr("File: {0}", tr("Upload selection")), KeyEvent.VK_U, Shortcut.ALT_CTRL_SHIFT), |
53 | | // CHECKSTYLE.ON: LineLength |
54 | | true); |
| 47 | setName(tr("Upload selection...")); |
| 48 | setIcon("uploadselection"); |
| 49 | setShortcut(Shortcut.registerShortcut("file:uploadSelection", tr("File: {0}", tr("Upload selection")), |
| 50 | KeyEvent.VK_U, Shortcut.ALT_CTRL_SHIFT)); |
| 51 | setTooltip(tr("Upload all changes in the current selection to the OSM server.")); |
| 52 | registerInToolbar("uploadselection"); |
55 | 53 | setHelpId(ht("/Action/UploadSelection")); |
56 | 54 | } |
57 | 55 | |
-
diff --git a/src/org/openstreetmap/josm/actions/ValidateAction.java b/src/org/openstreetmap/josm/actions/ValidateAction.java
index c2e1f4337..833fc2fc1 100644
a
|
b
|
|
43 | 43 | * Constructor |
44 | 44 | */ |
45 | 45 | public ValidateAction() { |
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); |
| 46 | setName(tr("Validation")); |
| 47 | setIcon("dialogs/validator"); |
| 48 | setShortcut(Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), KeyEvent.VK_V, Shortcut.SHIFT)); |
| 49 | setTooltip(tr("Performs the data validation")); |
| 50 | registerInToolbar("dialogs/validator"); |
49 | 51 | } |
50 | 52 | |
51 | 53 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java b/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java
index 5d42d6dc1..22fe7deab 100644
a
|
b
|
|
28 | 28 | * Constructs a new {@code ViewportFollowToggleAction}. |
29 | 29 | */ |
30 | 30 | public ViewportFollowToggleAction() { |
31 | | super(tr("Viewport Following"), |
32 | | "viewport-follow", |
33 | | tr("Enable/disable automatic moving of the map view to last placed node"), |
34 | | Shortcut.registerShortcut("menu:view:viewportfollow", tr("Toggle Viewport Following"), |
35 | | KeyEvent.VK_F, Shortcut.CTRL_SHIFT), |
36 | | true /* register shortcut */ |
37 | | ); |
| 31 | super(true); |
| 32 | setName(tr("Viewport Following")); |
| 33 | setIcon("viewport-follow"); |
| 34 | setShortcut(Shortcut.registerShortcut("menu:view:viewportfollow", tr("Toggle Viewport Following"), |
| 35 | KeyEvent.VK_F, Shortcut.CTRL_SHIFT)); |
| 36 | setTooltip(tr("Enable/disable automatic moving of the map view to last placed node")); |
| 37 | registerInToolbar("viewport-follow"); |
38 | 38 | setHelpId(ht("/Action/ViewportFollowing")); |
39 | 39 | setSelected(DrawAction.VIEWPORT_FOLLOWING.get()); |
40 | 40 | notifySelectedState(); |
-
diff --git a/src/org/openstreetmap/josm/actions/WireframeToggleAction.java b/src/org/openstreetmap/josm/actions/WireframeToggleAction.java
index a4a17917e..5b3ab932f 100644
a
|
b
|
|
9 | 9 | import org.openstreetmap.josm.data.osm.visitor.paint.MapRendererFactory; |
10 | 10 | import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; |
11 | 11 | import org.openstreetmap.josm.data.osm.visitor.paint.WireframeMapRenderer; |
12 | | import org.openstreetmap.josm.gui.MainApplication; |
13 | 12 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
14 | 13 | import org.openstreetmap.josm.tools.Shortcut; |
15 | 14 | |
… |
… |
|
23 | 22 | * Constructs a new {@code WireframeToggleAction}. |
24 | 23 | */ |
25 | 24 | public WireframeToggleAction() { |
26 | | super(tr("Wireframe View"), |
27 | | null, /* no icon */ |
28 | | tr("Enable/disable rendering the map as wireframe only"), |
29 | | Shortcut.registerShortcut("menu:view:wireframe", tr("Toggle Wireframe view"), KeyEvent.VK_W, Shortcut.CTRL), |
30 | | false /* register toolbar */ |
31 | | ); |
32 | | setToolbarId("wireframe"); |
33 | | MainApplication.getToolbar().register(this); |
| 25 | super(true); |
| 26 | setName(tr("Wireframe View")); |
| 27 | setShortcut(Shortcut.registerShortcut("menu:view:wireframe", tr("Toggle Wireframe view"), KeyEvent.VK_W, Shortcut.CTRL)); |
| 28 | setTooltip(tr("Enable/disable rendering the map as wireframe only")); |
| 29 | registerInToolbar("wireframe"); |
34 | 30 | setSelected(MapRendererFactory.getInstance().isWireframeMapRendererActive()); |
35 | 31 | notifySelectedState(); |
36 | 32 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/ZoomInAction.java b/src/org/openstreetmap/josm/actions/ZoomInAction.java
index 18a1a70e3..f733683ab 100644
a
|
b
|
|
20 | 20 | * Constructs a new {@code ZoomInAction}. |
21 | 21 | */ |
22 | 22 | public ZoomInAction() { |
23 | | super( |
24 | | tr("Zoom In"), |
25 | | "dialogs/zoomin", |
26 | | tr("Zoom In"), |
27 | | // Although it might be possible on few custom keyboards, the vast majority of layouts do not have a direct '+' key, see below |
28 | | Shortcut.registerShortcut("view:zoomin", tr("View: {0}", tr("Zoom In")), KeyEvent.VK_PLUS, Shortcut.DIRECT), |
29 | | true |
30 | | ); |
| 23 | setName(tr("Zoom In")); |
| 24 | setIcon("dialogs/zoomin"); |
| 25 | // Although it might be possible on few custom keyboards, the vast majority of layouts do not have a direct '+' key, see below |
| 26 | setShortcut(Shortcut.registerShortcut("view:zoomin", tr("View: {0}", tr("Zoom In")), KeyEvent.VK_PLUS, Shortcut.DIRECT)); |
| 27 | setTooltip(tr("Zoom In")); |
| 28 | registerInToolbar("dialogs/zoomin"); |
31 | 29 | setHelpId(ht("/Action/ZoomIn")); |
32 | 30 | // On standard QWERTY, AZERTY and other common layouts the '+' key is obtained with Shift+EQUALS |
33 | 31 | MainApplication.registerActionShortcut(this, |
-
diff --git a/src/org/openstreetmap/josm/actions/ZoomOutAction.java b/src/org/openstreetmap/josm/actions/ZoomOutAction.java
index d4c4ff1b9..9c9e5c1bd 100644
a
|
b
|
|
20 | 20 | * Constructs a new {@code ZoomOutAction}. |
21 | 21 | */ |
22 | 22 | public ZoomOutAction() { |
23 | | super(tr("Zoom Out"), "dialogs/zoomout", tr("Zoom Out"), |
24 | | Shortcut.registerShortcut("view:zoomout", tr("View: {0}", tr("Zoom Out")), KeyEvent.VK_MINUS, Shortcut.DIRECT), true); |
| 23 | setName(tr("Zoom Out")); |
| 24 | setIcon("dialogs/zoomout"); |
| 25 | setShortcut(Shortcut.registerShortcut("view:zoomout", tr("View: {0}", tr("Zoom Out")), KeyEvent.VK_MINUS, Shortcut.DIRECT)); |
| 26 | setTooltip(tr("Zoom Out")); |
| 27 | registerInToolbar("dialogs/zoomout"); |
25 | 28 | setHelpId(ht("/Action/ZoomOut")); |
26 | 29 | // make numpad - behave like - |
27 | 30 | MainApplication.registerActionShortcut(this, |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AbstractAudioAction.java b/src/org/openstreetmap/josm/actions/audio/AbstractAudioAction.java
index 315916618..6b67fb376 100644
a
|
b
|
|
5 | 5 | import org.openstreetmap.josm.gui.MainApplication; |
6 | 6 | import org.openstreetmap.josm.gui.layer.markerlayer.AudioMarker; |
7 | 7 | import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; |
8 | | import org.openstreetmap.josm.tools.Shortcut; |
9 | 8 | |
10 | 9 | /** |
11 | 10 | * Base class for every action related to audio content. |
… |
… |
|
15 | 14 | |
16 | 15 | /** |
17 | 16 | * Constructs a new {@code BaseAudioAction}. |
18 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
19 | | * @param iconName the filename of the icon to use |
20 | | * @param tooltip a longer description of the action that will be displayed in the tooltip |
21 | | * @param shortcut a ready-created shortcut object or null if you don't want a shortcut |
22 | | * @param registerInToolbar register this action for the toolbar preferences? |
23 | 17 | */ |
24 | | public AbstractAudioAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) { |
25 | | super(name, iconName, tooltip, shortcut, registerInToolbar); |
| 18 | public AbstractAudioAction() { |
26 | 19 | updateEnabledState(); |
27 | 20 | } |
28 | 21 | |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java b/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java
index 6d609773a..ad3e6ac54 100644
a
|
b
|
|
25 | 25 | * Constructs a new {@code AudioBackAction}. |
26 | 26 | */ |
27 | 27 | public AudioBackAction() { |
28 | | super(trc("audio", "Back"), "audio-back", trc("audio", "Jump back."), |
29 | | Shortcut.registerShortcut("audio:back", tr("Audio: {0}", trc("audio", "Back")), KeyEvent.VK_F6, Shortcut.DIRECT), true); |
| 28 | setName(trc("audio", "Back")); |
| 29 | setIcon("audio-back"); |
| 30 | setShortcut(Shortcut.registerShortcut("audio:back", tr("Audio: {0}", trc("audio", "Back")), KeyEvent.VK_F6, Shortcut.DIRECT)); |
| 31 | setTooltip(trc("audio", "Jump back.")); |
| 32 | registerInToolbar("audio-back"); |
30 | 33 | setHelpId(ht("/Action/AudioBack")); |
31 | 34 | } |
32 | 35 | |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java b/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java
index ab83c8000..f75ebe222 100644
a
|
b
|
|
7 | 7 | import org.openstreetmap.josm.io.audio.AudioPlayer; |
8 | 8 | import org.openstreetmap.josm.io.audio.AudioUtil; |
9 | 9 | import org.openstreetmap.josm.spi.preferences.Config; |
10 | | import org.openstreetmap.josm.tools.Shortcut; |
11 | 10 | |
12 | 11 | /** |
13 | 12 | * Abstract superclass of {@link AudioFasterAction} and {@link AudioSlowerAction}. |
… |
… |
|
20 | 19 | /** |
21 | 20 | * Constructs a new {@code AudioFastSlowAction}. |
22 | 21 | * |
23 | | * @param name the action's text as displayed on the menu (if it is added to a menu) |
24 | | * @param iconName the filename of the icon to use |
25 | | * @param tooltip a longer description of the action that will be displayed in the tooltip. |
26 | | * @param shortcut a ready-created shortcut object. |
27 | 22 | * @param fast {@code true} to increase speed (faster audio), {@code false} to decrease it (slower audio). |
28 | 23 | */ |
29 | | public AudioFastSlowAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean fast) { |
30 | | super(name, iconName, tooltip, shortcut, true); |
| 24 | public AudioFastSlowAction(boolean fast) { |
31 | 25 | multiplier = Config.getPref().getDouble("audio.fastfwdmultiplier", 1.3); |
32 | 26 | if (!fast) |
33 | 27 | multiplier = 1.0 / multiplier; |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioFasterAction.java b/src/org/openstreetmap/josm/actions/audio/AudioFasterAction.java
index 0eca15e99..125a556aa 100644
a
|
b
|
|
20 | 20 | * Constructs a new {@code AudioFasterAction}. |
21 | 21 | */ |
22 | 22 | public AudioFasterAction() { |
23 | | super(trc("audio", "Faster"), "audio-faster", trc("audio", "Faster Forward"), |
24 | | Shortcut.registerShortcut("audio:faster", tr("Audio: {0}", trc("audio", "Faster")), KeyEvent.VK_F9, Shortcut.DIRECT), true); |
| 23 | super(true); |
| 24 | setName(trc("audio", "Faster")); |
| 25 | setIcon("audio-faster"); |
| 26 | setShortcut(Shortcut.registerShortcut("audio:faster", tr("Audio: {0}", trc("audio", "Faster")), KeyEvent.VK_F9, Shortcut.DIRECT)); |
| 27 | setTooltip(trc("audio", "Faster Forward")); |
25 | 28 | setHelpId(ht("/Action/AudioFaster")); |
26 | 29 | } |
27 | 30 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java b/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java
index 0eed041a5..520f979fc 100644
a
|
b
|
|
24 | 24 | * Constructs a new {@code AudioFwdAction}. |
25 | 25 | */ |
26 | 26 | public AudioFwdAction() { |
27 | | super(trc("audio", "Forward"), "audio-fwd", trc("audio", "Jump forward"), |
28 | | Shortcut.registerShortcut("audio:forward", tr("Audio: {0}", trc("audio", "Forward")), KeyEvent.VK_F7, Shortcut.DIRECT), true); |
| 27 | setName(trc("audio", "Forward")); |
| 28 | setIcon("audio-fwd"); |
| 29 | setShortcut(Shortcut.registerShortcut("audio:forward", tr("Audio: {0}", trc("audio", "Forward")), KeyEvent.VK_F7, Shortcut.DIRECT)); |
| 30 | setTooltip(trc("audio", "Jump forward")); |
| 31 | registerInToolbar("audio-fwd"); |
29 | 32 | } |
30 | 33 | |
31 | 34 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioNextAction.java b/src/org/openstreetmap/josm/actions/audio/AudioNextAction.java
index 5fbc41162..2661b83b8 100644
a
|
b
|
|
21 | 21 | * Constructs a new {@code AudioNextAction}. |
22 | 22 | */ |
23 | 23 | public AudioNextAction() { |
24 | | super(trc("audio", "Next Marker"), "audio-next", trc("audio", "Play next marker."), |
25 | | Shortcut.registerShortcut("audio:next", tr("Audio: {0}", trc("audio", "Next Marker")), KeyEvent.VK_F8, Shortcut.DIRECT), true); |
| 24 | setName(trc("audio", "Next Marker")); |
| 25 | setIcon("audio-next"); |
| 26 | setShortcut(Shortcut.registerShortcut("audio:next", tr("Audio: {0}", trc("audio", "Next Marker")), KeyEvent.VK_F8, Shortcut.DIRECT)); |
| 27 | setTooltip(trc("audio", "Play next marker.")); |
| 28 | registerInToolbar("audio-next"); |
26 | 29 | } |
27 | 30 | |
28 | 31 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java b/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java
index b9ed619cb..1774c2b1c 100644
a
|
b
|
|
28 | 28 | * Constructs a new {@code AudioPlayPauseAction}. |
29 | 29 | */ |
30 | 30 | public AudioPlayPauseAction() { |
31 | | super(trc("audio", "Play/Pause"), "audio-playpause", tr("Play/pause audio."), |
32 | | Shortcut.registerShortcut("audio:pause", tr("Audio: {0}", trc("audio", "Play/Pause")), KeyEvent.VK_PERIOD, Shortcut.DIRECT), true); |
| 31 | setName(trc("audio", "Play/Pause")); |
| 32 | setIcon("audio-playpause"); |
| 33 | setShortcut(Shortcut.registerShortcut("audio:pause", tr("Audio: {0}", trc("audio", "Play/Pause")), |
| 34 | KeyEvent.VK_PERIOD, Shortcut.DIRECT)); |
| 35 | setTooltip(tr("Play/pause audio.")); |
| 36 | registerInToolbar("audio-playpause"); |
33 | 37 | } |
34 | 38 | |
35 | 39 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioPrevAction.java b/src/org/openstreetmap/josm/actions/audio/AudioPrevAction.java
index 9ac8040ec..c4a7a15a8 100644
a
|
b
|
|
21 | 21 | * Constructs a new {@code AudioPrevAction}. |
22 | 22 | */ |
23 | 23 | public AudioPrevAction() { |
24 | | super(trc("audio", "Previous Marker"), "audio-prev", trc("audio", "Play previous marker."), |
25 | | Shortcut.registerShortcut("audio:prev", tr("Audio: {0}", trc("audio", "Previous Marker")), KeyEvent.VK_F5, Shortcut.DIRECT), true); |
| 24 | setName(trc("audio", "Previous Marker")); |
| 25 | setIcon("audio-prev"); |
| 26 | setShortcut(Shortcut.registerShortcut("audio:prev", tr("Audio: {0}", trc("audio", "Previous Marker")), |
| 27 | KeyEvent.VK_F5, Shortcut.DIRECT)); |
| 28 | setTooltip(trc("audio", "Play previous marker.")); |
| 29 | registerInToolbar("audio-prev"); |
26 | 30 | } |
27 | 31 | |
28 | 32 | @Override |
-
diff --git a/src/org/openstreetmap/josm/actions/audio/AudioSlowerAction.java b/src/org/openstreetmap/josm/actions/audio/AudioSlowerAction.java
index 300a944af..738416785 100644
a
|
b
|
|
20 | 20 | * Constructs a new {@code AudioSlowerAction}. |
21 | 21 | */ |
22 | 22 | public AudioSlowerAction() { |
23 | | super(trc("audio", "Slower"), "audio-slower", trc("audio", "Slower Forward"), |
24 | | Shortcut.registerShortcut("audio:slower", tr("Audio: {0}", trc("audio", "Slower")), KeyEvent.VK_F4, Shortcut.DIRECT), false); |
| 23 | super(false); |
| 24 | setName(trc("audio", "Slower")); |
| 25 | setIcon("audio-slower"); |
| 26 | setShortcut(Shortcut.registerShortcut("audio:slower", tr("Audio: {0}", trc("audio", "Slower")), KeyEvent.VK_F4, Shortcut.DIRECT)); |
| 27 | setTooltip(trc("audio", "Slower Forward")); |
25 | 28 | setHelpId(ht("/Action/AudioSlower")); |
26 | 29 | } |
27 | 30 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java b/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
index b436c5f3b..974530a59 100644
a
|
b
|
public void actionPerformed(ActionEvent e) {
|
1396 | 1396 | * Constructs a new {@code SnapChangeAction}. |
1397 | 1397 | */ |
1398 | 1398 | SnapChangeAction() { |
1399 | | super(tr("Angle snapping"), /* ICON() */ "anglesnap", |
1400 | | tr("Switch angle snapping mode while drawing"), null, false); |
| 1399 | setName(tr("Angle snapping")); |
| 1400 | setIcon(/* ICON() */ "anglesnap"); |
| 1401 | setTooltip(tr("Switch angle snapping mode while drawing")); |
| 1402 | setToolbarId("anglesnap"); |
1401 | 1403 | setHelpId(ht("/Action/Draw/AngleSnap")); |
1402 | 1404 | } |
1403 | 1405 | |
-
diff --git a/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java b/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
index 030937e86..261dd10f9 100644
a
|
b
|
public String toString() {
|
195 | 195 | |
196 | 196 | private class DualAlignChangeAction extends JosmAction { |
197 | 197 | DualAlignChangeAction() { |
198 | | super(tr("Dual alignment"), /* ICON() */ "mapmode/extrude/dualalign", |
199 | | tr("Switch dual alignment mode while extruding"), null, false); |
| 198 | setName(tr("Dual alignment")); |
| 199 | setIcon(/* ICON() */ "mapmode/extrude/dualalign"); |
| 200 | setTooltip(tr("Switch dual alignment mode while extruding")); |
| 201 | setToolbarId("mapmode/extrude/dualalign"); |
200 | 202 | setHelpId(ht("/Action/Extrude#DualAlign")); |
201 | 203 | } |
202 | 204 | |
-
diff --git a/src/org/openstreetmap/josm/actions/mapmode/MapMode.java b/src/org/openstreetmap/josm/actions/mapmode/MapMode.java
index ad825161e..23fd31d18 100644
a
|
b
|
|
44 | 44 | * @since 11713 |
45 | 45 | */ |
46 | 46 | public MapMode(String name, String iconName, String tooltip, Shortcut shortcut, Cursor cursor) { |
47 | | super(name, "mapmode/"+iconName, tooltip, shortcut, false); |
| 47 | setName(name); |
| 48 | setIcon("mapmode/" + iconName); |
| 49 | setShortcut(shortcut); |
| 50 | setTooltip(tooltip); |
| 51 | setToolbarId("mapmode/" + iconName); |
48 | 52 | this.cursor = cursor; |
49 | 53 | putValue("active", Boolean.FALSE); |
50 | 54 | } |
… |
… |
public MapMode(String name, String iconName, String tooltip, Shortcut shortcut,
|
58 | 62 | * @since 11713 |
59 | 63 | */ |
60 | 64 | public MapMode(String name, String iconName, String tooltip, Cursor cursor) { |
61 | | putValue(NAME, name); |
| 65 | setName(name); |
| 66 | setTooltip(tooltip); |
62 | 67 | new ImageProvider("mapmode", iconName).getResource().attachImageIcon(this); |
63 | | putValue(SHORT_DESCRIPTION, tooltip); |
64 | 68 | this.cursor = cursor; |
65 | 69 | } |
66 | 70 | |
-
diff --git a/src/org/openstreetmap/josm/actions/relation/ExportRelationToGpxAction.java b/src/org/openstreetmap/josm/actions/relation/ExportRelationToGpxAction.java
index 0831df871..8e9eded2c 100644
a
|
b
|
public ExportRelationToGpxAction() {
|
77 | 77 | * @param mode which mode to use, see {@code ExportRelationToGpxAction.Mode} |
78 | 78 | */ |
79 | 79 | public ExportRelationToGpxAction(Set<Mode> mode) { |
80 | | super(name(mode), mode.contains(TO_FILE) ? "exportgpx" : "dialogs/layerlist", tooltip(mode), |
81 | | null, false, null, false); |
| 80 | super(false); |
| 81 | setName(name(mode)); |
| 82 | setIcon(mode.contains(TO_FILE) ? "exportgpx" : "dialogs/layerlist"); |
| 83 | setTooltip(tooltip(mode)); |
82 | 84 | setHelpId(ht("/Action/ExportRelationToGpx")); |
83 | 85 | this.mode = mode; |
84 | 86 | } |
-
diff --git a/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java b/src/org/openstreetmap/josm/actions/relation/RecentRelationsAction.java
index f9cefcf21..e067bf68b 100644
a
|
b
|
|
45 | 45 | * @param editButton edit button |
46 | 46 | */ |
47 | 47 | public RecentRelationsAction(SideButton editButton) { |
48 | | super(RecentRelationsAction.class.getName(), null, null, null, false, true); |
| 48 | setName(RecentRelationsAction.class.getName()); |
49 | 49 | this.editButton = editButton; |
50 | 50 | arrow = editButton.createArrow(this); |
51 | 51 | arrow.setToolTipText(tr("List of recent relations")); |
-
diff --git a/src/org/openstreetmap/josm/actions/search/SearchAction.java b/src/org/openstreetmap/josm/actions/search/SearchAction.java
index f634ded70..d72b8e1c4 100644
a
|
b
|
public static void saveToHistory(SearchSetting s) {
|
142 | 142 | * Constructs a new {@code SearchAction}. |
143 | 143 | */ |
144 | 144 | public SearchAction() { |
145 | | super(tr("Search..."), "dialogs/search", tr("Search for objects"), |
146 | | Shortcut.registerShortcut("system:find", tr("Search..."), KeyEvent.VK_F, Shortcut.CTRL), true); |
| 145 | setName(tr("Search...")); |
| 146 | setIcon("dialogs/search"); |
| 147 | setShortcut(Shortcut.registerShortcut("system:find", tr("Search..."), KeyEvent.VK_F, Shortcut.CTRL)); |
| 148 | setTooltip(tr("Search for objects")); |
| 149 | registerInToolbar("dialogs/search"); |
147 | 150 | setHelpId(ht("/Action/Search")); |
148 | 151 | } |
149 | 152 | |
-
diff --git a/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java b/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
index cc29b0aab..e67169453 100644
a
|
b
|
private static JButton createHelpButton(String helpTopic) {
|
203 | 203 | private final String helpTopic; |
204 | 204 | |
205 | 205 | HelpAction(String helpTopic) { |
206 | | super(tr("Help"), "help", tr("Show help information"), null, false, false); |
| 206 | super(false); |
| 207 | setName(tr("Help")); |
| 208 | setIcon("help"); |
| 209 | setTooltip(tr("Show help information")); |
| 210 | setToolbarId("help"); |
207 | 211 | this.helpTopic = helpTopic; |
208 | 212 | } |
209 | 213 | |
-
diff --git a/src/org/openstreetmap/josm/gui/ImageryMenu.java b/src/org/openstreetmap/josm/gui/ImageryMenu.java
index a192edafe..e1bc0ad57 100644
a
|
b
|
|
54 | 54 | static final class AdjustImageryOffsetAction extends JosmAction { |
55 | 55 | |
56 | 56 | AdjustImageryOffsetAction() { |
57 | | super(tr("Imagery offset"), "mapmode/adjustimg", tr("Adjust imagery offset"), null, false, false); |
58 | | setToolbarId("imagery-offset"); |
59 | | MainApplication.getToolbar().register(this); |
| 57 | super(false); |
| 58 | setName(tr("Imagery offset")); |
| 59 | setIcon("mapmode/adjustimg"); |
| 60 | setTooltip(tr("Adjust imagery offset")); |
| 61 | setToolbarId("mapmode/adjustimg"); |
| 62 | registerInToolbar("imagery-offset"); |
60 | 63 | } |
61 | 64 | |
62 | 65 | @Override |
-
diff --git a/src/org/openstreetmap/josm/gui/autofilter/AutoFilterButton.java b/src/org/openstreetmap/josm/gui/autofilter/AutoFilterButton.java
index 5c78e16fb..8ec84d5af 100644
a
|
b
|
|
27 | 27 | |
28 | 28 | private final AutoFilter filter; |
29 | 29 | |
| 30 | private static class Action extends JosmAction { |
| 31 | private final AutoFilter filter; |
| 32 | |
| 33 | Action(AutoFilter filter) { |
| 34 | this.filter = filter; |
| 35 | setName(filter.getLabel()); |
| 36 | setTooltip(filter.getDescription()); |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public synchronized void actionPerformed(ActionEvent e) { |
| 41 | AutoFilterManager afm = AutoFilterManager.getInstance(); |
| 42 | if (filter.equals(afm.getCurrentAutoFilter())) { |
| 43 | afm.setCurrentAutoFilter(null); |
| 44 | MainApplication.getMap().filterDialog.getFilterModel().executeFilters(true); |
| 45 | } else { |
| 46 | afm.setCurrentAutoFilter(filter); |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
30 | 51 | /** |
31 | 52 | * Constructs a new {@code AutoFilterButton}. |
32 | 53 | * @param filter auto filter associated to this button |
33 | 54 | */ |
34 | 55 | public AutoFilterButton(final AutoFilter filter) { |
35 | | super(new JosmAction(filter.getLabel(), null, filter.getDescription(), null, false) { |
36 | | @Override |
37 | | public synchronized void actionPerformed(ActionEvent e) { |
38 | | AutoFilterManager afm = AutoFilterManager.getInstance(); |
39 | | if (filter.equals(afm.getCurrentAutoFilter())) { |
40 | | afm.setCurrentAutoFilter(null); |
41 | | MainApplication.getMap().filterDialog.getFilterModel().executeFilters(true); |
42 | | } else { |
43 | | afm.setCurrentAutoFilter(filter); |
44 | | } |
45 | | } |
46 | | }); |
| 56 | super(new Action(filter)); |
47 | 57 | this.filter = filter; |
48 | 58 | setForeground(Color.WHITE); |
49 | 59 | setContentAreaFilled(false); |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/MenuItemSearchDialog.java b/src/org/openstreetmap/josm/gui/dialogs/MenuItemSearchDialog.java
index 02e96d069..6adcca07b 100644
a
|
b
|
public Component getListCellRendererComponent(JList<? extends JMenuItem> list, J
|
131 | 131 | * Constructs a new {@code Action}. |
132 | 132 | */ |
133 | 133 | public Action() { |
134 | | super(tr("Search menu items"), "dialogs/search", null, |
135 | | SHORTCUT, |
136 | | true, "dialogs/search-items", false); |
| 134 | super(false); |
| 135 | setName(tr("Search menu items")); |
| 136 | setIcon("dialogs/search"); |
| 137 | setShortcut(SHORTCUT); |
| 138 | registerInToolbar("dialogs/search-items"); |
137 | 139 | setHelpId(ht("Action/SearchMenuItems")); |
138 | 140 | } |
139 | 141 | |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java b/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
index e2b8636a2..e3ec03cb7 100644
a
|
b
|
protected void registerInWindowMenu(boolean isExpert) {
|
300 | 300 | public final class ToggleDialogAction extends JosmAction { |
301 | 301 | |
302 | 302 | private ToggleDialogAction(String name, String iconName, String tooltip, Shortcut shortcut, String helpId) { |
303 | | super(name, iconName, tooltip, shortcut, false, false); |
| 303 | super(false); |
| 304 | setName(name); |
| 305 | setIcon(iconName); |
| 306 | setShortcut(shortcut); |
| 307 | setTooltip(tooltip); |
304 | 308 | setHelpId(helpId); |
305 | 309 | } |
306 | 310 | |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java b/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
index 00347787f..bd493e2d7 100644
a
|
b
|
public void valueChanged(ListSelectionEvent e) {
|
204 | 204 | |
205 | 205 | ShowUserInfoAction() { |
206 | 206 | super(false); |
207 | | putValue(NAME, tr("Show info")); |
208 | | putValue(SHORT_DESCRIPTION, tr("Launches a browser with information about the user")); |
209 | | new ImageProvider("help/internet").getResource().attachImageIcon(this, true); |
| 207 | setName(tr("Show info")); |
| 208 | setTooltip(tr("Launches a browser with information about the user")); |
| 209 | setIcon("help/internet"); |
210 | 210 | updateEnabledState(); |
211 | 211 | } |
212 | 212 | |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java b/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
index 044698997..63bc88f3d 100644
a
|
b
|
public ValidatorDialog() {
|
123 | 123 | addTreeSelectionListener(new SelectionWatch()); |
124 | 124 | InputMapUtils.unassignCtrlShiftUpDown(tree, JComponent.WHEN_FOCUSED); |
125 | 125 | |
126 | | ignoreForNowAction = new JosmAction(tr("Ignore for now"), "dialogs/delete", |
127 | | tr("Ignore and remove from tree."), Shortcut.registerShortcut("tools:validate:ignore-for-now", |
128 | | tr("Ignore and remove from tree."), KeyEvent.VK_MINUS, Shortcut.SHIFT), |
129 | | false, false) { |
130 | | |
131 | | @Override |
132 | | public void actionPerformed(ActionEvent e) { |
133 | | TestError error = getSelectedError(); |
134 | | if (error != null) { |
135 | | error.setIgnored(true); |
136 | | tree.resetErrors(); |
137 | | invalidateValidatorLayers(); |
138 | | } |
139 | | } |
140 | | }; |
| 126 | ignoreForNowAction = new IgnoreForNowAction(); |
141 | 127 | |
142 | 128 | popupMenuHandler.addAction(MainApplication.getMenu().autoScaleActions.get("problem")); |
143 | 129 | popupMenuHandler.addAction(new EditRelationAction()); |
… |
… |
public void destroy() {
|
730 | 716 | ignoreForNowAction.destroy(); |
731 | 717 | } |
732 | 718 | } |
| 719 | |
| 720 | private class IgnoreForNowAction extends JosmAction { |
| 721 | |
| 722 | IgnoreForNowAction() { |
| 723 | super(false); |
| 724 | setName(tr("Ignore for now")); |
| 725 | setIcon("dialogs/delete"); |
| 726 | setShortcut(Shortcut.registerShortcut("tools:validate:ignore-for-now", tr("Ignore and remove from tree."), |
| 727 | KeyEvent.VK_MINUS, Shortcut.SHIFT)); |
| 728 | setTooltip(tr("Ignore and remove from tree.")); |
| 729 | setToolbarId("dialogs/delete"); |
| 730 | } |
| 731 | |
| 732 | @Override |
| 733 | public void actionPerformed(ActionEvent e) { |
| 734 | TestError error = getSelectedError(); |
| 735 | if (error != null) { |
| 736 | error.setIgnored(true); |
| 737 | tree.resetErrors(); |
| 738 | invalidateValidatorLayers(); |
| 739 | } |
| 740 | } |
| 741 | } |
733 | 742 | } |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerDownAction.java b/src/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerDownAction.java
index 425e9b208..bc6e1d67e 100644
a
|
b
|
|
15 | 15 | import org.openstreetmap.josm.gui.layer.ImageryLayer; |
16 | 16 | import org.openstreetmap.josm.gui.layer.Layer; |
17 | 17 | import org.openstreetmap.josm.gui.layer.MainLayerManager; |
18 | | import org.openstreetmap.josm.tools.ImageProvider; |
19 | 18 | import org.openstreetmap.josm.tools.Shortcut; |
20 | 19 | |
21 | 20 | /** |
… |
… |
|
33 | 32 | * Create a CycleLayerDownAction that cycles through layers that are in the model |
34 | 33 | */ |
35 | 34 | public CycleLayerDownAction() { |
36 | | super(tr("Cycle layer down"), "dialogs/previous", tr("Cycle through data layers in a downward direction"), |
37 | | cycleDown, true, "cycle-layer-down", false); |
38 | | new ImageProvider("dialogs", "previous").getResource().attachImageIcon(this, true); |
39 | | putValue(SHORT_DESCRIPTION, tr("Cycle through visible layers.")); |
40 | | putValue(NAME, tr("Cycle layers")); |
| 35 | super(false); |
| 36 | setName(tr("Cycle layers")); |
| 37 | setIcon("dialogs/previous"); |
| 38 | setShortcut(cycleDown); |
| 39 | setTooltip(tr("Cycle through visible layers.")); |
| 40 | registerInToolbar("cycle-layer-down"); |
41 | 41 | } |
42 | 42 | |
43 | 43 | @Override |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerUpAction.java b/src/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerUpAction.java
index d9adff6e2..742e7c531 100644
a
|
b
|
|
13 | 13 | import org.openstreetmap.josm.gui.layer.ImageryLayer; |
14 | 14 | import org.openstreetmap.josm.gui.layer.Layer; |
15 | 15 | import org.openstreetmap.josm.gui.layer.MainLayerManager; |
16 | | import org.openstreetmap.josm.tools.ImageProvider; |
17 | 16 | import org.openstreetmap.josm.tools.Shortcut; |
18 | 17 | |
19 | 18 | /** |
… |
… |
|
31 | 30 | * Create a CycleLayerDownAction that cycles through layers that are in the model |
32 | 31 | */ |
33 | 32 | public CycleLayerUpAction() { |
34 | | super(tr("Cycle layer up"), "dialogs/next", tr("Cycle through data layers in an upward direction"), |
35 | | cycleUp, true, "cycle-layer-up", false); |
36 | | new ImageProvider("dialogs", "next").getResource().attachImageIcon(this, true); |
37 | | putValue(SHORT_DESCRIPTION, tr("Cycle through visible layers.")); |
38 | | putValue(NAME, tr("Cycle layers")); |
| 33 | super(false); |
| 34 | setName(tr("Cycle layers")); |
| 35 | setIcon("dialogs/next"); |
| 36 | setShortcut(cycleUp); |
| 37 | setTooltip(tr("Cycle through visible layers.")); |
| 38 | registerInToolbar("cycle-layer-up"); |
39 | 39 | } |
40 | 40 | |
41 | 41 | @Override |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java b/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
index d2883342c..7b8e2fbe4 100644
a
|
b
|
public boolean isCellEditable(int row, int column) {
|
1079 | 1079 | private static final String DELETE_FROM_RELATION_PREF = "delete_from_relation"; |
1080 | 1080 | |
1081 | 1081 | DeleteAction() { |
1082 | | super(tr("Delete"), /* ICON() */ "dialogs/delete", tr("Delete the selected key in all objects"), |
1083 | | Shortcut.registerShortcut("properties:delete", tr("Delete Tags"), KeyEvent.VK_D, |
1084 | | Shortcut.ALT_CTRL_SHIFT), false); |
| 1082 | setName(tr("Delete")); |
| 1083 | setIcon(/* ICON() */ "dialogs/delete"); |
| 1084 | setShortcut(Shortcut.registerShortcut("properties:delete", tr("Delete Tags"), KeyEvent.VK_D, Shortcut.ALT_CTRL_SHIFT)); |
| 1085 | setTooltip(tr("Delete the selected key in all objects")); |
| 1086 | setToolbarId("dialogs/delete"); |
1085 | 1087 | updateEnabledState(); |
1086 | 1088 | } |
1087 | 1089 | |
… |
… |
public void valueChanged(ListSelectionEvent e) {
|
1189 | 1191 | class AddAction extends JosmAction { |
1190 | 1192 | AtomicBoolean isPerforming = new AtomicBoolean(false); |
1191 | 1193 | AddAction() { |
1192 | | super(tr("Add"), /* ICON() */ "dialogs/add", tr("Add a new key/value pair to all objects"), |
1193 | | Shortcut.registerShortcut("properties:add", tr("Add Tag"), KeyEvent.VK_A, |
1194 | | Shortcut.ALT), false); |
| 1194 | setName(tr("Add")); |
| 1195 | setIcon(/* ICON() */ "dialogs/add"); |
| 1196 | setShortcut(Shortcut.registerShortcut("properties:add", tr("Add Tag"), KeyEvent.VK_A, Shortcut.ALT)); |
| 1197 | setTooltip(tr("Add a new key/value pair to all objects")); |
| 1198 | setToolbarId("dialogs/add"); |
1195 | 1199 | } |
1196 | 1200 | |
1197 | 1201 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
1214 | 1218 | class EditAction extends JosmAction implements ListSelectionListener { |
1215 | 1219 | AtomicBoolean isPerforming = new AtomicBoolean(false); |
1216 | 1220 | EditAction() { |
1217 | | super(tr("Edit"), /* ICON() */ "dialogs/edit", tr("Edit the value of the selected key for all objects"), |
1218 | | Shortcut.registerShortcut("properties:edit", tr("Edit Tags"), KeyEvent.VK_S, |
1219 | | Shortcut.ALT), false); |
| 1221 | setName(tr("Edit")); |
| 1222 | setIcon(/* ICON() */ "dialogs/edit"); |
| 1223 | setShortcut(Shortcut.registerShortcut("properties:edit", tr("Edit Tags"), KeyEvent.VK_S, Shortcut.ALT)); |
| 1224 | setTooltip(tr("Edit the value of the selected key for all objects")); |
| 1225 | setToolbarId("dialogs/edit"); |
1220 | 1226 | updateEnabledState(); |
1221 | 1227 | } |
1222 | 1228 | |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java b/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
index 57a52a381..e0a28e84c 100644
a
|
b
|
protected void buildRecentTagsPanel() {
|
947 | 947 | /* POSSIBLE SHORTCUTS: 1,2,3,4,5,6,7,8,9,0=10 */ |
948 | 948 | final Shortcut sc = count > 10 ? null : Shortcut.registerShortcut("properties:recent:" + count, |
949 | 949 | tr("Choose recent tag {0}", count), KeyEvent.VK_0 + (count % 10), Shortcut.CTRL); |
950 | | final JosmAction action = new JosmAction( |
951 | | tr("Choose recent tag {0}", count), null, tr("Use this tag again"), sc, false) { |
| 950 | int finalCount = count; |
| 951 | final JosmAction action = new JosmAction(false) { |
| 952 | { |
| 953 | setName(tr("Choose recent tag {0}", finalCount)); |
| 954 | setShortcut(sc); |
| 955 | setTooltip(tr("Use this tag again")); |
| 956 | } |
952 | 957 | @Override |
953 | 958 | public void actionPerformed(ActionEvent e) { |
954 | 959 | keys.setSelectedItem(t.getKey(), true); |
… |
… |
public void actionPerformed(ActionEvent e) {
|
961 | 966 | /* POSSIBLE SHORTCUTS: 1,2,3,4,5,6,7,8,9,0=10 */ |
962 | 967 | final Shortcut scShift = count > 10 ? null : Shortcut.registerShortcut("properties:recent:apply:" + count, |
963 | 968 | tr("Apply recent tag {0}", count), KeyEvent.VK_0 + (count % 10), Shortcut.CTRL_SHIFT); |
964 | | final JosmAction actionShift = new JosmAction( |
965 | | tr("Apply recent tag {0}", count), null, tr("Use this tag again"), scShift, false) { |
| 969 | final JosmAction actionShift = new JosmAction(false) { |
| 970 | { |
| 971 | setName(tr("Apply recent tag {0}", finalCount)); |
| 972 | setShortcut(scShift); |
| 973 | setTooltip(tr("Use this tag again")); |
| 974 | } |
966 | 975 | @Override |
967 | 976 | public void actionPerformed(ActionEvent e) { |
968 | 977 | action.actionPerformed(null); |
-
diff --git a/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java b/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
index b52f923a1..1f6cb61aa 100644
a
|
b
|
public void setVisible(boolean visible) {
|
751 | 751 | protected static JMenuItem addToWindowMenu(IRelationEditor re, String layerName) { |
752 | 752 | Relation r = re.getRelation(); |
753 | 753 | String name = r == null ? tr("New relation") : r.getLocalName(); |
754 | | JosmAction focusAction = new JosmAction( |
755 | | tr("Relation Editor: {0}", name == null && r != null ? r.getId() : name), |
756 | | "dialogs/relationlist", |
757 | | tr("Focus Relation Editor with relation ''{0}'' in layer ''{1}''", name, layerName), |
758 | | null, false, false) { |
| 754 | JosmAction focusAction = new JosmAction(false) { |
| 755 | { |
| 756 | setName(tr("Relation Editor: {0}", name == null && r != null ? r.getId() : name)); |
| 757 | setIcon("dialogs/relationlist"); |
| 758 | setTooltip(tr("Focus Relation Editor with relation ''{0}'' in layer ''{1}''", name, layerName)); |
| 759 | } |
759 | 760 | private static final long serialVersionUID = 1L; |
760 | 761 | |
761 | 762 | @Override |
-
diff --git a/src/org/openstreetmap/josm/gui/help/HelpBrowser.java b/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
index 8b649ef11..c968c54a0 100644
a
|
b
|
|
71 | 71 | |
72 | 72 | private final transient HelpContentReader reader; |
73 | 73 | |
74 | | private static final JosmAction FOCUS_ACTION = new JosmAction(tr("JOSM Help Browser"), "help", "", null, false, false) { |
| 74 | private static final JosmAction FOCUS_ACTION = new JosmAction(false) { |
| 75 | { |
| 76 | setName(tr("JOSM Help Browser")); |
| 77 | setIcon("help"); |
| 78 | } |
75 | 79 | @Override |
76 | 80 | public void actionPerformed(ActionEvent e) { |
77 | 81 | HelpBrowser.getInstance().setVisible(true); |
-
diff --git a/src/org/openstreetmap/josm/gui/history/VersionTable.java b/src/org/openstreetmap/josm/gui/history/VersionTable.java
index fb7263a6f..1e337e5a8 100644
a
|
b
|
|
37 | 37 | import org.openstreetmap.josm.io.XmlWriter; |
38 | 38 | import org.openstreetmap.josm.spi.preferences.Config; |
39 | 39 | import org.openstreetmap.josm.tools.Destroyable; |
40 | | import org.openstreetmap.josm.tools.ImageProvider; |
41 | 40 | import org.openstreetmap.josm.tools.OpenBrowser; |
42 | 41 | |
43 | 42 | /** |
… |
… |
protected int checkTableSelection(JTable table, Point p) {
|
162 | 161 | */ |
163 | 162 | ChangesetInfoAction() { |
164 | 163 | super(true); |
165 | | putValue(NAME, tr("Changeset info")); |
166 | | putValue(SHORT_DESCRIPTION, tr("Launch browser with information about the changeset")); |
167 | | new ImageProvider("data/changeset").getResource().attachImageIcon(this, true); |
| 164 | setName(tr("Changeset info")); |
| 165 | setTooltip(tr("Launch browser with information about the changeset")); |
| 166 | setIcon("data/changeset"); |
168 | 167 | } |
169 | 168 | |
170 | 169 | @Override |
… |
… |
public void prepare(HistoryOsmPrimitive primitive) {
|
199 | 198 | */ |
200 | 199 | UserInfoAction() { |
201 | 200 | super(true); |
202 | | putValue(NAME, tr("User info")); |
203 | | putValue(SHORT_DESCRIPTION, tr("Launch browser with information about the user")); |
204 | | new ImageProvider("data/user").getResource().attachImageIcon(this, true); |
| 201 | setName(tr("User info")); |
| 202 | setTooltip(tr("Launch browser with information about the user")); |
| 203 | setIcon("data/user"); |
205 | 204 | } |
206 | 205 | |
207 | 206 | @Override |
-
diff --git a/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java b/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
index ad5d0e9ea..a0b9c06c9 100644
a
|
b
|
public void destroy() {
|
201 | 201 | |
202 | 202 | private class ImageNextAction extends JosmAction { |
203 | 203 | ImageNextAction() { |
204 | | super(null, new ImageProvider("dialogs", "next"), tr("Next"), Shortcut.registerShortcut( |
205 | | "geoimage:next", tr("Geoimage: {0}", tr("Show next Image")), KeyEvent.VK_PAGE_DOWN, Shortcut.DIRECT), |
206 | | false, null, false); |
| 204 | setIcon(new ImageProvider("dialogs", "next")); |
| 205 | setShortcut(Shortcut.registerShortcut( |
| 206 | "geoimage:next", tr("Geoimage: {0}", tr("Show next Image")), KeyEvent.VK_PAGE_DOWN, Shortcut.DIRECT)); |
| 207 | setTooltip(tr("Next")); |
207 | 208 | } |
208 | 209 | |
209 | 210 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
216 | 217 | |
217 | 218 | private class ImagePreviousAction extends JosmAction { |
218 | 219 | ImagePreviousAction() { |
219 | | super(null, new ImageProvider("dialogs", "previous"), tr("Previous"), Shortcut.registerShortcut( |
220 | | "geoimage:previous", tr("Geoimage: {0}", tr("Show previous Image")), KeyEvent.VK_PAGE_UP, Shortcut.DIRECT), |
221 | | false, null, false); |
| 220 | setIcon(new ImageProvider("dialogs", "previous")); |
| 221 | setShortcut(Shortcut.registerShortcut( |
| 222 | "geoimage:previous", tr("Geoimage: {0}", tr("Show previous Image")), KeyEvent.VK_PAGE_UP, Shortcut.DIRECT)); |
| 223 | setTooltip(tr("Previous")); |
222 | 224 | } |
223 | 225 | |
224 | 226 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
231 | 233 | |
232 | 234 | private class ImageFirstAction extends JosmAction { |
233 | 235 | ImageFirstAction() { |
234 | | super(null, new ImageProvider("dialogs", "first"), tr("First"), Shortcut.registerShortcut( |
235 | | "geoimage:first", tr("Geoimage: {0}", tr("Show first Image")), KeyEvent.VK_HOME, Shortcut.DIRECT), |
236 | | false, null, false); |
| 236 | setIcon(new ImageProvider("dialogs", "first")); |
| 237 | setShortcut(Shortcut.registerShortcut( |
| 238 | "geoimage:first", tr("Geoimage: {0}", tr("Show first Image")), KeyEvent.VK_HOME, Shortcut.DIRECT)); |
| 239 | setTooltip(tr("First")); |
237 | 240 | } |
238 | 241 | |
239 | 242 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
246 | 249 | |
247 | 250 | private class ImageLastAction extends JosmAction { |
248 | 251 | ImageLastAction() { |
249 | | super(null, new ImageProvider("dialogs", "last"), tr("Last"), Shortcut.registerShortcut( |
250 | | "geoimage:last", tr("Geoimage: {0}", tr("Show last Image")), KeyEvent.VK_END, Shortcut.DIRECT), |
251 | | false, null, false); |
| 252 | setIcon(new ImageProvider("dialogs", "last")); |
| 253 | setShortcut(Shortcut.registerShortcut( |
| 254 | "geoimage:last", tr("Geoimage: {0}", tr("Show last Image")), KeyEvent.VK_END, Shortcut.DIRECT)); |
| 255 | setTooltip(tr("Last")); |
252 | 256 | } |
253 | 257 | |
254 | 258 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
261 | 265 | |
262 | 266 | private class ImageCenterViewAction extends JosmAction { |
263 | 267 | ImageCenterViewAction() { |
264 | | super(null, new ImageProvider("dialogs/autoscale", "selection"), tr("Center view"), null, |
265 | | false, null, false); |
| 268 | setIcon(new ImageProvider("dialogs/autoscale", "selection")); |
| 269 | setTooltip(tr("Center view")); |
266 | 270 | } |
267 | 271 | |
268 | 272 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
277 | 281 | |
278 | 282 | private class ImageZoomAction extends JosmAction { |
279 | 283 | ImageZoomAction() { |
280 | | super(null, new ImageProvider("dialogs", "zoom-best-fit"), tr("Zoom best fit and 1:1"), null, |
281 | | false, null, false); |
| 284 | setIcon(new ImageProvider("dialogs", "zoom-best-fit")); |
| 285 | setTooltip(tr("Zoom best fit and 1:1")); |
282 | 286 | } |
283 | 287 | |
284 | 288 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
289 | 293 | |
290 | 294 | private class ImageRemoveAction extends JosmAction { |
291 | 295 | ImageRemoveAction() { |
292 | | super(null, new ImageProvider("dialogs", "delete"), tr("Remove photo from layer"), Shortcut.registerShortcut( |
293 | | "geoimage:deleteimagefromlayer", tr("Geoimage: {0}", tr("Remove photo from layer")), KeyEvent.VK_DELETE, Shortcut.SHIFT), |
294 | | false, null, false); |
| 296 | setIcon(new ImageProvider("dialogs", "delete")); |
| 297 | setShortcut(Shortcut.registerShortcut("geoimage:deleteimagefromlayer", tr("Geoimage: {0}", tr("Remove photo from layer")), |
| 298 | KeyEvent.VK_DELETE, Shortcut.SHIFT)); |
| 299 | setTooltip(tr("Remove photo from layer")); |
295 | 300 | } |
296 | 301 | |
297 | 302 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
304 | 309 | |
305 | 310 | private class ImageRemoveFromDiskAction extends JosmAction { |
306 | 311 | ImageRemoveFromDiskAction() { |
307 | | super(null, new ImageProvider("dialogs", "geoimage/deletefromdisk"), tr("Delete image file from disk"), |
308 | | Shortcut.registerShortcut("geoimage:deletefilefromdisk", |
309 | | tr("Geoimage: {0}", tr("Delete image file from disk")), KeyEvent.VK_DELETE, Shortcut.CTRL_SHIFT), |
310 | | false, null, false); |
| 312 | setIcon(new ImageProvider("dialogs", "geoimage/deletefromdisk")); |
| 313 | setShortcut(Shortcut.registerShortcut("geoimage:deletefilefromdisk", |
| 314 | tr("Geoimage: {0}", tr("Delete image file from disk")), KeyEvent.VK_DELETE, Shortcut.CTRL_SHIFT)); |
| 315 | setTooltip(tr("Delete image file from disk")); |
311 | 316 | } |
312 | 317 | |
313 | 318 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
354 | 359 | |
355 | 360 | private class ImageCopyPathAction extends JosmAction { |
356 | 361 | ImageCopyPathAction() { |
357 | | super(null, new ImageProvider("copy"), tr("Copy image path"), Shortcut.registerShortcut( |
358 | | "geoimage:copypath", tr("Geoimage: {0}", tr("Copy image path")), KeyEvent.VK_C, Shortcut.ALT_CTRL_SHIFT), |
359 | | false, null, false); |
| 362 | setIcon(new ImageProvider("copy")); |
| 363 | setShortcut(Shortcut.registerShortcut( |
| 364 | "geoimage:copypath", tr("Geoimage: {0}", tr("Copy image path")), KeyEvent.VK_C, Shortcut.ALT_CTRL_SHIFT)); |
| 365 | setTooltip(tr("Copy image path")); |
360 | 366 | } |
361 | 367 | |
362 | 368 | @Override |
… |
… |
public void actionPerformed(ActionEvent e) {
|
369 | 375 | |
370 | 376 | private class ImageCollapseAction extends JosmAction { |
371 | 377 | ImageCollapseAction() { |
372 | | super(null, new ImageProvider("dialogs", "collapse"), tr("Move dialog to the side pane"), null, |
373 | | false, null, false); |
| 378 | setIcon(new ImageProvider("dialogs", "collapse")); |
| 379 | setTooltip(tr("Move dialog to the side pane")); |
374 | 380 | } |
375 | 381 | |
376 | 382 | @Override |
-
diff --git a/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackAction.java b/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackAction.java
index 0041769d7..785bca1b9 100644
a
|
b
|
|
39 | 39 | * @param data The GPX data used to download along |
40 | 40 | */ |
41 | 41 | public DownloadAlongTrackAction(GpxData data) { |
42 | | super(tr("Download from OSM along this track"), "downloadalongtrack", null, null, false); |
| 42 | setName(tr("Download from OSM along this track")); |
| 43 | setIcon("downloadalongtrack"); |
| 44 | setToolbarId("downloadalongtrack"); |
43 | 45 | this.data = data; |
44 | 46 | } |
45 | 47 | |
-
diff --git a/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java b/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
index f7575f772..6e45b6795 100644
a
|
b
|
|
32 | 32 | private final JCheckBoxMenuItem button; |
33 | 33 | |
34 | 34 | MapPaintAction(StyleSource style) { |
35 | | super(style.getDisplayString(), style.getIconProvider(), |
36 | | tr("Select the map painting styles"), null, true, "mappaint/" + style.getDisplayString(), true); |
| 35 | setName(style.getDisplayString()); |
| 36 | setIcon(style.getIconProvider()); |
| 37 | setTooltip(tr("Select the map painting styles")); |
| 38 | registerInToolbar("mappaint/" + style.getDisplayString()); |
37 | 39 | this.button = new StayOpenCheckBoxMenuItem(this); |
38 | 40 | this.style = style; |
39 | 41 | updateButton(); |
-
diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java b/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java
index cdfe3a466..a50819543 100644
a
|
b
|
|
32 | 32 | * Constructs a new {@link TaggingPresetSearchPrimitiveDialog.Action}. |
33 | 33 | */ |
34 | 34 | public Action() { |
35 | | super(tr("Search for objects by preset..."), "dialogs/search", tr("Search for objects by their presets."), |
36 | | Shortcut.registerShortcut("preset:search-objects", tr("Search for objects by preset"), KeyEvent.VK_F3, Shortcut.SHIFT), |
37 | | false); |
| 35 | setName(tr("Search for objects by preset...")); |
| 36 | setIcon("dialogs/search"); |
| 37 | setShortcut(Shortcut.registerShortcut("preset:search-objects", tr("Search for objects by preset"), KeyEvent.VK_F3, Shortcut.SHIFT)); |
| 38 | setTooltip(tr("Search for objects by their presets.")); |
| 39 | setToolbarId("dialogs/search"); |
38 | 40 | putValue("toolbar", "presets/search-objects"); |
39 | 41 | MainApplication.getToolbar().register(this); |
40 | 42 | } |