Changeset 29805 in osm for applications/editors/josm/plugins/piclayer
- Timestamp:
- 2013-08-01T18:46:11+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/piclayer
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/piclayer/build.xml
r29784 r29805 3 3 <property name="commit.message" value="PicLayer - #8743 - fixed NPE when removing last layer"/> 4 4 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 5 <property name="plugin.main.version" value="60 88"/>5 <property name="plugin.main.version" value="6097"/> 6 6 7 7 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/PicLayerPlugin.java
r29784 r29805 21 21 package org.openstreetmap.josm.plugins.piclayer; 22 22 23 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;24 import static org.openstreetmap.josm.tools.I18n.marktr;25 23 import static org.openstreetmap.josm.tools.I18n.tr; 26 24 27 import java.awt.event.KeyEvent;28 25 import java.util.ArrayList; 29 26 import java.util.List; 30 27 31 import javax.swing.JMenu;32 28 import javax.swing.JOptionPane; 33 29 import javax.swing.UIManager; 34 30 35 31 import org.openstreetmap.josm.Main; 32 import org.openstreetmap.josm.actions.JosmAction; 36 33 import org.openstreetmap.josm.actions.mapmode.MapMode; 37 34 import org.openstreetmap.josm.gui.IconToggleButton; 35 import org.openstreetmap.josm.gui.MainMenu; 38 36 import org.openstreetmap.josm.gui.MapFrame; 39 37 import org.openstreetmap.josm.gui.MapView; … … 64 62 65 63 // Plugin menu 66 private JMenu menu = null;67 64 JosmAction newLayerFromFileAction = new NewLayerFromFileAction(); 65 JosmAction newLayerFromClipboardAction = new NewLayerFromClipboardAction(); 68 66 /** 69 67 * Constructor... … … 73 71 74 72 // 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 79 74 // 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); 86 77 // Listen to layers 87 78 MapView.addLayerChangeListener(this); … … 154 145 @Override 155 146 public void layerAdded(Layer arg0) { 156 menu.setEnabled(true); 147 newLayerFromClipboardAction.setEnabled(true); 148 newLayerFromClipboardAction.setEnabled(true); 157 149 } 158 150 … … 171 163 // Why should I do all these checks now? 172 164 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); 174 167 } 175 168 };
Note:
See TracChangeset
for help on using the changeset viewer.