Get tool menus working

Signed-off-by: Taylor Smock <smocktaylor@gmail.com>
pull/1/head
Taylor Smock 2019-09-20 05:49:27 -06:00
rodzic 836de7300e
commit 474c5ef44a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 9FDE4FFEF1C4CCB7
3 zmienionych plików z 20 dodań i 16 usunięć

Wyświetl plik

@ -1,9 +1,10 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.rapid;
import javax.swing.AbstractAction;
import javax.swing.JMenu;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.MainMenu;
import org.openstreetmap.josm.plugins.Plugin;
import org.openstreetmap.josm.plugins.PluginInformation;
import org.openstreetmap.josm.plugins.rapid.backend.RapiDAction;
@ -16,12 +17,8 @@ public final class RapiDPlugin extends Plugin {
public RapiDPlugin(PluginInformation info) {
super(info);
RapiDAction action = new RapiDAction();
AbstractAction add = new RapiDMoveAction();
MainApplication.getMenu().dataMenu.add(action);
MainApplication.getMenu().dataMenu.add(add);
MainApplication.getMenu().fileMenu.add(action);
MainApplication.getMenu().fileMenu.add(add);
JMenu dataMenu = MainApplication.getMenu().dataMenu;
MainMenu.add(dataMenu, new RapiDAction(), false);
MainMenu.add(dataMenu, new RapiDMoveAction(), false);
}
}

Wyświetl plik

@ -1,22 +1,27 @@
package org.openstreetmap.josm.plugins.rapid.backend;
import static org.openstreetmap.josm.tools.I18n.tr;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.List;
import javax.swing.AbstractAction;
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.plugins.rapid.RapiDPlugin;
import org.openstreetmap.josm.tools.Shortcut;
public class RapiDAction extends AbstractAction {
public class RapiDAction extends JosmAction {
/** UID */
private static final long serialVersionUID = 8886705479253246588L;
public RapiDAction() {
super(RapiDPlugin.NAME);
super(RapiDPlugin.NAME, null, tr("Get data from RapiD"),
Shortcut.registerShortcut("data:rapid", tr("Data: {0}", tr("RapiD")), KeyEvent.VK_D, Shortcut.SHIFT),
true);
}
@Override

Wyświetl plik

@ -3,24 +3,26 @@ package org.openstreetmap.josm.plugins.rapid.backend;
import static org.openstreetmap.josm.tools.I18n.tr;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.Collection;
import java.util.List;
import javax.swing.AbstractAction;
import org.openstreetmap.josm.actions.JosmAction;
import org.openstreetmap.josm.data.UndoRedoHandler;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.OsmPrimitive;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.plugins.rapid.RapiDPlugin;
import org.openstreetmap.josm.tools.Shortcut;
public class RapiDMoveAction extends AbstractAction {
public class RapiDMoveAction extends JosmAction {
/** UID for abstract action */
private static final long serialVersionUID = 319374598;
public RapiDMoveAction() {
super(tr("Add from ".concat(RapiDPlugin.NAME)));
super(tr("Add from ".concat(RapiDPlugin.NAME)), null, tr("Add data from RapiD"), Shortcut.registerShortcut(
"data:rapidadd", tr("Rapid: {0}", tr("Add selected data")), KeyEvent.VK_A, Shortcut.SHIFT), true);
}
@Override