kopia lustrzana https://github.com/JOSM/MapWithAI
Get tool menus working
Signed-off-by: Taylor Smock <smocktaylor@gmail.com>pull/1/head
rodzic
836de7300e
commit
474c5ef44a
|
@ -1,9 +1,10 @@
|
||||||
// License: GPL. For details, see LICENSE file.
|
// License: GPL. For details, see LICENSE file.
|
||||||
package org.openstreetmap.josm.plugins.rapid;
|
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.MainApplication;
|
||||||
|
import org.openstreetmap.josm.gui.MainMenu;
|
||||||
import org.openstreetmap.josm.plugins.Plugin;
|
import org.openstreetmap.josm.plugins.Plugin;
|
||||||
import org.openstreetmap.josm.plugins.PluginInformation;
|
import org.openstreetmap.josm.plugins.PluginInformation;
|
||||||
import org.openstreetmap.josm.plugins.rapid.backend.RapiDAction;
|
import org.openstreetmap.josm.plugins.rapid.backend.RapiDAction;
|
||||||
|
@ -16,12 +17,8 @@ public final class RapiDPlugin extends Plugin {
|
||||||
public RapiDPlugin(PluginInformation info) {
|
public RapiDPlugin(PluginInformation info) {
|
||||||
super(info);
|
super(info);
|
||||||
|
|
||||||
RapiDAction action = new RapiDAction();
|
JMenu dataMenu = MainApplication.getMenu().dataMenu;
|
||||||
AbstractAction add = new RapiDMoveAction();
|
MainMenu.add(dataMenu, new RapiDAction(), false);
|
||||||
|
MainMenu.add(dataMenu, new RapiDMoveAction(), false);
|
||||||
MainApplication.getMenu().dataMenu.add(action);
|
|
||||||
MainApplication.getMenu().dataMenu.add(add);
|
|
||||||
MainApplication.getMenu().fileMenu.add(action);
|
|
||||||
MainApplication.getMenu().fileMenu.add(add);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,27 @@
|
||||||
package org.openstreetmap.josm.plugins.rapid.backend;
|
package org.openstreetmap.josm.plugins.rapid.backend;
|
||||||
|
|
||||||
|
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.List;
|
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.Bounds;
|
||||||
import org.openstreetmap.josm.data.osm.DataSet;
|
import org.openstreetmap.josm.data.osm.DataSet;
|
||||||
import org.openstreetmap.josm.gui.MainApplication;
|
import org.openstreetmap.josm.gui.MainApplication;
|
||||||
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
||||||
import org.openstreetmap.josm.plugins.rapid.RapiDPlugin;
|
import org.openstreetmap.josm.plugins.rapid.RapiDPlugin;
|
||||||
|
import org.openstreetmap.josm.tools.Shortcut;
|
||||||
|
|
||||||
public class RapiDAction extends AbstractAction {
|
public class RapiDAction extends JosmAction {
|
||||||
/** UID */
|
/** UID */
|
||||||
private static final long serialVersionUID = 8886705479253246588L;
|
private static final long serialVersionUID = 8886705479253246588L;
|
||||||
|
|
||||||
public RapiDAction() {
|
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
|
@Override
|
||||||
|
|
|
@ -3,24 +3,26 @@ package org.openstreetmap.josm.plugins.rapid.backend;
|
||||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
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.UndoRedoHandler;
|
||||||
import org.openstreetmap.josm.data.osm.DataSet;
|
import org.openstreetmap.josm.data.osm.DataSet;
|
||||||
import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
||||||
import org.openstreetmap.josm.gui.MainApplication;
|
import org.openstreetmap.josm.gui.MainApplication;
|
||||||
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
||||||
import org.openstreetmap.josm.plugins.rapid.RapiDPlugin;
|
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 */
|
/** UID for abstract action */
|
||||||
private static final long serialVersionUID = 319374598;
|
private static final long serialVersionUID = 319374598;
|
||||||
|
|
||||||
public RapiDMoveAction() {
|
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
|
@Override
|
||||||
|
|
Ładowanie…
Reference in New Issue