1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.plugins.DirectUpload;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.actions.JosmAction;
|
---|
10 | import org.openstreetmap.josm.gui.MainApplication;
|
---|
11 | import org.openstreetmap.josm.gui.MainMenu;
|
---|
12 | import org.openstreetmap.josm.plugins.Plugin;
|
---|
13 | import org.openstreetmap.josm.plugins.PluginInformation;
|
---|
14 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | *
|
---|
18 | * @author subhodip, ax
|
---|
19 | */
|
---|
20 | public class UploadDataGuiPlugin extends Plugin {
|
---|
21 |
|
---|
22 | UploadAction openaction;
|
---|
23 |
|
---|
24 | public UploadDataGuiPlugin(PluginInformation info) {
|
---|
25 | super(info);
|
---|
26 | openaction = new UploadAction();
|
---|
27 | MainMenu.add(MainApplication.getMenu().gpsMenu, openaction);
|
---|
28 | }
|
---|
29 |
|
---|
30 | static class UploadAction extends JosmAction {
|
---|
31 |
|
---|
32 | public UploadAction(){
|
---|
33 | super(tr("Upload Traces"), "UploadAction", tr("Uploads traces to openstreetmap.org"),
|
---|
34 | Shortcut.registerShortcut("tools:uploadtraces", tr("Tool: {0}", tr("Upload Traces")),
|
---|
35 | KeyEvent.VK_G, Shortcut.CTRL), false);
|
---|
36 | }
|
---|
37 |
|
---|
38 | @Override
|
---|
39 | public void actionPerformed(ActionEvent e) {
|
---|
40 | UploadDataGui go = new UploadDataGui();
|
---|
41 | go.setVisible(true);
|
---|
42 | }
|
---|
43 |
|
---|
44 | // because LayerListDialog doesn't provide a way to hook into "layer selection changed"
|
---|
45 | // but the layer selection (*not* activation) is how we determine the layer to be uploaded
|
---|
46 | // we have to let the upload trace menu always be enabled
|
---|
47 | // @Override
|
---|
48 | // protected void updateEnabledState() {
|
---|
49 | // // enable button if ... @see autoSelectTrace()
|
---|
50 | // if (UploadOsmConnection.getInstance().autoSelectTrace() == null) {
|
---|
51 | // setEnabled(false);
|
---|
52 | // } else {
|
---|
53 | // setEnabled(true);
|
---|
54 | // }
|
---|
55 | // }
|
---|
56 | }
|
---|
57 | }
|
---|