Changeset 29769 in osm for applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap
- Timestamp:
- 2013-07-24T18:01:58+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java
r29742 r29769 71 71 public UtilsPlugin2(PluginInformation info) { 72 72 super(info); 73 74 JMenu toolsMenu = Main.main.menu.addMenu(marktr("More tools"), KeyEvent.VK_Q, 4, "help"); 75 unglueRelation = MainMenu.add(toolsMenu, new UnGlueRelationAction()); 73 boolean oldMenu = org.openstreetmap.josm.data.Version.getInstance().getVersion() < 6082; 74 JMenu toolsMenu = oldMenu 75 ? Main.main.menu.addMenu(marktr("More tools"), KeyEvent.VK_Q, 4, "help") 76 : Main.main.menu.moreToolsMenu; 77 78 JMenu dataMenu = oldMenu ? toolsMenu: Main.main.menu.dataMenu; 79 76 80 addIntersections = MainMenu.add(toolsMenu, new AddIntersectionsAction()); 77 81 splitObject = MainMenu.add(toolsMenu, new SplitObjectAction()); 78 82 alignWayNodes = MainMenu.add(toolsMenu, new AlignWayNodesAction()); 83 symmetry = MainMenu.add(toolsMenu, new SymmetryAction()); 84 splitOnIntersections = MainMenu.add(toolsMenu, new SplitOnIntersectionsAction()); 85 unglueRelation = MainMenu.add(toolsMenu, new UnGlueRelationAction()); 79 86 toolsMenu.addSeparator(); 80 87 replaceGeometry = MainMenu.add(toolsMenu, new ReplaceGeometryAction()); 88 extractPoint = MainMenu.add(toolsMenu, new ExtractPointAction()); 81 89 tagBuffer = MainMenu.add(toolsMenu, new TagBufferAction()); 82 90 sourceTag = MainMenu.add(toolsMenu, new TagSourceAction()); 83 91 pasteRelations = MainMenu.add(toolsMenu, new PasteRelationsAction()); 84 alignWayNodes = MainMenu.add(toolsMenu, new AlignWayNodesAction()); 85 splitOnIntersections = MainMenu.add(toolsMenu, new SplitOnIntersectionsAction()); 86 extractPoint = MainMenu.add(toolsMenu, new ExtractPointAction()); 87 symmetry = MainMenu.add(toolsMenu, new SymmetryAction()); 88 wiki = MainMenu.add(toolsMenu, new OpenPageAction()); 92 wiki = MainMenu.add(dataMenu, new OpenPageAction()); 89 93 latlon = MainMenu.add(toolsMenu, new LatLonAction()); 90 91 JMenu selectionMenu = Main.main.menu.addMenu(marktr("Selection"), KeyEvent.VK_N, Main.main.menu.defaultMenuPos, "help"); 94 drawArc = MainMenu.add(toolsMenu, new CurveAction()); 95 96 JMenu selectionMenu; 97 if (oldMenu) { 98 selectionMenu = Main.main.menu.addMenu(marktr("Selection"), KeyEvent.VK_N, 4, "help"); 99 } else { 100 selectionMenu = Main.main.menu.selectionMenu; 101 selectionMenu.addSeparator(); 102 } 103 92 104 selectWayNodes = MainMenu.add(selectionMenu, new SelectWayNodesAction()); 93 105 adjNodes = MainMenu.add(selectionMenu, new AdjacentNodesAction()); … … 105 117 selectAreaBoundary = MainMenu.add(selectionMenu, new SelectBoundaryAction()); 106 118 107 selectURL = MainMenu.add(toolsMenu, new ChooseURLAction()); 108 drawArc = MainMenu.add(toolsMenu, new CurveAction()); 109 119 selectURL = MainMenu.add(dataMenu, new ChooseURLAction()); 120 110 121 // register search operators 111 122 SearchCompiler.addMatchFactory(new UtilsUnaryMatchFactory()); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java
r28028 r29769 2 2 package org.openstreetmap.josm.plugins.utilsplugin2.actions; 3 3 4 import java.awt.MouseInfo;5 4 import java.awt.Point; 6 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
r28028 r29769 24 24 } 25 25 26 @Override 26 27 public void actionPerformed( ActionEvent e ) { 27 28 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java
r28028 r29769 30 30 } 31 31 32 @Override 32 33 public void actionPerformed( ActionEvent e ) { 33 34 List<Command> list = new ArrayList<Command>(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java
r28028 r29769 40 40 } 41 41 42 @Override 42 43 public void actionPerformed(ActionEvent e) { 43 44 Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java
r29672 r29769 28 28 } 29 29 30 @Override 30 31 public void actionPerformed( ActionEvent e ) { 31 32 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java
r28028 r29769 29 29 } 30 30 31 @Override 31 32 public void actionPerformed( ActionEvent e ) { 32 33 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java
r29391 r29769 46 46 * Called when the action is executed. 47 47 */ 48 @Override 48 49 public void actionPerformed(ActionEvent e) { 49 50 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java
r28028 r29769 2 2 3 3 import java.awt.GridBagLayout; 4 import java.awt.event.ItemEvent;5 4 import java.util.List; 6 import java.util.logging.Level;7 import java.util.logging.Logger;8 import javax.swing.JComboBox;9 5 import javax.swing.JPanel; 10 6 import javax.swing.event.ListSelectionEvent; … … 13 9 import org.openstreetmap.josm.Main; 14 10 import java.awt.event.ActionEvent; 15 import java.awt.event.ItemListener;16 import java.awt.event.KeyEvent;17 11 import javax.swing.JCheckBox; 18 12 import javax.swing.JLabel; … … 22 16 import javax.swing.event.ListSelectionListener; 23 17 import org.openstreetmap.josm.actions.JosmAction; 24 import org.openstreetmap.josm.gui.SelectionManager;25 18 import static org.openstreetmap.josm.tools.I18n.tr; 26 19 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java
r28028 r29769 40 40 } 41 41 42 @Override 42 43 public void actionPerformed(ActionEvent e) { 43 44 Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); … … 62 63 try { 63 64 while (m.find()) { 64 key=m.group(1); val=null; 65 if (key.equals("#id")) { 66 if (p!=null) val=Long.toString(p.getId()); ; 67 } else if (key.equals("#type")) { 68 if (p!=null) val = OsmPrimitiveType.from(p).getAPIName(); ; 69 } else if (key.equals("#lat")) { 70 val = Double.toString(center.lat()); 71 } else if (key.equals("#lon")) { 72 val = Double.toString(center.lon()); 65 key=m.group(1); val=null; 66 if (key.equals("#id")) { 67 if (p!=null) val=Long.toString(p.getId()); 68 } else if (key.equals("#type")) { 69 if (p!=null) val = OsmPrimitiveType.from(p).getAPIName(); 70 } else if (key.equals("#lat")) { 71 val = Double.toString(center.lat()); 72 } else if (key.equals("#lon")) { 73 val = Double.toString(center.lon()); 74 } 75 else { 76 if (p!=null) { 77 val =p.get(key); 78 if (val!=null) val =URLEncoder.encode(p.get(key), "UTF-8"); else return; 73 79 } 74 else { 75 if (p!=null) { 76 val =p.get(key); 77 if (val!=null) val =URLEncoder.encode(p.get(key), "UTF-8"); else return; 78 } 79 } 80 keys[i]=m.group(); 81 if (val!=null) vals[i]=val; 82 else vals[i]=""; 83 i++; 80 } 81 keys[i]=m.group(); 82 if (val!=null) vals[i]=val; 83 else vals[i]=""; 84 i++; 84 85 } 85 86 } catch (UnsupportedEncodingException ex) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/UtilsPluginPreferences.java
r28523 r29769 48 48 resetButton = new JButton(tr("Reset")); 49 49 resetButton.addActionListener(new ActionListener() { 50 @Override 50 51 public void actionPerformed(ActionEvent e) { 51 52 fillRows(URLList.resetURLList()); … … 55 56 saveButton = new JButton(tr("Save to file")); 56 57 saveButton.addActionListener(new ActionListener() { 58 @Override 57 59 public void actionPerformed(ActionEvent e) { 58 60 URLList.saveURLList(readItemsFromTable()); … … 62 64 loadButton = new JButton(tr("Load from file")); 63 65 loadButton.addActionListener(new ActionListener() { 66 @Override 64 67 public void actionPerformed(ActionEvent e) { 65 68 fillRows(URLList.loadURLList()); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java
r28028 r29769 35 35 } 36 36 37 @Override 37 38 public void actionPerformed(ActionEvent e) { 38 39 if (!isEnabled()) -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java
r28028 r29769 7 7 import java.awt.Component; 8 8 import java.awt.GridBagLayout; 9 import java.awt.event.ActionEvent;10 9 import java.awt.event.FocusEvent; 11 10 import java.awt.event.FocusListener; 12 import java.awt.event.WindowAdapter;13 import java.awt.event.WindowEvent;14 11 import java.text.NumberFormat; 15 12 import java.text.ParsePosition; … … 20 17 import java.util.regex.Pattern; 21 18 22 import javax.swing.AbstractAction;23 19 import javax.swing.BorderFactory; 24 20 import javax.swing.JLabel; … … 27 23 import javax.swing.JTabbedPane; 28 24 29 import javax.swing.text.Document;30 25 import javax.swing.JTextArea; 31 26 import javax.swing.JScrollPane; … … 45 40 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 46 41 import org.openstreetmap.josm.tools.GBC; 47 import org.openstreetmap.josm.tools.ImageProvider;48 42 import org.openstreetmap.josm.tools.WindowGeometry; 49 43 … … 288 282 289 283 class LatLonInputVerifier implements DocumentListener { 290 public void changedUpdate(DocumentEvent e) { 284 @Override public void changedUpdate(DocumentEvent e) { 291 285 parseLatLonUserInput(); 292 286 } 293 287 294 public void insertUpdate(DocumentEvent e) { 288 @Override public void insertUpdate(DocumentEvent e) { 295 289 parseLatLonUserInput(); 296 290 } 297 291 298 public void removeUpdate(DocumentEvent e) { 292 @Override public void removeUpdate(DocumentEvent e) { 299 293 parseLatLonUserInput(); 300 294 } … … 302 296 303 297 static class TextFieldFocusHandler implements FocusListener { 298 @Override 304 299 public void focusGained(FocusEvent e) { 305 300 Component c = e.getComponent(); … … 309 304 } 310 305 } 306 @Override 311 307 public void focusLost(FocusEvent e) {} 312 308 } … … 448 444 449 445 private class CoordinateListener implements DocumentListener { 450 public void changedUpdate(DocumentEvent e) { 446 @Override public void changedUpdate(DocumentEvent e) { 451 447 //not fired 452 448 } 453 public void insertUpdate(DocumentEvent e) { 449 @Override public void insertUpdate(DocumentEvent e) { 454 450 updateButtons(); 455 451 } 456 public void removeUpdate(DocumentEvent e) { 452 @Override public void removeUpdate(DocumentEvent e) { 457 453 updateButtons(); 458 454 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentNodesAction.java
r28028 r29769 31 31 private Set<Way> activeWays = new HashSet<Way>(); 32 32 33 @Override 33 34 public void actionPerformed(ActionEvent e) { 34 35 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/AdjacentWaysAction.java
r28028 r29769 30 30 } 31 31 32 @Override 32 33 public void actionPerformed(ActionEvent e) { 33 34 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/ConnectedWaysAction.java
r28028 r29769 27 27 } 28 28 29 @Override 29 30 public void actionPerformed(ActionEvent e) { 30 31 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysAction.java
r28028 r29769 29 29 } 30 30 31 @Override 31 32 public void actionPerformed(ActionEvent e) { 32 33 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/IntersectedWaysRecursiveAction.java
r28028 r29769 30 30 } 31 31 32 @Override 32 33 public void actionPerformed(ActionEvent e) { 33 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();34 34 35 35 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class); … … 41 41 selectedWays, newWays); 42 42 getCurrentDataSet().addSelected(newWays); 43 return;44 43 } else { 45 44 JOptionPane.showMessageDialog(Main.parent, -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/MiddleNodesAction.java
r28028 r29769 33 33 private Set<Way> activeWays = new HashSet<Way>(); 34 34 35 @Override 35 36 public void actionPerformed(ActionEvent e) { 36 37 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 37 38 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 38 39 39 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class);40 41 40 // if no 2 nodes and no ways are selected, do nothing 42 41 if (selectedNodes.size() != 2) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
r28222 r29769 181 181 182 182 public static void addWaysIntersectingWaysRecursively 183 (Collection<Way> allWays, Collection<Way> initWays, Set<Way> newWays) 184 { 183 (Collection<Way> allWays, Collection<Way> initWays, Set<Way> newWays) { 185 184 Set<Way> foundWays = new HashSet<Way>(); 186 185 foundWays.addAll(initWays); 187 186 newWays.addAll(initWays); 188 Set<Way> newFoundWays = new HashSet<Way>();187 Set<Way> newFoundWays; 189 188 190 189 int level=0,c; … … 207 206 } 208 207 } while ( c >0 && level < maxLevel ); 209 return;210 208 } 211 209 … … 234 232 } while ( c >0 && level < maxLevel ); 235 233 // System.out.println("time = "+(System.currentTimeMillis()-t)+" ways = "+newWays.size()); 236 return;237 234 } 238 235 … … 269 266 } 270 267 } 271 if (newNodes. size()==0) {268 if (newNodes.isEmpty()) { 272 269 JOptionPane.showMessageDialog(Main.parent, 273 270 tr("Please select two nodes connected by way!"), -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectAllInsideAction.java
r28028 r29769 8 8 import java.awt.event.KeyEvent; 9 9 import java.util.Collection; 10 import java.util.HashSet;11 import java.util.Set;12 10 13 11 import javax.swing.JOptionPane; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectBoundaryAction.java
r28028 r29769 19 19 import org.openstreetmap.josm.Main; 20 20 import org.openstreetmap.josm.actions.JosmAction; 21 import org.openstreetmap.josm.data.coor.EastNorth;22 21 import org.openstreetmap.josm.data.osm.Node; 23 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 40 39 } 41 40 41 @Override 42 42 public void actionPerformed(ActionEvent e) { 43 long t=System.currentTimeMillis(); 43 //long t=System.currentTimeMillis(); 44 44 Set<Way> selectedWays = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Way.class); 45 45 Set<Node> selectedNodes = OsmPrimitive.getFilteredSet(getCurrentDataSet().getSelected(), Node.class); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java
r28028 r29769 32 32 } 33 33 34 @Override 34 35 public void actionPerformed(ActionEvent e) { 35 36 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java
r28028 r29769 32 32 } 33 33 34 @Override 34 35 public void actionPerformed(ActionEvent e) { 35 36 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectWayNodesAction.java
r28028 r29769 40 40 * This method does some checking on the selection and calls the matching selectWayNodes method. 41 41 */ 42 @Override 42 43 public void actionPerformed(ActionEvent e) { 43 44 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UndoSelectionAction.java
r28028 r29769 10 10 import java.util.HashSet; 11 11 import java.util.LinkedList; 12 import java.util.List;13 12 import java.util.Set; 14 import org.openstreetmap.josm.Main;15 13 import org.openstreetmap.josm.actions.JosmAction; 16 14 import org.openstreetmap.josm.data.osm.*; … … 34 32 private Collection<OsmPrimitive> lastSel; 35 33 private int index; 34 @Override 36 35 public void actionPerformed(ActionEvent e) { 37 LinkedList<Collection<? extends OsmPrimitive>>history 36 LinkedList<Collection<? extends OsmPrimitive>> history 38 37 = getCurrentDataSet().getSelectionHistory(); 38 if (history==null || history.isEmpty()) return; // empty history 39 39 int num=history.size(); 40 if (history==null || num==0) return; // empty history41 40 42 41 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/UnselectNodesAction.java
r28028 r29769 28 28 } 29 29 30 @Override 30 31 public void actionPerformed(ActionEvent e) { 31 32 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
Note:
See TracChangeset
for help on using the changeset viewer.