Changeset 32551 in osm for applications
- Timestamp:
- 2016-07-04T09:29:30+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/waypoint_search
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/waypoint_search/.project
r32286 r32551 16 16 </arguments> 17 17 </buildCommand> 18 <buildCommand> 19 <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> 20 <arguments> 21 </arguments> 22 </buildCommand> 18 23 </buildSpec> 19 24 <natures> 20 25 <nature>org.eclipse.jdt.core.javanature</nature> 26 <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> 21 27 </natures> 22 28 </projectDescription> -
applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/Engine.java
r32329 r32551 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.waypointSearch; 2 3 3 import org.openstreetmap.josm.Main; 4 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 5 import org.openstreetmap.josm.gui.layer.markerlayer.Marker; 6 7 import java.util.*; 4 import java.util.ArrayList; 5 import java.util.Iterator; 6 import java.util.List; 8 7 import java.util.regex.Pattern; 9 8 10 class Engine { 11 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.gui.layer.markerlayer.Marker; 11 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 12 13 final class Engine { 14 12 15 private Engine() { 13 16 // Utility class … … 25 28 returnList.add(marker); 26 29 } 27 } 30 } 28 31 } 29 } 32 } 30 33 return returnList; 31 } 32 34 } 35 33 36 static boolean gpxLayersExist() { 34 37 return !Main.getLayerManager().getLayersOfType(MarkerLayer.class).isEmpty(); -
applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/SelectWaypointDialog.java
r30777 r32551 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.waypointSearch; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 2 5 3 6 import java.awt.BorderLayout; … … 9 12 import java.util.Iterator; 10 13 import java.util.List; 11 import javax.swing.*; 14 15 import javax.swing.DefaultListModel; 16 import javax.swing.JLabel; 17 import javax.swing.JList; 18 import javax.swing.JPanel; 19 import javax.swing.JScrollPane; 20 import javax.swing.JTextField; 21 import javax.swing.ListSelectionModel; 12 22 13 23 import org.openstreetmap.josm.Main; … … 15 25 import org.openstreetmap.josm.gui.layer.markerlayer.Marker; 16 26 import org.openstreetmap.josm.tools.Shortcut; 17 import static org.openstreetmap.josm.tools.I18n.tr;18 27 19 28 class SelectWaypointDialog extends ToggleDialog implements KeyListener, MouseListener { … … 24 33 private List<Marker> searchResultObjectCache = new ArrayList<>(); 25 34 private boolean firstTimeSearch = true; 26 35 27 36 SelectWaypointDialog(String name, String iconName, String tooltip, 28 37 Shortcut shortcut, int preferredHeight) { … … 34 43 //add panel - all the gui of the plugin goes in here 35 44 JPanel panel = new JPanel(new BorderLayout()); 36 45 37 46 //search field 38 47 searchPattern.setText(tr("Enter search expression here..")); 39 48 searchPattern.addKeyListener(this); 40 49 searchPattern.addMouseListener(this); 41 panel.add(searchPattern, BorderLayout.NORTH);42 50 panel.add(searchPattern, BorderLayout.NORTH); 51 43 52 //add result table 44 53 searchResult.setLayoutOrientation(JList.VERTICAL); … … 47 56 JScrollPane scrollPane = new JScrollPane(searchResult); 48 57 scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 49 panel.add(scrollPane, BorderLayout.CENTER);50 58 panel.add(scrollPane, BorderLayout.CENTER); 59 51 60 //add label 52 61 JLabel label = new JLabel(tr("Select waypoint to move map")); 53 panel.add(label, BorderLayout.SOUTH);54 62 panel.add(label, BorderLayout.SOUTH); 63 55 64 //add panel to JOSM gui 56 65 createLayout(panel, false, null); 57 66 } 58 67 59 68 void updateSearchResults() { 60 69 String searchfor = ""; … … 88 97 @Override 89 98 public void mouseClicked(MouseEvent e) { 90 if (e.getSource() ==searchResult) {99 if (e.getSource() == searchResult) { 91 100 //click on the search result box 92 101 Marker marker = searchResultObjectCache.get(searchResult.getSelectedIndex()); 93 102 Main.map.mapView.zoomTo(marker.getCoor()); 94 } else {95 //click on the text field (input search expression)96 103 } 97 104 } … … 109 116 @Override 110 117 public void mousePressed(MouseEvent arg0) { 111 if (searchPattern.getSelectedText() ==null) {118 if (searchPattern.getSelectedText() == null) { 112 119 searchPattern.selectAll(); 113 120 } -
applications/editors/josm/plugins/waypoint_search/src/org/openstreetmap/josm/plugins/waypointSearch/WaypointSearchPlugin.java
r32514 r32551 1 // License: GPL. For details, see LICENSE file. 1 2 package org.openstreetmap.josm.plugins.waypointSearch; 2 3 … … 18 19 * Click on one of the search results/waypoints to move the map. 19 20 */ 20 public class WaypointSearchPlugin extends Plugin implements LayerChangeListener 21 public class WaypointSearchPlugin extends Plugin implements LayerChangeListener { 21 22 private SelectWaypointDialog waypointDialog; 22 23
Note:
See TracChangeset
for help on using the changeset viewer.