Ignore:
Timestamp:
2013-08-01T18:46:11+02:00 (11 years ago)
Author:
akks
Message:

[josm/plugins]: more imagery layer adding actions to Imagery/More submenu

Location:
applications/editors/josm/plugins/piclayer
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/piclayer/build.xml

    r29784 r29805  
    33    <property name="commit.message" value="PicLayer - #8743 - fixed NPE when removing last layer"/>
    44    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    5     <property name="plugin.main.version" value="6088"/>
     5    <property name="plugin.main.version" value="6097"/>
    66       
    77    <!-- Configure these properties (replace "..." accordingly).
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java

    r29784 r29805  
    2121package org.openstreetmap.josm.plugins.piclayer;
    2222
    23 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
    24 import static org.openstreetmap.josm.tools.I18n.marktr;
    2523import static org.openstreetmap.josm.tools.I18n.tr;
    2624
    27 import java.awt.event.KeyEvent;
    2825import java.util.ArrayList;
    2926import java.util.List;
    3027
    31 import javax.swing.JMenu;
    3228import javax.swing.JOptionPane;
    3329import javax.swing.UIManager;
    3430
    3531import org.openstreetmap.josm.Main;
     32import org.openstreetmap.josm.actions.JosmAction;
    3633import org.openstreetmap.josm.actions.mapmode.MapMode;
    3734import org.openstreetmap.josm.gui.IconToggleButton;
     35import org.openstreetmap.josm.gui.MainMenu;
    3836import org.openstreetmap.josm.gui.MapFrame;
    3937import org.openstreetmap.josm.gui.MapView;
     
    6462
    6563    // Plugin menu
    66     private JMenu menu = null;
    67 
     64    JosmAction newLayerFromFileAction = new NewLayerFromFileAction();
     65    JosmAction newLayerFromClipboardAction = new NewLayerFromClipboardAction();
    6866    /**
    6967     * Constructor...
     
    7371
    7472        // Create menu entry
    75         if ( Main.main.menu != null ) {
    76             menu = Main.main.menu.addMenu(marktr("PicLayer") , KeyEvent.VK_L, Main.main.menu.getDefaultMenuPos(), ht("/Plugin/PicLayer"));
    77         }
    78 
     73       
    7974        // Add menu items
    80         if ( menu != null ) {
    81             menu.add(new NewLayerFromFileAction());
    82             menu.add(new NewLayerFromClipboardAction());
    83             menu.setEnabled(false);
    84         }
    85 
     75        MainMenu.add(Main.main.menu.imagerySubMenu, newLayerFromFileAction);
     76        MainMenu.add(Main.main.menu.imagerySubMenu, newLayerFromClipboardAction);
    8677        // Listen to layers
    8778        MapView.addLayerChangeListener(this);
     
    154145    @Override
    155146    public void layerAdded(Layer arg0) {
    156         menu.setEnabled(true);
     147        newLayerFromClipboardAction.setEnabled(true);
     148        newLayerFromClipboardAction.setEnabled(true);
    157149    }
    158150
     
    171163        // Why should I do all these checks now?
    172164        boolean enable = Main.map != null && Main.map.mapView != null && Main.map.mapView.getAllLayers() != null && Main.map.mapView.getAllLayers().size() != 0;
    173         menu.setEnabled(enable);
     165        newLayerFromClipboardAction.setEnabled(enable);
     166        newLayerFromClipboardAction.setEnabled(enable);
    174167    }
    175168};
Note: See TracChangeset for help on using the changeset viewer.