Changeset 34551 in osm for applications/editors/josm/plugins/reltoolbox/src
- Timestamp:
- 2018-08-18T20:08:26+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/reltoolbox/src/relcontext
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java
r34346 r34551 58 58 import javax.swing.table.TableColumnModel; 59 59 60 import org.openstreetmap.josm.Main;61 60 import org.openstreetmap.josm.actions.JosmAction; 62 61 import org.openstreetmap.josm.command.ChangeRelationMemberRoleCommand; 63 62 import org.openstreetmap.josm.command.Command; 64 63 import org.openstreetmap.josm.command.SequenceCommand; 64 import org.openstreetmap.josm.data.UndoRedoHandler; 65 65 import org.openstreetmap.josm.data.osm.DataSelectionListener; 66 66 import org.openstreetmap.josm.data.osm.DataSet; … … 79 79 import org.openstreetmap.josm.gui.layer.MainLayerManager.ActiveLayerChangeListener; 80 80 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 81 import org.openstreetmap.josm.spi.preferences.Config; 81 82 import org.openstreetmap.josm.tools.GBC; 82 83 import org.openstreetmap.josm.tools.Logging; … … 205 206 }); 206 207 downloadButton.setVisible(false); 207 if ( Main.pref.getBoolean(PREF_PREFIX + ".hidetopline", false)) {208 if (Config.getPref().getBoolean(PREF_PREFIX + ".hidetopline", false)) { 208 209 chosenRelationPanel.setVisible(false); 209 210 } … … 359 360 @Override 360 361 public void chosenRelationChanged(Relation oldRelation, Relation newRelation) { 361 if (chosenRelationPanel != null && Main.pref.getBoolean(PREF_PREFIX + ".hidetopline", false)) {362 if (chosenRelationPanel != null && Config.getPref().getBoolean(PREF_PREFIX + ".hidetopline", false)) { 362 363 chosenRelationPanel.setVisible(newRelation != null); 363 364 } … … 494 495 } 495 496 }; 496 final JDialog dlg = optionPane.createDialog(Main .parent, tr("Specify role"));497 final JDialog dlg = optionPane.createDialog(MainApplication.getMainFrame(), tr("Specify role")); 497 498 dlg.setModalityType(ModalityType.DOCUMENT_MODAL); 498 499 … … 573 574 } 574 575 if (!commands.isEmpty()) { 575 // Main.main.undoRedo.add(new ChangeCommand(chosenRelation.get(), r));576 MainApplication.undoRedo.add(new SequenceCommand(tr("Change relation member roles to {0}", role), commands));576 // UndoRedoHandler.getInstance().add(new ChangeCommand(chosenRelation.get(), r)); 577 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Change relation member roles to {0}", role), commands)); 577 578 } 578 579 } … … 603 604 String fullProperty = PREF_PREFIX + ".multipolygon." + property; 604 605 JCheckBoxMenuItem item = new JCheckBoxMenuItem(tr(title)); 605 item.setSelected( Main.pref.getBoolean(fullProperty, CreateMultipolygonAction.getDefaultPropertyValue(property)));606 item.setSelected(Config.getPref().getBoolean(fullProperty, CreateMultipolygonAction.getDefaultPropertyValue(property))); 606 607 item.setActionCommand(fullProperty); 607 608 item.addActionListener(this); … … 615 616 if (property != null && property.length() > 0 && e.getSource() instanceof JCheckBoxMenuItem) { 616 617 boolean value = ((JCheckBoxMenuItem) e.getSource()).isSelected(); 617 Main.pref.putBoolean(property, value);618 Config.getPref().putBoolean(property, value); 618 619 show(getInvoker(), getX(), getY()); 619 620 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/AddRemoveMemberAction.java
r33530 r34551 12 12 import org.openstreetmap.josm.command.ChangeCommand; 13 13 import org.openstreetmap.josm.command.Command; 14 import org.openstreetmap.josm.data.UndoRedoHandler; 14 15 import org.openstreetmap.josm.data.osm.DataSet; 15 16 import org.openstreetmap.josm.data.osm.Node; … … 19 20 import org.openstreetmap.josm.data.osm.RelationMember; 20 21 import org.openstreetmap.josm.data.osm.Way; 21 import org.openstreetmap.josm.gui.MainApplication;22 22 import org.openstreetmap.josm.gui.util.GuiHelper; 23 23 import org.openstreetmap.josm.tools.ImageProvider; … … 82 82 83 83 if (!r.getMemberPrimitives().equals(rel.get().getMemberPrimitives())) { 84 MainApplication.undoRedo.add(new ChangeCommand(rel.get(), r));84 UndoRedoHandler.getInstance().add(new ChangeCommand(rel.get(), r)); 85 85 } 86 86 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java
r33694 r34551 26 26 import javax.swing.JTextField; 27 27 28 import org.openstreetmap.josm.Main;29 28 import org.openstreetmap.josm.actions.JosmAction; 30 29 import org.openstreetmap.josm.command.AddCommand; … … 33 32 import org.openstreetmap.josm.command.Command; 34 33 import org.openstreetmap.josm.command.SequenceCommand; 34 import org.openstreetmap.josm.data.UndoRedoHandler; 35 35 import org.openstreetmap.josm.data.osm.DataSet; 36 36 import org.openstreetmap.josm.data.osm.MultipolygonBuilder; … … 42 42 import org.openstreetmap.josm.data.osm.Way; 43 43 import org.openstreetmap.josm.gui.MainApplication; 44 import org.openstreetmap.josm.spi.preferences.Config; 44 45 import org.openstreetmap.josm.tools.GBC; 45 46 import org.openstreetmap.josm.tools.Shortcut; … … 86 87 87 88 private boolean getPref(String property) { 88 return Main.pref.getBoolean(PREF_MULTIPOLY + property, getDefaultPropertyValue(property));89 return Config.getPref().getBoolean(PREF_MULTIPOLY + property, getDefaultPropertyValue(property)); 89 90 } 90 91 … … 105 106 rels = TheRing.makeManySimpleMultipolygons(ds.getSelectedWays(), commands); 106 107 if (!commands.isEmpty()) { 107 MainApplication.undoRedo.add(new SequenceCommand(tr("Create multipolygons from rings"), commands));108 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Create multipolygons from rings"), commands)); 108 109 } 109 110 } … … 126 127 String error = mpc.makeFromWays(ds.getSelectedWays()); 127 128 if (error != null) { 128 JOptionPane.showMessageDialog(Main .parent, error);129 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), error); 129 130 return; 130 131 } … … 148 149 List<Command> list = removeTagsFromInnerWays(rel); 149 150 if (!list.isEmpty() && isBoundary) { 150 MainApplication.undoRedo.add(new SequenceCommand(tr("Move tags from ways to relation"), list));151 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Move tags from ways to relation"), list)); 151 152 list = new ArrayList<>(); 152 153 } … … 160 161 } 161 162 list.add(new AddCommand(ds, rel)); 162 MainApplication.undoRedo.add(new SequenceCommand(tr("Create multipolygon"), list));163 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Create multipolygon"), list)); 163 164 164 165 if (chRel != null) { … … 335 336 } 336 337 337 for (String linearTag : Main.pref.getList(PREF_MULTIPOLY + "lineartags", DEFAULT_LINEAR_TAGS)) {338 for (String linearTag : Config.getPref().getList(PREF_MULTIPOLY + "lineartags", DEFAULT_LINEAR_TAGS)) { 338 339 values.remove(linearTag); 339 340 } … … 423 424 424 425 final JTextField admin = new JTextField(); 425 admin.setText(relAL != null ? relAL : Main.pref.get(PREF_MULTIPOLY + "lastadmin", ""));426 admin.setText(relAL != null ? relAL : Config.getPref().get(PREF_MULTIPOLY + "lastadmin", "")); 426 427 panel.add(new JLabel(tr("Admin level")), GBC.std()); 427 428 panel.add(Box.createHorizontalStrut(10), GBC.std()); … … 443 444 } 444 445 }; 445 final JDialog dlg = optionPane.createDialog(Main .parent, tr("Create a new relation"));446 final JDialog dlg = optionPane.createDialog(MainApplication.getMainFrame(), tr("Create a new relation")); 446 447 dlg.setModalityType(ModalityType.DOCUMENT_MODAL); 447 448 … … 465 466 if (admin_level.equals("10") || (admin_level.length() == 1 && Character.isDigit(admin_level.charAt(0)))) { 466 467 rel.put("admin_level", admin_level); 467 Main.pref.put(PREF_MULTIPOLY + "lastadmin", admin_level);468 Config.getPref().put(PREF_MULTIPOLY + "lastadmin", admin_level); 468 469 } 469 470 if (new_name.length() > 0) { -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java
r33694 r34551 19 19 import javax.swing.JPanel; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.actions.JosmAction; 23 22 import org.openstreetmap.josm.command.AddCommand; 23 import org.openstreetmap.josm.data.UndoRedoHandler; 24 24 import org.openstreetmap.josm.data.osm.DataSet; 25 25 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 28 28 import org.openstreetmap.josm.gui.MainApplication; 29 29 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingComboBox; 30 import org.openstreetmap.josm.spi.preferences.Config; 30 31 import org.openstreetmap.josm.tools.GBC; 31 32 import org.openstreetmap.josm.tools.Shortcut; … … 70 71 } 71 72 72 MainApplication.undoRedo.add(new AddCommand(ds, rel));73 UndoRedoHandler.getInstance().add(new AddCommand(ds, rel)); 73 74 74 75 if (chRel != null) { … … 105 106 keys.setPossibleItems(RELATION_TYPES); 106 107 keys.setEditable(true); 107 keys.getEditor().setItem( Main.pref.get(PREF_LASTTYPE, "multipolygon"));108 keys.getEditor().setItem(Config.getPref().get(PREF_LASTTYPE, "multipolygon")); 108 109 109 110 panel.add(new JLabel(tr("Type")), GBC.std()); … … 118 119 } 119 120 }; 120 final JDialog dlg = optionPane.createDialog(Main .parent, tr("Create a new relation"));121 final JDialog dlg = optionPane.createDialog(MainApplication.getMainFrame(), tr("Create a new relation")); 121 122 dlg.setModalityType(ModalityType.DOCUMENT_MODAL); 122 123 … … 137 138 138 139 String result = keys.getEditor().getItem().toString().trim(); 139 Main.pref.put(PREF_LASTTYPE, result);140 Config.getPref().put(PREF_LASTTYPE, result); 140 141 return result; 141 142 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java
r33694 r34551 11 11 import org.openstreetmap.josm.command.Command; 12 12 import org.openstreetmap.josm.command.DeleteCommand; 13 import org.openstreetmap.josm.data.UndoRedoHandler; 13 14 import org.openstreetmap.josm.data.osm.Relation; 14 import org.openstreetmap.josm.gui.MainApplication;15 15 import org.openstreetmap.josm.tools.ImageProvider; 16 16 … … 35 35 Command c = DeleteCommand.delete(Collections.singleton(r), true, true); 36 36 if (c != null) { 37 MainApplication.undoRedo.add(c);37 UndoRedoHandler.getInstance().add(c); 38 38 } 39 39 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DuplicateChosenRelationAction.java
r33694 r34551 9 9 10 10 import org.openstreetmap.josm.command.AddCommand; 11 import org.openstreetmap.josm.data.UndoRedoHandler; 11 12 import org.openstreetmap.josm.data.osm.DataSet; 12 13 import org.openstreetmap.josm.data.osm.Relation; … … 35 36 Relation r = rel.get(); 36 37 Relation copy = new Relation(r, true); 37 MainApplication.undoRedo.add(new AddCommand(ds, copy));38 UndoRedoHandler.getInstance().add(new AddCommand(ds, copy)); 38 39 rel.set(copy); 39 40 ds.setSelected(copy); -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/FindRelationAction.java
r34130 r34551 29 29 import javax.swing.SwingUtilities; 30 30 31 import org.openstreetmap.josm.Main;32 31 import org.openstreetmap.josm.actions.JosmAction; 33 32 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 34 33 import org.openstreetmap.josm.data.osm.Relation; 34 import org.openstreetmap.josm.gui.MainApplication; 35 35 import org.openstreetmap.josm.gui.PrimitiveRenderer; 36 36 import org.openstreetmap.josm.tools.Logging; … … 74 74 } 75 75 }; 76 final JDialog dlg = optionPane.createDialog(Main .parent, tr("Find a relation"));76 final JDialog dlg = optionPane.createDialog(MainApplication.getMainFrame(), tr("Find a relation")); 77 77 dlg.setModalityType(ModalityType.DOCUMENT_MODAL); 78 78 -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
r33694 r34551 17 17 import javax.swing.JOptionPane; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.command.AddCommand; 21 20 import org.openstreetmap.josm.command.ChangeCommand; … … 23 22 import org.openstreetmap.josm.command.DeleteCommand; 24 23 import org.openstreetmap.josm.command.SequenceCommand; 24 import org.openstreetmap.josm.data.UndoRedoHandler; 25 25 import org.openstreetmap.josm.data.coor.EastNorth; 26 26 import org.openstreetmap.josm.data.osm.DataSet; … … 71 71 } 72 72 if (wont) { 73 JOptionPane.showMessageDialog(Main .parent,73 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 74 74 tr("Multipolygon must consist only of ways"), tr("Reconstruct polygon"), JOptionPane.ERROR_MESSAGE); 75 75 return; … … 79 79 String error = mpc.makeFromWays(ways); 80 80 if (error != null) { 81 JOptionPane.showMessageDialog(Main .parent, error);81 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), error); 82 82 return; 83 83 } … … 198 198 } 199 199 200 MainApplication.undoRedo.add(new SequenceCommand(tr("Reconstruct polygons from relation {0}",200 UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Reconstruct polygons from relation {0}", 201 201 r.getDisplayName(DefaultNameFormatter.getInstance())), commands)); 202 202 ds.setSelected(newSelection); -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructRouteAction.java
r33530 r34551 14 14 import org.openstreetmap.josm.command.ChangeCommand; 15 15 import org.openstreetmap.josm.command.Command; 16 import org.openstreetmap.josm.data.UndoRedoHandler; 16 17 import org.openstreetmap.josm.data.coor.EastNorth; 17 18 import org.openstreetmap.josm.data.osm.Node; … … 21 22 import org.openstreetmap.josm.data.osm.RelationMember; 22 23 import org.openstreetmap.josm.data.osm.Way; 23 import org.openstreetmap.josm.gui.MainApplication;24 24 import org.openstreetmap.josm.gui.dialogs.relation.sort.RelationSorter; 25 25 import org.openstreetmap.josm.tools.Geometry; … … 190 190 } 191 191 Command command = new ChangeCommand(r, recRel); 192 MainApplication.undoRedo.add(command);192 UndoRedoHandler.getInstance().add(command); 193 193 } 194 194 -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/RelationHelpAction.java
r34095 r34551 10 10 import javax.swing.AbstractAction; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.osm.Relation; 14 13 import org.openstreetmap.josm.gui.MainApplication; 15 14 import org.openstreetmap.josm.gui.dialogs.properties.HelpAction; 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 import org.openstreetmap.josm.tools.ImageProvider; 17 17 import org.openstreetmap.josm.tools.LanguageInfo; … … 43 43 return; 44 44 try { 45 String base = Main.pref.get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/");45 String base = Config.getPref().get("url.openstreetmap-wiki", "https://wiki.openstreetmap.org/wiki/"); 46 46 String lang = LanguageInfo.getWikiLanguagePrefix(); 47 47 final List<URI> uris = HelpAction.getRelationURIs(base, lang, rel.get()); -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SortAndFixAction.java
r33530 r34551 12 12 13 13 import org.openstreetmap.josm.command.Command; 14 import org.openstreetmap.josm.data.UndoRedoHandler; 14 15 import org.openstreetmap.josm.data.osm.Relation; 15 16 import org.openstreetmap.josm.data.osm.RelationMember; 16 import org.openstreetmap.josm.gui.MainApplication;17 17 import org.openstreetmap.josm.tools.ImageProvider; 18 18 … … 57 57 Command c = fixRelation(rel.get()); 58 58 if (c != null) { 59 MainApplication.undoRedo.add(c);59 UndoRedoHandler.getInstance().add(c); 60 60 } 61 61 } -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java
r33694 r34551 13 13 import java.util.Map; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.command.AddCommand; 17 16 import org.openstreetmap.josm.command.ChangeCommand; 18 17 import org.openstreetmap.josm.command.Command; 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.coor.LatLon; … … 28 28 import org.openstreetmap.josm.data.osm.Way; 29 29 import org.openstreetmap.josm.gui.MainApplication; 30 import org.openstreetmap.josm.spi.preferences.Config; 30 31 import org.openstreetmap.josm.tools.Geometry; 31 32 import org.openstreetmap.josm.tools.Geometry.PolygonIntersection; … … 106 107 Relation newRelation = SplittingMultipolygons.attachRingToNeighbours(ring, commands); 107 108 if (newRelation != null && !commands.isEmpty()) { 108 MainApplication.undoRedo.add(commands.get(0));109 UndoRedoHandler.getInstance().add(commands.get(0)); 109 110 result.add(newRelation); 110 111 } … … 115 116 Relation newRelation = SplittingMultipolygons.tryToCloseOneWay(arc, commands); 116 117 if (newRelation != null && !commands.isEmpty()) { 117 MainApplication.undoRedo.add(commands.get(0));118 UndoRedoHandler.getInstance().add(commands.get(0)); 118 119 result.add(newRelation); 119 120 } … … 275 276 newRelation.put("type", "multipolygon"); 276 277 newRelation.addMember(new RelationMember("outer", segment)); 277 Collection<String> linearTags = Main.pref.getList(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);278 Collection<String> linearTags = Config.getPref().getList(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS); 278 279 Way segmentCopy = new Way(segment); 279 280 boolean changed = false; -
applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java
r33694 r34551 12 12 import javax.swing.JOptionPane; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.command.AddCommand; 16 15 import org.openstreetmap.josm.command.ChangeCommand; … … 24 23 import org.openstreetmap.josm.data.osm.Way; 25 24 import org.openstreetmap.josm.gui.MainApplication; 25 import org.openstreetmap.josm.spi.preferences.Config; 26 26 import org.openstreetmap.josm.tools.Geometry; 27 27 import org.openstreetmap.josm.tools.Geometry.PolygonIntersection; … … 143 143 } 144 144 if (pos == 0 && nodes1.size() == nodes2.size()) { 145 JOptionPane.showMessageDialog(Main .parent,145 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 146 146 tr("Two rings are equal, and this must not be."), tr("Multipolygon from rings"), JOptionPane.ERROR_MESSAGE); 147 147 return null; … … 331 331 Way sourceCopy = new Way(source); 332 332 if (createMultipolygon) { 333 Collection<String> linearTags = Main.pref.getList(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);333 Collection<String> linearTags = Config.getPref().getList(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS); 334 334 relation = new Relation(); 335 335 relation.put("type", "multipolygon"); -
applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/RelationFixer.java
r33311 r34551 2 2 package relcontext.relationfix; 3 3 4 import java.util.*;5 4 import static org.openstreetmap.josm.tools.I18n.tr; 6 5 6 import java.util.ArrayList; 7 import java.util.Arrays; 8 import java.util.List; 7 9 8 10 import javax.swing.Action;
Note:
See TracChangeset
for help on using the changeset viewer.