Changeset 34454 in osm for applications/editors/josm/plugins
- Timestamp:
- 2018-08-13T22:15:59+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2
- Files:
-
- 1 added
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/.classpath
r32680 r34454 2 2 <classpath> 3 3 <classpathentry kind="src" path="src"/> 4 <classpathentry kind="src" path="test/unit"/> 4 <classpathentry kind="src" output="bintest" path="test/unit"> 5 <attributes> 6 <attribute name="test" value="true"/> 7 </attributes> 8 </classpathentry> 5 9 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> 6 10 <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/> -
applications/editors/josm/plugins/utilsplugin2/build.xml
r34286 r34454 5 5 <property name="commit.message" value="[josm_utilsplugin2]: select boundary by double-click; multitagger table highlights"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 3922"/>7 <property name="plugin.main.version" value="14153"/> 8 8 9 9 <property name="plugin.author" value="Kalle Lampila, Upliner, Zverik, akks, joshdoe and others"/> -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java
r33579 r34454 48 48 import org.openstreetmap.josm.plugins.utilsplugin2.selection.UnselectNodesAction; 49 49 50 /** 51 * Collection of utilities 52 */ 50 53 public class UtilsPlugin2 extends Plugin { 51 54 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AddIntersectionsAction.java
r33579 r34454 19 19 import org.openstreetmap.josm.command.Command; 20 20 import org.openstreetmap.josm.command.SequenceCommand; 21 import org.openstreetmap.josm.data.UndoRedoHandler; 21 22 import org.openstreetmap.josm.data.osm.Node; 22 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 24 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.MainApplication;25 25 import org.openstreetmap.josm.gui.Notification; 26 26 import org.openstreetmap.josm.tools.Geometry; 27 27 import org.openstreetmap.josm.tools.Shortcut; 28 28 29 /** 30 * Add missing nodes at intersections of selected ways. 31 */ 29 32 public class AddIntersectionsAction extends JosmAction { 30 33 … … 56 59 Geometry.addIntersections(ways, false, cmds); 57 60 if (!cmds.isEmpty()) { 58 MainApplication.undoRedo.add(new SequenceCommand(tr("Add nodes at intersections"), cmds));61 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Add nodes at intersections"), cmds)); 59 62 Set<Node> nodes = new HashSet<>(10); 60 63 // find and select newly added nodes -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AlignWayNodesAction.java
r33579 r34454 19 19 import org.openstreetmap.josm.command.MoveCommand; 20 20 import org.openstreetmap.josm.command.SequenceCommand; 21 import org.openstreetmap.josm.data.UndoRedoHandler; 21 22 import org.openstreetmap.josm.data.osm.Node; 22 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 24 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.MainApplication;25 25 import org.openstreetmap.josm.gui.Notification; 26 26 import org.openstreetmap.josm.tools.Shortcut; … … 128 128 129 129 if (!commands.isEmpty()) 130 MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));130 UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands)); 131 131 } 132 132 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java
r32725 r34454 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.actions.JosmAction; 18 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 18 import org.openstreetmap.josm.data.osm.Tag; 19 import org.openstreetmap.josm.gui.MainApplication; 20 20 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 21 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 81 81 if (sel.isEmpty()) { 82 82 JOptionPane.showMessageDialog( 83 Main .parent,83 MainApplication.getMainFrame(), 84 84 tr("Please select something to copy."), 85 85 tr("Information"), -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java
r33676 r34454 20 20 import org.openstreetmap.josm.command.MoveCommand; 21 21 import org.openstreetmap.josm.command.SequenceCommand; 22 import org.openstreetmap.josm.data.UndoRedoHandler; 22 23 import org.openstreetmap.josm.data.osm.DataSet; 23 24 import org.openstreetmap.josm.data.osm.Node; … … 73 74 } 74 75 } 75 if (cmds.size() > 1) MainApplication.undoRedo.add(new SequenceCommand(tr("Extract node from line"), cmds));76 if (cmds.size() > 1) UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Extract node from line"), cmds)); 76 77 } 77 78 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
r33579 r34454 15 15 import java.util.Map; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.actions.JosmAction; 19 18 import org.openstreetmap.josm.command.ChangeCommand; 20 19 import org.openstreetmap.josm.command.Command; 21 20 import org.openstreetmap.josm.command.SequenceCommand; 21 import org.openstreetmap.josm.data.UndoRedoHandler; 22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 23 import org.openstreetmap.josm.data.osm.PrimitiveData; 24 24 import org.openstreetmap.josm.data.osm.Relation; 25 25 import org.openstreetmap.josm.data.osm.RelationMember; 26 import org.openstreetmap.josm.gui.MainApplication;27 26 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 28 27 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; … … 101 100 102 101 if (!commands.isEmpty()) 103 MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));102 UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands)); 104 103 } 105 104 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java
r33676 r34454 21 21 import org.openstreetmap.josm.command.DeleteCommand; 22 22 import org.openstreetmap.josm.command.SplitWayCommand; 23 import org.openstreetmap.josm.data.UndoRedoHandler; 23 24 import org.openstreetmap.josm.data.osm.Node; 24 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; 25 26 import org.openstreetmap.josm.data.osm.Way; 26 import org.openstreetmap.josm.gui.MainApplication;27 27 import org.openstreetmap.josm.gui.Notification; 28 28 import org.openstreetmap.josm.tools.Shortcut; … … 210 210 SplitWayCommand result = SplitWayCommand.splitWay( 211 211 selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList()); 212 MainApplication.undoRedo.add(result);212 UndoRedoHandler.getInstance().add(result); 213 213 if (splitWay != null) 214 MainApplication.undoRedo.add(new DeleteCommand(splitWay));214 UndoRedoHandler.getInstance().add(new DeleteCommand(splitWay)); 215 215 getLayerManager().getEditDataSet().setSelected(result.getNewSelection()); 216 216 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java
r33676 r34454 19 19 import org.openstreetmap.josm.command.SequenceCommand; 20 20 import org.openstreetmap.josm.command.SplitWayCommand; 21 import org.openstreetmap.josm.data.UndoRedoHandler; 21 22 import org.openstreetmap.josm.data.osm.Node; 22 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 24 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.MainApplication;25 25 import org.openstreetmap.josm.gui.Notification; 26 26 import org.openstreetmap.josm.tools.Shortcut; … … 92 92 93 93 if (!list.isEmpty()) { 94 MainApplication.undoRedo.add(list.size() == 1 ? list.get(0) : new SequenceCommand(TITLE, list));94 UndoRedoHandler.getInstance().add(list.size() == 1 ? list.get(0) : new SequenceCommand(TITLE, list)); 95 95 getLayerManager().getEditDataSet().clearSelection(); 96 96 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java
r33579 r34454 13 13 import javax.swing.JOptionPane; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.actions.JosmAction; 17 16 import org.openstreetmap.josm.command.Command; 18 17 import org.openstreetmap.josm.command.MoveCommand; 19 18 import org.openstreetmap.josm.command.SequenceCommand; 19 import org.openstreetmap.josm.data.UndoRedoHandler; 20 20 import org.openstreetmap.josm.data.coor.EastNorth; 21 21 import org.openstreetmap.josm.data.osm.Node; … … 88 88 } 89 89 90 MainApplication.undoRedo.add(new SequenceCommand(tr("Symmetry"), cmds));90 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Symmetry"), cmds)); 91 91 MainApplication.getMap().repaint(); 92 92 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java
r33579 r34454 19 19 import org.openstreetmap.josm.command.Command; 20 20 import org.openstreetmap.josm.command.SequenceCommand; 21 import org.openstreetmap.josm.data.UndoRedoHandler; 21 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 import org.openstreetmap.josm.gui.MainApplication;23 23 import org.openstreetmap.josm.tools.Shortcut; 24 24 import org.openstreetmap.josm.tools.SubclassFilteredCollection; … … 69 69 70 70 if (!commands.isEmpty()) 71 MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));71 UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands)); 72 72 } 73 73 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java
r33579 r34454 10 10 import java.util.Set; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.JosmAction; 14 13 import org.openstreetmap.josm.command.ChangePropertyCommand; 14 import org.openstreetmap.josm.data.UndoRedoHandler; 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 import org.openstreetmap.josm. gui.MainApplication;16 import org.openstreetmap.josm.spi.preferences.Config; 17 17 import org.openstreetmap.josm.tools.Shortcut; 18 18 … … 32 32 Shortcut.registerShortcut("tools:sourcetag", tr("Tool: {0}", tr("Add Source Tag")), KeyEvent.VK_S, Shortcut.ALT_CTRL), 33 33 true, false); 34 source = Main.pref.get("sourcetag.value");34 source = Config.getPref().get("sourcetag.value"); 35 35 // The fields are not initialized while the super constructor is running, so we have to call this afterwards: 36 36 installAdapters(); … … 43 43 return; 44 44 45 MainApplication.undoRedo.add(new ChangePropertyCommand(selection, "source", source));45 UndoRedoHandler.getInstance().add(new ChangePropertyCommand(selection, "source", source)); 46 46 } 47 47 … … 82 82 if (newSource != null && newSource.length() > 0 && !newSource.equals(source)) { 83 83 source = newSource; 84 Main.pref.put("sourcetag.value", source);84 Config.getPref().put("sourcetag.value", source); 85 85 } 86 86 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java
r33676 r34454 15 15 import org.openstreetmap.josm.command.Command; 16 16 import org.openstreetmap.josm.command.SequenceCommand; 17 import org.openstreetmap.josm.data.UndoRedoHandler; 17 18 import org.openstreetmap.josm.data.osm.DataSet; 18 19 import org.openstreetmap.josm.data.osm.Node; … … 81 82 // error message nothing to do 82 83 } else { 83 MainApplication.undoRedo.add(new SequenceCommand(tr("Unglued Relations"), cmds));84 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Unglued Relations"), cmds)); 84 85 //Set selection all primiteves (new and old) 85 86 newPrimitives.addAll(selection); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java
r33677 r34454 24 24 import org.openstreetmap.josm.gui.MainApplication; 25 25 26 /** 27 * Create a circle arc 28 */ 26 29 public final class CircleArcMaker { 27 30 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java
r33676 r34454 11 11 import java.util.List; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.JosmAction; 15 14 import org.openstreetmap.josm.command.Command; 16 15 import org.openstreetmap.josm.command.SequenceCommand; 16 import org.openstreetmap.josm.data.UndoRedoHandler; 17 17 import org.openstreetmap.josm.data.osm.Node; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 19 import org.openstreetmap.josm.data.osm.Way; 20 import org.openstreetmap.josm. gui.MainApplication;20 import org.openstreetmap.josm.spi.preferences.Config; 21 21 import org.openstreetmap.josm.tools.Shortcut; 22 22 23 23 // TODO: investigate splines 24 24 25 /** 26 * Create a circle arc 27 */ 25 28 public class CurveAction extends JosmAction { 26 29 … … 39 42 private void updatePreferences() { 40 43 // @formatter:off 41 angleSeparation = Main.pref.getInt(prefKey("circlearc.angle-separation"), 20);44 angleSeparation = Config.getPref().getInt(prefKey("circlearc.angle-separation"), 20); 42 45 // @formatter:on 43 46 } … … 59 62 Collection<Command> cmds = CircleArcMaker.doCircleArc(selectedNodes, selectedWays, angleSeparation); 60 63 if (cmds != null) 61 MainApplication.undoRedo.add(new SequenceCommand("Create a curve", cmds));64 UndoRedoHandler.getInstance().add(new SequenceCommand("Create a curve", cmds)); 62 65 } 63 66 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java
r34221 r34454 17 17 import javax.swing.event.ListSelectionListener; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.actions.JosmAction; 21 20 import org.openstreetmap.josm.gui.ExtendedDialog; 21 import org.openstreetmap.josm.gui.MainApplication; 22 import org.openstreetmap.josm.spi.preferences.Config; 22 23 import org.openstreetmap.josm.tools.GBC; 23 24 25 /** 26 * Select custom URL 27 */ 24 28 public class ChooseURLAction extends JosmAction { 25 29 … … 56 60 final JCheckBox check1 = new JCheckBox(tr("Ask every time")); 57 61 58 final ExtendedDialog dialog = new ExtendedDialog(Main .parent,62 final ExtendedDialog dialog = new ExtendedDialog(MainApplication.getMainFrame(), 59 63 tr("Configure custom URL"), 60 64 new String[] {tr("OK"), tr("Cancel")} … … 69 73 }); 70 74 list1.setSelectedIndex(idxToSelect); 71 check1.setSelected( Main.pref.getBoolean("utilsplugin2.askurl", false));75 check1.setSelected(Config.getPref().getBoolean("utilsplugin2.askurl", false)); 72 76 73 77 editField.setEditable(false); … … 87 91 if (ret == 1 && idx >= 0) { 88 92 URLList.select(vals[idx]); 89 Main.pref.putBoolean("utilsplugin2.askurl", check1.isSelected());93 Config.getPref().putBoolean("utilsplugin2.askurl", check1.isSelected()); 90 94 } 91 95 return ret; -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java
r34221 r34454 13 13 import java.util.regex.Pattern; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.actions.JosmAction; 17 16 import org.openstreetmap.josm.data.coor.LatLon; … … 20 19 import org.openstreetmap.josm.gui.MainApplication; 21 20 import org.openstreetmap.josm.gui.MapView; 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 import org.openstreetmap.josm.tools.Logging; 23 23 import org.openstreetmap.josm.tools.OpenBrowser; … … 50 50 } 51 51 52 if ( Main.pref.getBoolean("utilsplugin2.askurl", false) && 1 != ChooseURLAction.showConfigDialog(true)) {52 if (Config.getPref().getBoolean("utilsplugin2.askurl", false) && 1 != ChooseURLAction.showConfigDialog(true)) { 53 53 return; 54 54 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java
r33742 r34454 13 13 import java.util.logging.Logger; 14 14 15 import org.openstreetmap.josm. Main;15 import org.openstreetmap.josm.data.Preferences; 16 16 import org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2; 17 import org.openstreetmap.josm.spi.preferences.Config; 17 18 import org.openstreetmap.josm.tools.Logging; 18 19 20 /** 21 * List of custom URLs 22 */ 19 23 public final class URLList { 20 24 public static final String defaultURL = "http://osm.mapki.com/history/{#type}.php?id={#id}"; … … 26 30 public static String getSelectedURL() { 27 31 getURLList(); 28 return Main.pref.get("utilsplugin2.customurl", defaultURL);32 return Config.getPref().get("utilsplugin2.customurl", defaultURL); 29 33 } 30 34 31 35 public static void select(String url) { 32 Main.pref.put("utilsplugin2.customurl", url);36 Config.getPref().put("utilsplugin2.customurl", url); 33 37 } 34 38 … … 47 51 items.add("Browse element [demo, =Ctrl-Shift-I]"); 48 52 items.add("https://www.openstreetmap.org/{#type}/{#id}"); 49 Main.pref.putList("utilsplugin2.urlHistory", items);50 Main.pref.put("utilsplugin2.customurl", items.get(9));53 Config.getPref().putList("utilsplugin2.urlHistory", items); 54 Config.getPref().put("utilsplugin2.customurl", items.get(9)); 51 55 return items; 52 56 } 53 57 54 58 public static List<String> getURLList() { 55 List<String> items = Main.pref.getList("utilsplugin2.urlHistory");59 List<String> items = Config.getPref().getList("utilsplugin2.urlHistory"); 56 60 if (items == null || items.isEmpty()) { 57 61 resetURLList(); 58 items = Main.pref.getList("utilsplugin2.urlHistory");62 items = Config.getPref().getList("utilsplugin2.urlHistory"); 59 63 } 60 64 return items; … … 62 66 63 67 public static void updateURLList(List<String> lst) { 64 Main.pref.putList("utilsplugin2.urlHistory", lst);68 Config.getPref().putList("utilsplugin2.urlHistory", lst); 65 69 try { 66 Main.pref.save();70 Preferences.main().save(); 67 71 } catch (IOException ex) { 68 72 Logger.getLogger(UtilsPluginPreferences.class.getName()).log(Level.SEVERE, null, ex); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/UtilsPluginPreferences.java
r32410 r34454 26 26 import org.openstreetmap.josm.tools.GBC; 27 27 28 /** 29 * Preferences of Utilsplugin2 functions 30 */ 28 31 public class UtilsPluginPreferences extends DefaultTabPreferenceSetting { 29 32 HistoryComboBox combo1 = new HistoryComboBox(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java
r33676 r34454 10 10 import java.util.LinkedList; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.JosmAction; 14 13 import org.openstreetmap.josm.command.AddCommand; 15 14 import org.openstreetmap.josm.command.Command; 16 15 import org.openstreetmap.josm.command.SequenceCommand; 16 import org.openstreetmap.josm.data.UndoRedoHandler; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 18 import org.openstreetmap.josm.data.osm.DataSet; … … 41 41 return; 42 42 43 LatLonDialog dialog = new LatLonDialog(Main .parent, tr("Add Node..."), ht("/Action/AddNode"));43 LatLonDialog dialog = new LatLonDialog(MainApplication.getMainFrame(), tr("Add Node..."), ht("/Action/AddNode")); 44 44 45 45 if (textLatLon != null) { … … 83 83 cmds.add(new AddCommand(ds, wnew)); 84 84 } 85 MainApplication.undoRedo.add(new SequenceCommand(tr("Lat Lon tool"), cmds));85 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Lat Lon tool"), cmds)); 86 86 MainApplication.getMap().mapView.repaint(); 87 87 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java
r33676 r34454 32 32 import javax.swing.event.DocumentListener; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.data.coor.LatLon; 36 35 import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager; … … 38 37 import org.openstreetmap.josm.data.coor.conversion.LatLonParser; 39 38 import org.openstreetmap.josm.gui.ExtendedDialog; 39 import org.openstreetmap.josm.gui.MainApplication; 40 40 import org.openstreetmap.josm.gui.util.WindowGeometry; 41 41 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 42 42 import org.openstreetmap.josm.tools.GBC; 43 43 44 /** 45 * Dialog for entering lat/lon coordinates. 46 */ 44 47 public class LatLonDialog extends ExtendedDialog { 45 48 private static final Color BG_COLOR_ERROR = new Color(255, 224, 224); … … 167 170 168 171 public LatLonDialog(Component parent, String title, String help) { 169 super(Main .parent, tr("Add Node..."), new String[] {tr("Ok"), tr("Cancel")});172 super(MainApplication.getMainFrame(), tr("Add Node..."), new String[] {tr("Ok"), tr("Cancel")}); 170 173 setButtonIcons(new String[] {"ok", "cancel"}); 171 174 configureContextsensitiveHelp("/Action/AddNode", true); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagAction.java
r32410 r34454 13 13 import org.openstreetmap.josm.tools.Shortcut; 14 14 15 /** 16 * Edit tags of object list in table 17 */ 15 18 public final class MultiTagAction extends JosmAction { 16 19 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java
r33742 r34454 40 40 import javax.swing.table.DefaultTableCellRenderer; 41 41 42 import org.openstreetmap.josm.Main;43 42 import org.openstreetmap.josm.actions.AutoScaleAction; 44 43 import org.openstreetmap.josm.actions.search.SearchAction; … … 59 58 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 60 59 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 60 import org.openstreetmap.josm.spi.preferences.Config; 61 61 import org.openstreetmap.josm.tools.GBC; 62 62 import org.openstreetmap.josm.tools.ImageProvider; … … 81 81 82 82 public MultiTagDialog() { 83 super(Main .parent, tr("Edit tags"), new String[]{tr("Ok"), tr("Cancel")}, false);83 super(MainApplication.getMainFrame(), tr("Edit tags"), new String[]{tr("Ok"), tr("Cancel")}, false); 84 84 JPanel pnl = new JPanel(new GridBagLayout()); 85 85 tbl = createTable(); … … 112 112 loadHistory(); 113 113 114 WindowGeometry defaultGeometry = WindowGeometry.centerInWindow(Main .parent, new Dimension(500, 500));114 WindowGeometry defaultGeometry = WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(500, 500)); 115 115 setRememberWindowGeometry(getClass().getName() + ".geometry", defaultGeometry); 116 116 } … … 151 151 private void loadHistory() { 152 152 List<String> cmtHistory = new LinkedList<>( 153 Main.pref.getList(HISTORY_KEY, Arrays.asList(defaultHistory)));153 Config.getPref().getList(HISTORY_KEY, Arrays.asList(defaultHistory))); 154 154 Collections.reverse(cmtHistory); 155 155 cbTagSet.setPossibleItems(cmtHistory); … … 303 303 history = Arrays.asList(defaultHistory); 304 304 } 305 Main.pref.putList(HISTORY_KEY, history);305 Config.getPref().putList(HISTORY_KEY, history); 306 306 loadHistory(); 307 307 } … … 336 336 oldTags = s; 337 337 cbTagSet.addCurrentItemToHistory(); 338 Main.pref.putList(HISTORY_KEY, cbTagSet.getHistory());338 Config.getPref().putList(HISTORY_KEY, cbTagSet.getHistory()); 339 339 specifyTagSet(s); 340 340 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java
r33579 r34454 16 16 import org.openstreetmap.josm.command.SequenceCommand; 17 17 import org.openstreetmap.josm.data.SelectionChangedListener; 18 import org.openstreetmap.josm.data.UndoRedoHandler; 18 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 20 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 22 23 import org.openstreetmap.josm.tools.Geometry; 23 24 25 /** 26 * Model of the multi tag table. 27 */ 24 28 public class MultiTaggerTableModel extends AbstractTableModel implements SelectionChangedListener { 25 29 … … 115 119 Command cmd = new ChangePropertyCommand(sel, key, (String) value); 116 120 if (autoCommit) { 117 MainApplication.undoRedo.add(cmd);121 UndoRedoHandler.getInstance().add(cmd); 118 122 } else { 119 123 cmds.add(cmd); … … 185 189 186 190 void commit(String commandTitle) { 187 MainApplication.undoRedo.add(new SequenceCommand(commandTitle, cmds));191 UndoRedoHandler.getInstance().add(new SequenceCommand(commandTitle, cmds)); 188 192 cmds.clear(); 189 193 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryAction.java
r33579 r34454 13 13 14 14 import org.openstreetmap.josm.actions.JosmAction; 15 import org.openstreetmap.josm.data.UndoRedoHandler; 15 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 import org.openstreetmap.josm.gui.MainApplication;17 17 import org.openstreetmap.josm.gui.Notification; 18 18 import org.openstreetmap.josm.tools.Shortcut; … … 58 58 return; 59 59 60 MainApplication.undoRedo.add(replaceCommand);60 UndoRedoHandler.getInstance().add(replaceCommand); 61 61 } catch (IllegalArgumentException ex) { 62 62 new Notification( -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryException.java
r32410 r34454 3 3 4 4 /** 5 * 5 * Exception thrown when replace geometry fails. 6 6 * @author joshdoe 7 7 */ -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java
r33704 r34454 18 18 import javax.swing.JOptionPane; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.actions.MergeNodesAction; 22 21 import org.openstreetmap.josm.command.ChangeNodesCommand; … … 36 35 import org.openstreetmap.josm.gui.Notification; 37 36 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; 37 import org.openstreetmap.josm.spi.preferences.Config; 38 38 import org.openstreetmap.josm.tools.Logging; 39 39 import org.openstreetmap.josm.tools.UserCancelException; … … 42 42 43 43 /** 44 * 44 * Utilities for Replace Geometry 45 45 * @author joshdoe 46 46 */ … … 276 276 int nLen = nodePool.size(); 277 277 int N = Math.max(gLen, nLen); 278 boolean useRobust = Main.pref.getBoolean("utilsplugin2.replace-geometry.robustAssignment", true)279 && N <= Main.pref.getInt("utilsplugin2.replace-geometry.robustAssignment.max-size", 300);278 boolean useRobust = Config.getPref().getBoolean("utilsplugin2.replace-geometry.robustAssignment", true) 279 && N <= Config.getPref().getInt("utilsplugin2.replace-geometry.robustAssignment.max-size", 300); 280 280 281 281 // Find new nodes that are closest to the old ones, remove matching old ones from the pool … … 291 291 } 292 292 293 double maxDistance = Double.parseDouble( Main.pref.get("utilsplugin2.replace-geometry.max-distance", "1"));293 double maxDistance = Double.parseDouble(Config.getPref().get("utilsplugin2.replace-geometry.max-distance", "1")); 294 294 for (int i = 0; i < nLen; i++) { 295 295 for (int j = 0; j < gLen; j++) { … … 468 468 Node nearest = null; 469 469 // TODO: use meters instead of degrees, but do it fast 470 double distance = Double.parseDouble( Main.pref.get("utilsplugin2.replace-geometry.max-distance", "1"));470 double distance = Double.parseDouble(Config.getPref().get("utilsplugin2.replace-geometry.max-distance", "1")); 471 471 LatLon coor = node.getCoor(); 472 472 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceMembershipAction.java
r34263 r34454 18 18 import org.openstreetmap.josm.command.ChangeCommand; 19 19 import org.openstreetmap.josm.command.Command; 20 import org.openstreetmap.josm.data.UndoRedoHandler; 20 21 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 21 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 23 24 import org.openstreetmap.josm.data.osm.RelationMember; 24 25 import org.openstreetmap.josm.data.osm.RelationToChildReference; 25 import org.openstreetmap.josm.gui.MainApplication;26 26 import org.openstreetmap.josm.gui.Notification; 27 27 import org.openstreetmap.josm.tools.MultiMap; 28 28 29 /** 30 * In relations where the selected object is member of, replace it with a new one 31 */ 29 32 public class ReplaceMembershipAction extends JosmAction { 30 33 … … 45 48 final int affectedRelations = command != null ? command.getChildren().size() : 0; 46 49 if (affectedRelations > 0) { 47 MainApplication.undoRedo.add(command);50 UndoRedoHandler.getInstance().add(command); 48 51 new Notification(trn("Replaced ''{0}'' by ''{1}'' in {2} relation", "Replaced ''{0}'' by ''{1}'' in {2} relations", 49 52 affectedRelations, -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java
r33522 r34454 7 7 import org.openstreetmap.josm.data.osm.Relation; 8 8 import org.openstreetmap.josm.data.osm.Way; 9 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 9 10 import org.openstreetmap.josm.data.osm.search.SearchParseError; 10 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;11 11 12 12 /** -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java
r33579 r34454 67 67 } 68 68 69 @Override 70 public int hashCode() { 71 final int prime = 31; 72 int result = super.hashCode(); 73 result = prime * result + (all ? 1231 : 1237); 74 result = prime * result + ((connected == null) ? 0 : connected.hashCode()); 75 return result; 76 } 77 78 @Override 79 public boolean equals(Object obj) { 80 if (this == obj) 81 return true; 82 if (!super.equals(obj) || getClass() != obj.getClass()) 83 return false; 84 ConnectedMatch other = (ConnectedMatch) obj; 85 if (all != other.all) 86 return false; 87 if (connected == null) { 88 if (other.connected != null) 89 return false; 90 } else if (!connected.equals(other.connected)) 91 return false; 92 return true; 93 } 94 69 95 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/InsideMatch.java
r33579 r34454 51 51 return inside.contains(osm); 52 52 } 53 54 @Override 55 public int hashCode() { 56 return 31 * super.hashCode() + ((inside == null) ? 0 : inside.hashCode()); 57 } 58 59 @Override 60 public boolean equals(Object obj) { 61 if (this == obj) 62 return true; 63 if (!super.equals(obj) || getClass() != obj.getClass()) 64 return false; 65 InsideMatch other = (InsideMatch) obj; 66 if (inside == null) { 67 if (other.inside != null) 68 return false; 69 } else if (!inside.equals(other.inside)) 70 return false; 71 return true; 72 } 53 73 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java
r33579 r34454 57 57 } 58 58 59 @Override 60 public int hashCode() { 61 final int prime = 31; 62 int result = super.hashCode(); 63 result = prime * result + (all ? 1231 : 1237); 64 result = prime * result + ((intersecting == null) ? 0 : intersecting.hashCode()); 65 return result; 66 } 67 68 @Override 69 public boolean equals(Object obj) { 70 if (this == obj) 71 return true; 72 if (!super.equals(obj) || getClass() != obj.getClass()) 73 return false; 74 IntersectingMatch other = (IntersectingMatch) obj; 75 if (all != other.all) 76 return false; 77 if (intersecting == null) { 78 if (other.intersecting != null) 79 return false; 80 } else if (!intersecting.equals(other.intersecting)) 81 return false; 82 return true; 83 } 84 59 85 } -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java
r33522 r34454 5 5 6 6 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 7 8 import org.openstreetmap.josm.data.osm.search.SearchParseError; 8 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;9 9 10 10 /** -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java
r33522 r34454 40 40 return getString() + "=" + min + "-" + max; 41 41 } 42 43 @Override 44 public int hashCode() { 45 final int prime = 31; 46 int result = 1; 47 result = prime * result + (int) (max ^ (max >>> 32)); 48 result = prime * result + (int) (min ^ (min >>> 32)); 49 return result; 50 } 51 52 @Override 53 public boolean equals(Object obj) { 54 if (this == obj) 55 return true; 56 if (obj == null || getClass() != obj.getClass()) 57 return false; 58 RangeMatch other = (RangeMatch) obj; 59 if (max != other.max) 60 return false; 61 if (min != other.min) 62 return false; 63 return true; 64 } 42 65 } 43 66 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java
r33543 r34454 7 7 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 8 8 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 9 import org.openstreetmap.josm.data.osm.search.SearchCompiler.CoreSimpleMatchFactory; 9 10 import org.openstreetmap.josm.data.osm.search.SearchCompiler.SimpleMatchFactory; 10 11 import org.openstreetmap.josm.data.osm.search.SearchParseError; 11 12 13 /** 14 * Extension of the {@link CoreSimpleMatchFactory} 15 */ 12 16 public class UtilsSimpleMatchFactory implements SimpleMatchFactory { 13 17 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java
r33522 r34454 5 5 import java.util.Collection; 6 6 7 import org.openstreetmap.josm.data.osm.search.SearchParseError;8 7 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer; 9 8 import org.openstreetmap.josm.data.osm.search.SearchCompiler; 9 import org.openstreetmap.josm.data.osm.search.SearchCompiler.CoreUnaryMatchFactory; 10 import org.openstreetmap.josm.data.osm.search.SearchParseError; 10 11 12 /** 13 * Extension of the {@link CoreUnaryMatchFactory}. 14 */ 11 15 public class UtilsUnaryMatchFactory implements SearchCompiler.UnaryMatchFactory { 12 16 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
r33676 r34454 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.coor.EastNorth; 18 17 import org.openstreetmap.josm.data.osm.BBox; … … 23 22 import org.openstreetmap.josm.data.osm.Way; 24 23 import org.openstreetmap.josm.gui.Notification; 24 import org.openstreetmap.josm.spi.preferences.Config; 25 25 import org.openstreetmap.josm.tools.Geometry; 26 26 import org.openstreetmap.josm.tools.Pair; … … 32 32 public final class NodeWayUtils { 33 33 34 static final int maxLevel = Main.pref.getInt("selection.maxrecursion", 15);35 static final int maxWays = Main.pref.getInt("selection.maxfoundways", 2000);36 static final int maxWays1 = Main.pref.getInt("selection.maxfoundways.intersection", 500);34 static final int maxLevel = Config.getPref().getInt("selection.maxrecursion", 15); 35 static final int maxWays = Config.getPref().getInt("selection.maxfoundways", 2000); 36 static final int maxWays1 = Config.getPref().getInt("selection.maxfoundways.intersection", 500); 37 37 38 38 private NodeWayUtils() { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java
r33579 r34454 13 13 import org.openstreetmap.josm.actions.JosmAction; 14 14 import org.openstreetmap.josm.command.Command; 15 import org.openstreetmap.josm.data.UndoRedoHandler; 15 16 import org.openstreetmap.josm.data.osm.DataSet; 16 17 import org.openstreetmap.josm.data.osm.Node; 17 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.gui.MainApplication;19 19 import org.openstreetmap.josm.tools.Shortcut; 20 20 … … 42 42 Command cmd = null; 43 43 44 if ( MainApplication.undoRedo.commands == null) return;45 int num = MainApplication.undoRedo.commands.size();44 if (UndoRedoHandler.getInstance().commands == null) return; 45 int num = UndoRedoHandler.getInstance().commands.size(); 46 46 if (num == 0) return; 47 47 int k = 0, idx; 48 48 if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) { 49 49 // we are selecting next command in history if nothing is selected 50 idx = MainApplication.undoRedo.commands.indexOf(lastCmd);50 idx = UndoRedoHandler.getInstance().commands.indexOf(lastCmd); 51 51 } else { 52 52 idx = num; … … 56 56 do { // select next history element 57 57 if (idx > 0) idx--; else idx = num-1; 58 cmd = MainApplication.undoRedo.commands.get(idx);58 cmd = UndoRedoHandler.getInstance().commands.get(idx); 59 59 Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives(); 60 60 nodes.clear(); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java
r33579 r34454 13 13 import org.openstreetmap.josm.actions.JosmAction; 14 14 import org.openstreetmap.josm.command.Command; 15 import org.openstreetmap.josm.data.UndoRedoHandler; 15 16 import org.openstreetmap.josm.data.osm.DataSet; 16 17 import org.openstreetmap.josm.data.osm.Node; 17 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 19 import org.openstreetmap.josm.data.osm.Way; 19 import org.openstreetmap.josm.gui.MainApplication;20 20 import org.openstreetmap.josm.tools.Shortcut; 21 21 … … 43 43 Command cmd; 44 44 45 if ( MainApplication.undoRedo.commands == null) return;46 int num = MainApplication.undoRedo.commands.size();45 if (UndoRedoHandler.getInstance().commands == null) return; 46 int num = UndoRedoHandler.getInstance().commands.size(); 47 47 if (num == 0) return; 48 48 int k = 0, idx; 49 49 if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) { 50 50 // we are selecting next command in history if nothing is selected 51 idx = MainApplication.undoRedo.commands.indexOf(lastCmd);51 idx = UndoRedoHandler.getInstance().commands.indexOf(lastCmd); 52 52 } else { 53 53 idx = num; … … 57 57 do { // select next history element 58 58 if (idx > 0) idx--; else idx = num-1; 59 cmd = MainApplication.undoRedo.commands.get(idx);59 cmd = UndoRedoHandler.getInstance().commands.get(idx); 60 60 Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives(); 61 61 ways.clear();
Note:
See TracChangeset
for help on using the changeset viewer.