Changeset 28624 in osm for applications/editors/josm/plugins/waypoint_search/src/org
- Timestamp:
- 2012-08-24T13:41:33+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/WaypointSearchPlugin.java
r23192 r28624 1 1 package org.openstreetmap.josm.plugins.waypointSearch; 2 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import org.openstreetmap.josm.gui.MapFrame; 6 import org.openstreetmap.josm.gui.MapView; 7 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 8 import org.openstreetmap.josm.gui.layer.Layer; 3 9 import org.openstreetmap.josm.plugins.Plugin; 4 10 import org.openstreetmap.josm.plugins.PluginInformation; 5 import org.openstreetmap.josm.Main;6 import org.openstreetmap.josm.gui.MapView;7 import org.openstreetmap.josm.gui.layer.Layer;8 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;9 import static org.openstreetmap.josm.tools.I18n.tr;10 11 11 12 public class WaypointSearchPlugin extends Plugin implements LayerChangeListener { … … 15 16 * @param info information about the plugin and its local installation 16 17 */ 17 private Engine engine = new Engine();18 private SelectWaypointDialog waypointDialog = new SelectWaypointDialog(tr("Waypoint search"), "ToolbarIcon", tr("Search after waypoint. Click and move the map view to the waypoint."), null, 100);18 private final Engine engine = new Engine(); 19 private SelectWaypointDialog waypointDialog; 19 20 20 21 public WaypointSearchPlugin(PluginInformation info) { … … 23 24 } 24 25 25 @Override 26 @Override 27 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 28 if (newFrame != null) { 29 newFrame.addToggleDialog(waypointDialog = new SelectWaypointDialog( 30 tr("Waypoint search"), "ToolbarIcon", tr("Search after waypoint. Click and move the map view to the waypoint."), null, 100)); 31 } else { 32 waypointDialog = null; 33 } 34 } 35 36 @Override 26 37 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 27 // TODO Auto-generated method stub28 29 38 } 30 31 39 32 40 @Override 33 41 public void layerAdded(Layer newLayer) { 34 //add dialog 35 if (Main.map.getToggleDialog(SelectWaypointDialog.class)==null) { 36 Main.map.addToggleDialog(waypointDialog); 37 } 38 //update search 39 if (engine.gpxLayersExist()) { 42 // update search 43 if (waypointDialog != null && engine.gpxLayersExist()) { 40 44 waypointDialog.updateSearchResults(); 41 45 } 42 46 } 43 47 44 45 46 48 @Override 47 49 public void layerRemoved(Layer oldLayer) { 48 if ( !engine.gpxLayersExist()) {50 if (waypointDialog != null && !engine.gpxLayersExist()) { 49 51 waypointDialog.updateSearchResults(); 50 52 } 51 53 } 52 53 54 } 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
Note:
See TracChangeset
for help on using the changeset viewer.