source: osm/applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrab.java@ 19928

Last change on this file since 19928 was 18838, checked in by pieren, 15 years ago

Fix minor issues if Grab is called without layer (possible since projection rework)

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others
2package cadastre_fr;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7import java.awt.event.KeyEvent;
8
9import javax.swing.JOptionPane;
10
11import org.openstreetmap.josm.Main;
12import org.openstreetmap.josm.actions.JosmAction;
13import org.openstreetmap.josm.tools.Shortcut;
14
15public class MenuActionGrab extends JosmAction {
16
17 /**
18 * Action calling the wms grabber for cadastre.gouv.fr
19 */
20 private static final long serialVersionUID = 1L;
21
22 public static String name = "Cadastre grab";
23
24 public MenuActionGrab() {
25 super(tr(name), "cadastre_small", tr("Download Image from French Cadastre WMS"),
26 Shortcut.registerShortcut("cadastre:grab", tr("Cadastre: {0}", tr("Download Image from French Cadastre WMS")),
27 KeyEvent.VK_F11, Shortcut.GROUP_DIRECT), false);
28 }
29
30 public void actionPerformed(ActionEvent e) {
31 if (Main.map != null) {
32 if (CadastrePlugin.isCadastreProjection()) {
33 WMSLayer wmsLayer = WMSDownloadAction.getLayer();
34 if (wmsLayer != null)
35 DownloadWMSVectorImage.download(wmsLayer);
36 } else {
37 JOptionPane.showMessageDialog(Main.parent,
38 tr("To enable the cadastre WMS plugin, change\n"
39 + "the current projection to one of the cadastre\n"
40 + "projections and retry"));
41 }
42 } else
43 new MenuActionNewLocation().actionPerformed(e);
44 }
45
46}
Note: See TracBrowser for help on using the repository browser.