Changeset 34454 in osm


Ignore:
Timestamp:
2018-08-13T22:15:59+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/utilsplugin2
Files:
1 added
40 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/.classpath

    r32680 r34454  
    22<classpath>
    33        <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>
    59        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
    610        <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/>
  • applications/editors/josm/plugins/utilsplugin2/build.xml

    r34286 r34454  
    55    <property name="commit.message" value="[josm_utilsplugin2]: select boundary by double-click; multitagger table highlights"/>
    66    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    7     <property name="plugin.main.version" value="13922"/>
     7    <property name="plugin.main.version" value="14153"/>
    88
    99    <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  
    4848import org.openstreetmap.josm.plugins.utilsplugin2.selection.UnselectNodesAction;
    4949
     50/**
     51 * Collection of utilities
     52 */
    5053public class UtilsPlugin2 extends Plugin {
    5154
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AddIntersectionsAction.java

    r33579 r34454  
    1919import org.openstreetmap.josm.command.Command;
    2020import org.openstreetmap.josm.command.SequenceCommand;
     21import org.openstreetmap.josm.data.UndoRedoHandler;
    2122import org.openstreetmap.josm.data.osm.Node;
    2223import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2324import org.openstreetmap.josm.data.osm.Way;
    24 import org.openstreetmap.josm.gui.MainApplication;
    2525import org.openstreetmap.josm.gui.Notification;
    2626import org.openstreetmap.josm.tools.Geometry;
    2727import org.openstreetmap.josm.tools.Shortcut;
    2828
     29/**
     30 * Add missing nodes at intersections of selected ways.
     31 */
    2932public class AddIntersectionsAction extends JosmAction {
    3033
     
    5659        Geometry.addIntersections(ways, false, cmds);
    5760        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));
    5962            Set<Node> nodes = new HashSet<>(10);
    6063            // find and select newly added nodes
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/AlignWayNodesAction.java

    r33579 r34454  
    1919import org.openstreetmap.josm.command.MoveCommand;
    2020import org.openstreetmap.josm.command.SequenceCommand;
     21import org.openstreetmap.josm.data.UndoRedoHandler;
    2122import org.openstreetmap.josm.data.osm.Node;
    2223import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2324import org.openstreetmap.josm.data.osm.Way;
    24 import org.openstreetmap.josm.gui.MainApplication;
    2525import org.openstreetmap.josm.gui.Notification;
    2626import org.openstreetmap.josm.tools.Shortcut;
     
    128128
    129129        if (!commands.isEmpty())
    130             MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));
     130            UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands));
    131131    }
    132132
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/CopyTagsAction.java

    r32725 r34454  
    1414import javax.swing.JOptionPane;
    1515
    16 import org.openstreetmap.josm.Main;
    1716import org.openstreetmap.josm.actions.JosmAction;
    1817import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1918import org.openstreetmap.josm.data.osm.Tag;
     19import org.openstreetmap.josm.gui.MainApplication;
    2020import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    2121import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    8181        if (sel.isEmpty()) {
    8282            JOptionPane.showMessageDialog(
    83                     Main.parent,
     83                    MainApplication.getMainFrame(),
    8484                    tr("Please select something to copy."),
    8585                    tr("Information"),
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/ExtractPointAction.java

    r33676 r34454  
    2020import org.openstreetmap.josm.command.MoveCommand;
    2121import org.openstreetmap.josm.command.SequenceCommand;
     22import org.openstreetmap.josm.data.UndoRedoHandler;
    2223import org.openstreetmap.josm.data.osm.DataSet;
    2324import org.openstreetmap.josm.data.osm.Node;
     
    7374            }
    7475        }
    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));
    7677    }
    7778
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java

    r33579 r34454  
    1515import java.util.Map;
    1616
    17 import org.openstreetmap.josm.Main;
    1817import org.openstreetmap.josm.actions.JosmAction;
    1918import org.openstreetmap.josm.command.ChangeCommand;
    2019import org.openstreetmap.josm.command.Command;
    2120import org.openstreetmap.josm.command.SequenceCommand;
     21import org.openstreetmap.josm.data.UndoRedoHandler;
    2222import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2323import org.openstreetmap.josm.data.osm.PrimitiveData;
    2424import org.openstreetmap.josm.data.osm.Relation;
    2525import org.openstreetmap.josm.data.osm.RelationMember;
    26 import org.openstreetmap.josm.gui.MainApplication;
    2726import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    2827import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
     
    101100
    102101        if (!commands.isEmpty())
    103             MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));
     102            UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands));
    104103    }
    105104
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java

    r33676 r34454  
    2121import org.openstreetmap.josm.command.DeleteCommand;
    2222import org.openstreetmap.josm.command.SplitWayCommand;
     23import org.openstreetmap.josm.data.UndoRedoHandler;
    2324import org.openstreetmap.josm.data.osm.Node;
    2425import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2526import org.openstreetmap.josm.data.osm.Way;
    26 import org.openstreetmap.josm.gui.MainApplication;
    2727import org.openstreetmap.josm.gui.Notification;
    2828import org.openstreetmap.josm.tools.Shortcut;
     
    210210            SplitWayCommand result = SplitWayCommand.splitWay(
    211211                    selectedWay, wayChunks, Collections.<OsmPrimitive>emptyList());
    212             MainApplication.undoRedo.add(result);
     212            UndoRedoHandler.getInstance().add(result);
    213213            if (splitWay != null)
    214                 MainApplication.undoRedo.add(new DeleteCommand(splitWay));
     214                UndoRedoHandler.getInstance().add(new DeleteCommand(splitWay));
    215215            getLayerManager().getEditDataSet().setSelected(result.getNewSelection());
    216216        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitOnIntersectionsAction.java

    r33676 r34454  
    1919import org.openstreetmap.josm.command.SequenceCommand;
    2020import org.openstreetmap.josm.command.SplitWayCommand;
     21import org.openstreetmap.josm.data.UndoRedoHandler;
    2122import org.openstreetmap.josm.data.osm.Node;
    2223import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2324import org.openstreetmap.josm.data.osm.Way;
    24 import org.openstreetmap.josm.gui.MainApplication;
    2525import org.openstreetmap.josm.gui.Notification;
    2626import org.openstreetmap.josm.tools.Shortcut;
     
    9292
    9393        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));
    9595            getLayerManager().getEditDataSet().clearSelection();
    9696        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SymmetryAction.java

    r33579 r34454  
    1313import javax.swing.JOptionPane;
    1414
    15 import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.actions.JosmAction;
    1716import org.openstreetmap.josm.command.Command;
    1817import org.openstreetmap.josm.command.MoveCommand;
    1918import org.openstreetmap.josm.command.SequenceCommand;
     19import org.openstreetmap.josm.data.UndoRedoHandler;
    2020import org.openstreetmap.josm.data.coor.EastNorth;
    2121import org.openstreetmap.josm.data.osm.Node;
     
    8888        }
    8989
    90         MainApplication.undoRedo.add(new SequenceCommand(tr("Symmetry"), cmds));
     90        UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Symmetry"), cmds));
    9191        MainApplication.getMap().repaint();
    9292    }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java

    r33579 r34454  
    1919import org.openstreetmap.josm.command.Command;
    2020import org.openstreetmap.josm.command.SequenceCommand;
     21import org.openstreetmap.josm.data.UndoRedoHandler;
    2122import org.openstreetmap.josm.data.osm.OsmPrimitive;
    22 import org.openstreetmap.josm.gui.MainApplication;
    2323import org.openstreetmap.josm.tools.Shortcut;
    2424import org.openstreetmap.josm.tools.SubclassFilteredCollection;
     
    6969
    7070        if (!commands.isEmpty())
    71             MainApplication.undoRedo.add(new SequenceCommand(TITLE, commands));
     71            UndoRedoHandler.getInstance().add(new SequenceCommand(TITLE, commands));
    7272    }
    7373
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagSourceAction.java

    r33579 r34454  
    1010import java.util.Set;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.actions.JosmAction;
    1413import org.openstreetmap.josm.command.ChangePropertyCommand;
     14import org.openstreetmap.josm.data.UndoRedoHandler;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
    16 import org.openstreetmap.josm.gui.MainApplication;
     16import org.openstreetmap.josm.spi.preferences.Config;
    1717import org.openstreetmap.josm.tools.Shortcut;
    1818
     
    3232                Shortcut.registerShortcut("tools:sourcetag", tr("Tool: {0}", tr("Add Source Tag")), KeyEvent.VK_S, Shortcut.ALT_CTRL),
    3333                true, false);
    34         source = Main.pref.get("sourcetag.value");
     34        source = Config.getPref().get("sourcetag.value");
    3535        // The fields are not initialized while the super constructor is running, so we have to call this afterwards:
    3636        installAdapters();
     
    4343            return;
    4444
    45         MainApplication.undoRedo.add(new ChangePropertyCommand(selection, "source", source));
     45        UndoRedoHandler.getInstance().add(new ChangePropertyCommand(selection, "source", source));
    4646    }
    4747
     
    8282                if (newSource != null && newSource.length() > 0 && !newSource.equals(source)) {
    8383                    source = newSource;
    84                     Main.pref.put("sourcetag.value", source);
     84                    Config.getPref().put("sourcetag.value", source);
    8585                }
    8686            }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/UnGlueRelationAction.java

    r33676 r34454  
    1515import org.openstreetmap.josm.command.Command;
    1616import org.openstreetmap.josm.command.SequenceCommand;
     17import org.openstreetmap.josm.data.UndoRedoHandler;
    1718import org.openstreetmap.josm.data.osm.DataSet;
    1819import org.openstreetmap.josm.data.osm.Node;
     
    8182            // error message nothing to do
    8283        } else {
    83             MainApplication.undoRedo.add(new SequenceCommand(tr("Unglued Relations"), cmds));
     84            UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Unglued Relations"), cmds));
    8485            //Set selection all primiteves (new and old)
    8586            newPrimitives.addAll(selection);
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java

    r33677 r34454  
    2424import org.openstreetmap.josm.gui.MainApplication;
    2525
     26/**
     27 * Create a circle arc
     28 */
    2629public final class CircleArcMaker {
    2730
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CurveAction.java

    r33676 r34454  
    1111import java.util.List;
    1212
    13 import org.openstreetmap.josm.Main;
    1413import org.openstreetmap.josm.actions.JosmAction;
    1514import org.openstreetmap.josm.command.Command;
    1615import org.openstreetmap.josm.command.SequenceCommand;
     16import org.openstreetmap.josm.data.UndoRedoHandler;
    1717import org.openstreetmap.josm.data.osm.Node;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1919import org.openstreetmap.josm.data.osm.Way;
    20 import org.openstreetmap.josm.gui.MainApplication;
     20import org.openstreetmap.josm.spi.preferences.Config;
    2121import org.openstreetmap.josm.tools.Shortcut;
    2222
    2323// TODO: investigate splines
    2424
     25/**
     26 * Create a circle arc
     27 */
    2528public class CurveAction extends JosmAction {
    2629
     
    3942    private void updatePreferences() {
    4043        // @formatter:off
    41         angleSeparation = Main.pref.getInt(prefKey("circlearc.angle-separation"), 20);
     44        angleSeparation = Config.getPref().getInt(prefKey("circlearc.angle-separation"), 20);
    4245        // @formatter:on
    4346    }
     
    5962        Collection<Command> cmds = CircleArcMaker.doCircleArc(selectedNodes, selectedWays, angleSeparation);
    6063        if (cmds != null)
    61             MainApplication.undoRedo.add(new SequenceCommand("Create a curve", cmds));
     64            UndoRedoHandler.getInstance().add(new SequenceCommand("Create a curve", cmds));
    6265    }
    6366
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/ChooseURLAction.java

    r34221 r34454  
    1717import javax.swing.event.ListSelectionListener;
    1818
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.actions.JosmAction;
    2120import org.openstreetmap.josm.gui.ExtendedDialog;
     21import org.openstreetmap.josm.gui.MainApplication;
     22import org.openstreetmap.josm.spi.preferences.Config;
    2223import org.openstreetmap.josm.tools.GBC;
    2324
     25/**
     26 * Select custom URL
     27 */
    2428public class ChooseURLAction extends JosmAction {
    2529
     
    5660        final JCheckBox check1 = new JCheckBox(tr("Ask every time"));
    5761
    58         final ExtendedDialog dialog = new ExtendedDialog(Main.parent,
     62        final ExtendedDialog dialog = new ExtendedDialog(MainApplication.getMainFrame(),
    5963                tr("Configure custom URL"),
    6064                new String[] {tr("OK"), tr("Cancel")}
     
    6973        });
    7074        list1.setSelectedIndex(idxToSelect);
    71         check1.setSelected(Main.pref.getBoolean("utilsplugin2.askurl", false));
     75        check1.setSelected(Config.getPref().getBoolean("utilsplugin2.askurl", false));
    7276
    7377        editField.setEditable(false);
     
    8791        if (ret == 1 && idx >= 0) {
    8892            URLList.select(vals[idx]);
    89             Main.pref.putBoolean("utilsplugin2.askurl", check1.isSelected());
     93            Config.getPref().putBoolean("utilsplugin2.askurl", check1.isSelected());
    9094        }
    9195        return ret;
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/OpenPageAction.java

    r34221 r34454  
    1313import java.util.regex.Pattern;
    1414
    15 import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.actions.JosmAction;
    1716import org.openstreetmap.josm.data.coor.LatLon;
     
    2019import org.openstreetmap.josm.gui.MainApplication;
    2120import org.openstreetmap.josm.gui.MapView;
     21import org.openstreetmap.josm.spi.preferences.Config;
    2222import org.openstreetmap.josm.tools.Logging;
    2323import org.openstreetmap.josm.tools.OpenBrowser;
     
    5050        }
    5151
    52         if (Main.pref.getBoolean("utilsplugin2.askurl", false) && 1 != ChooseURLAction.showConfigDialog(true)) {
     52        if (Config.getPref().getBoolean("utilsplugin2.askurl", false) && 1 != ChooseURLAction.showConfigDialog(true)) {
    5353            return;
    5454        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/customurl/URLList.java

    r33742 r34454  
    1313import java.util.logging.Logger;
    1414
    15 import org.openstreetmap.josm.Main;
     15import org.openstreetmap.josm.data.Preferences;
    1616import org.openstreetmap.josm.plugins.utilsplugin2.UtilsPlugin2;
     17import org.openstreetmap.josm.spi.preferences.Config;
    1718import org.openstreetmap.josm.tools.Logging;
    1819
     20/**
     21 * List of custom URLs
     22 */
    1923public final class URLList {
    2024    public static final String defaultURL = "http://osm.mapki.com/history/{#type}.php?id={#id}";
     
    2630    public static String getSelectedURL() {
    2731        getURLList();
    28         return Main.pref.get("utilsplugin2.customurl", defaultURL);
     32        return Config.getPref().get("utilsplugin2.customurl", defaultURL);
    2933    }
    3034
    3135    public static void select(String url) {
    32         Main.pref.put("utilsplugin2.customurl", url);
     36        Config.getPref().put("utilsplugin2.customurl", url);
    3337    }
    3438
     
    4751        items.add("Browse element [demo, =Ctrl-Shift-I]");
    4852        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));
    5155        return items;
    5256    }
    5357
    5458    public static List<String> getURLList() {
    55         List<String> items = Main.pref.getList("utilsplugin2.urlHistory");
     59        List<String> items = Config.getPref().getList("utilsplugin2.urlHistory");
    5660        if (items == null || items.isEmpty()) {
    5761            resetURLList();
    58             items = Main.pref.getList("utilsplugin2.urlHistory");
     62            items = Config.getPref().getList("utilsplugin2.urlHistory");
    5963        }
    6064        return items;
     
    6266
    6367    public static void updateURLList(List<String> lst) {
    64         Main.pref.putList("utilsplugin2.urlHistory", lst);
     68        Config.getPref().putList("utilsplugin2.urlHistory", lst);
    6569        try {
    66             Main.pref.save();
     70            Preferences.main().save();
    6771        } catch (IOException ex) {
    6872            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  
    2626import org.openstreetmap.josm.tools.GBC;
    2727
     28/**
     29 * Preferences of Utilsplugin2 functions
     30 */
    2831public class UtilsPluginPreferences extends DefaultTabPreferenceSetting {
    2932    HistoryComboBox combo1 = new HistoryComboBox();
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonAction.java

    r33676 r34454  
    1010import java.util.LinkedList;
    1111
    12 import org.openstreetmap.josm.Main;
    1312import org.openstreetmap.josm.actions.JosmAction;
    1413import org.openstreetmap.josm.command.AddCommand;
    1514import org.openstreetmap.josm.command.Command;
    1615import org.openstreetmap.josm.command.SequenceCommand;
     16import org.openstreetmap.josm.data.UndoRedoHandler;
    1717import org.openstreetmap.josm.data.coor.LatLon;
    1818import org.openstreetmap.josm.data.osm.DataSet;
     
    4141            return;
    4242
    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"));
    4444
    4545        if (textLatLon != null) {
     
    8383            cmds.add(new AddCommand(ds, wnew));
    8484        }
    85         MainApplication.undoRedo.add(new SequenceCommand(tr("Lat Lon tool"), cmds));
     85        UndoRedoHandler.getInstance().add(new SequenceCommand(tr("Lat Lon tool"), cmds));
    8686        MainApplication.getMap().mapView.repaint();
    8787    }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/latlon/LatLonDialog.java

    r33676 r34454  
    3232import javax.swing.event.DocumentListener;
    3333
    34 import org.openstreetmap.josm.Main;
    3534import org.openstreetmap.josm.data.coor.LatLon;
    3635import org.openstreetmap.josm.data.coor.conversion.CoordinateFormatManager;
     
    3837import org.openstreetmap.josm.data.coor.conversion.LatLonParser;
    3938import org.openstreetmap.josm.gui.ExtendedDialog;
     39import org.openstreetmap.josm.gui.MainApplication;
    4040import org.openstreetmap.josm.gui.util.WindowGeometry;
    4141import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    4242import org.openstreetmap.josm.tools.GBC;
    4343
     44/**
     45 * Dialog for entering lat/lon coordinates.
     46 */
    4447public class LatLonDialog extends ExtendedDialog {
    4548    private static final Color BG_COLOR_ERROR = new Color(255, 224, 224);
     
    167170
    168171    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")});
    170173        setButtonIcons(new String[] {"ok", "cancel"});
    171174        configureContextsensitiveHelp("/Action/AddNode", true);
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagAction.java

    r32410 r34454  
    1313import org.openstreetmap.josm.tools.Shortcut;
    1414
     15/**
     16 * Edit tags of object list in table
     17 */
    1518public final class MultiTagAction extends JosmAction {
    1619
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTagDialog.java

    r33742 r34454  
    4040import javax.swing.table.DefaultTableCellRenderer;
    4141
    42 import org.openstreetmap.josm.Main;
    4342import org.openstreetmap.josm.actions.AutoScaleAction;
    4443import org.openstreetmap.josm.actions.search.SearchAction;
     
    5958import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
    6059import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
     60import org.openstreetmap.josm.spi.preferences.Config;
    6161import org.openstreetmap.josm.tools.GBC;
    6262import org.openstreetmap.josm.tools.ImageProvider;
     
    8181
    8282    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);
    8484        JPanel pnl = new JPanel(new GridBagLayout());
    8585        tbl = createTable();
     
    112112        loadHistory();
    113113
    114         WindowGeometry defaultGeometry = WindowGeometry.centerInWindow(Main.parent, new Dimension(500, 500));
     114        WindowGeometry defaultGeometry = WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(500, 500));
    115115        setRememberWindowGeometry(getClass().getName() + ".geometry", defaultGeometry);
    116116    }
     
    151151    private void loadHistory() {
    152152        List<String> cmtHistory = new LinkedList<>(
    153                 Main.pref.getList(HISTORY_KEY, Arrays.asList(defaultHistory)));
     153                Config.getPref().getList(HISTORY_KEY, Arrays.asList(defaultHistory)));
    154154        Collections.reverse(cmtHistory);
    155155        cbTagSet.setPossibleItems(cmtHistory);
     
    303303                history = Arrays.asList(defaultHistory);
    304304            }
    305             Main.pref.putList(HISTORY_KEY, history);
     305            Config.getPref().putList(HISTORY_KEY, history);
    306306            loadHistory();
    307307        }
     
    336336            oldTags = s;
    337337            cbTagSet.addCurrentItemToHistory();
    338             Main.pref.putList(HISTORY_KEY, cbTagSet.getHistory());
     338            Config.getPref().putList(HISTORY_KEY, cbTagSet.getHistory());
    339339            specifyTagSet(s);
    340340        }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/multitagger/MultiTaggerTableModel.java

    r33579 r34454  
    1616import org.openstreetmap.josm.command.SequenceCommand;
    1717import org.openstreetmap.josm.data.SelectionChangedListener;
     18import org.openstreetmap.josm.data.UndoRedoHandler;
    1819import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1920import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    2223import org.openstreetmap.josm.tools.Geometry;
    2324
     25/**
     26 * Model of the multi tag table.
     27 */
    2428public class MultiTaggerTableModel extends AbstractTableModel implements SelectionChangedListener {
    2529
     
    115119            Command cmd = new ChangePropertyCommand(sel, key, (String) value);
    116120            if (autoCommit) {
    117                 MainApplication.undoRedo.add(cmd);
     121                UndoRedoHandler.getInstance().add(cmd);
    118122            } else {
    119123                cmds.add(cmd);
     
    185189
    186190    void commit(String commandTitle) {
    187         MainApplication.undoRedo.add(new SequenceCommand(commandTitle, cmds));
     191        UndoRedoHandler.getInstance().add(new SequenceCommand(commandTitle, cmds));
    188192        cmds.clear();
    189193    }
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryAction.java

    r33579 r34454  
    1313
    1414import org.openstreetmap.josm.actions.JosmAction;
     15import org.openstreetmap.josm.data.UndoRedoHandler;
    1516import org.openstreetmap.josm.data.osm.OsmPrimitive;
    16 import org.openstreetmap.josm.gui.MainApplication;
    1717import org.openstreetmap.josm.gui.Notification;
    1818import org.openstreetmap.josm.tools.Shortcut;
     
    5858                return;
    5959
    60             MainApplication.undoRedo.add(replaceCommand);
     60            UndoRedoHandler.getInstance().add(replaceCommand);
    6161        } catch (IllegalArgumentException ex) {
    6262            new Notification(
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryException.java

    r32410 r34454  
    33
    44/**
    5  *
     5 * Exception thrown when replace geometry fails.
    66 * @author joshdoe
    77 */
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceGeometryUtils.java

    r33704 r34454  
    1818import javax.swing.JOptionPane;
    1919
    20 import org.openstreetmap.josm.Main;
    2120import org.openstreetmap.josm.actions.MergeNodesAction;
    2221import org.openstreetmap.josm.command.ChangeNodesCommand;
     
    3635import org.openstreetmap.josm.gui.Notification;
    3736import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog;
     37import org.openstreetmap.josm.spi.preferences.Config;
    3838import org.openstreetmap.josm.tools.Logging;
    3939import org.openstreetmap.josm.tools.UserCancelException;
     
    4242
    4343/**
    44  *
     44 * Utilities for Replace Geometry
    4545 * @author joshdoe
    4646 */
     
    276276        int nLen = nodePool.size();
    277277        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);
    280280
    281281        // Find new nodes that are closest to the old ones, remove matching old ones from the pool
     
    291291                }
    292292
    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"));
    294294                for (int i = 0; i < nLen; i++) {
    295295                    for (int j = 0; j < gLen; j++) {
     
    468468        Node nearest = null;
    469469        // 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"));
    471471        LatLon coor = node.getCoor();
    472472
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/replacegeometry/ReplaceMembershipAction.java

    r34263 r34454  
    1818import org.openstreetmap.josm.command.ChangeCommand;
    1919import org.openstreetmap.josm.command.Command;
     20import org.openstreetmap.josm.data.UndoRedoHandler;
    2021import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    2122import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2324import org.openstreetmap.josm.data.osm.RelationMember;
    2425import org.openstreetmap.josm.data.osm.RelationToChildReference;
    25 import org.openstreetmap.josm.gui.MainApplication;
    2626import org.openstreetmap.josm.gui.Notification;
    2727import org.openstreetmap.josm.tools.MultiMap;
    2828
     29/**
     30 * In relations where the selected object is member of, replace it with a new one
     31 */
    2932public class ReplaceMembershipAction extends JosmAction {
    3033
     
    4548        final int affectedRelations = command != null ? command.getChildren().size() : 0;
    4649        if (affectedRelations > 0) {
    47             MainApplication.undoRedo.add(command);
     50            UndoRedoHandler.getInstance().add(command);
    4851            new Notification(trn("Replaced ''{0}'' by ''{1}'' in {2} relation", "Replaced ''{0}'' by ''{1}'' in {2} relations",
    4952                    affectedRelations,
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ChildrenMatch.java

    r33522 r34454  
    77import org.openstreetmap.josm.data.osm.Relation;
    88import org.openstreetmap.josm.data.osm.Way;
     9import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    910import org.openstreetmap.josm.data.osm.search.SearchParseError;
    10 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    1111
    1212/**
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ConnectedMatch.java

    r33579 r34454  
    6767    }
    6868
     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
    6995}
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/InsideMatch.java

    r33579 r34454  
    5151        return inside.contains(osm);
    5252    }
     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    }
    5373}
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/IntersectingMatch.java

    r33579 r34454  
    5757    }
    5858
     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
    5985}
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/ParentsMatch.java

    r33522 r34454  
    55
    66import org.openstreetmap.josm.data.osm.OsmPrimitive;
     7import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    78import org.openstreetmap.josm.data.osm.search.SearchParseError;
    8 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    99
    1010/**
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/RangeMatch.java

    r33522 r34454  
    4040        return getString() + "=" + min + "-" + max;
    4141    }
     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    }
    4265}
    4366
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsSimpleMatchFactory.java

    r33543 r34454  
    77import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    88import org.openstreetmap.josm.data.osm.search.SearchCompiler;
     9import org.openstreetmap.josm.data.osm.search.SearchCompiler.CoreSimpleMatchFactory;
    910import org.openstreetmap.josm.data.osm.search.SearchCompiler.SimpleMatchFactory;
    1011import org.openstreetmap.josm.data.osm.search.SearchParseError;
    1112
     13/**
     14 * Extension of the {@link CoreSimpleMatchFactory}
     15 */
    1216public class UtilsSimpleMatchFactory implements SimpleMatchFactory {
    1317
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/search/UtilsUnaryMatchFactory.java

    r33522 r34454  
    55import java.util.Collection;
    66
    7 import org.openstreetmap.josm.data.osm.search.SearchParseError;
    87import org.openstreetmap.josm.data.osm.search.PushbackTokenizer;
    98import org.openstreetmap.josm.data.osm.search.SearchCompiler;
     9import org.openstreetmap.josm.data.osm.search.SearchCompiler.CoreUnaryMatchFactory;
     10import org.openstreetmap.josm.data.osm.search.SearchParseError;
    1011
     12/**
     13 * Extension of the {@link CoreUnaryMatchFactory}.
     14 */
    1115public class UtilsUnaryMatchFactory implements SearchCompiler.UnaryMatchFactory {
    1216
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java

    r33676 r34454  
    1414import javax.swing.JOptionPane;
    1515
    16 import org.openstreetmap.josm.Main;
    1716import org.openstreetmap.josm.data.coor.EastNorth;
    1817import org.openstreetmap.josm.data.osm.BBox;
     
    2322import org.openstreetmap.josm.data.osm.Way;
    2423import org.openstreetmap.josm.gui.Notification;
     24import org.openstreetmap.josm.spi.preferences.Config;
    2525import org.openstreetmap.josm.tools.Geometry;
    2626import org.openstreetmap.josm.tools.Pair;
     
    3232public final class NodeWayUtils {
    3333
    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);
    3737
    3838    private NodeWayUtils() {
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModNodesAction.java

    r33579 r34454  
    1313import org.openstreetmap.josm.actions.JosmAction;
    1414import org.openstreetmap.josm.command.Command;
     15import org.openstreetmap.josm.data.UndoRedoHandler;
    1516import org.openstreetmap.josm.data.osm.DataSet;
    1617import org.openstreetmap.josm.data.osm.Node;
    1718import org.openstreetmap.josm.data.osm.OsmPrimitive;
    18 import org.openstreetmap.josm.gui.MainApplication;
    1919import org.openstreetmap.josm.tools.Shortcut;
    2020
     
    4242            Command cmd = null;
    4343
    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();
    4646            if (num == 0) return;
    4747            int k = 0, idx;
    4848            if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
    4949                // 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);
    5151            } else {
    5252                idx = num;
     
    5656            do {  //  select next history element
    5757                if (idx > 0) idx--; else idx = num-1;
    58                 cmd = MainApplication.undoRedo.commands.get(idx);
     58                cmd = UndoRedoHandler.getInstance().commands.get(idx);
    5959                Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
    6060                nodes.clear();
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/SelectModWaysAction.java

    r33579 r34454  
    1313import org.openstreetmap.josm.actions.JosmAction;
    1414import org.openstreetmap.josm.command.Command;
     15import org.openstreetmap.josm.data.UndoRedoHandler;
    1516import org.openstreetmap.josm.data.osm.DataSet;
    1617import org.openstreetmap.josm.data.osm.Node;
    1718import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1819import org.openstreetmap.josm.data.osm.Way;
    19 import org.openstreetmap.josm.gui.MainApplication;
    2020import org.openstreetmap.josm.tools.Shortcut;
    2121
     
    4343            Command cmd;
    4444
    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();
    4747            if (num == 0) return;
    4848            int k = 0, idx;
    4949            if (selection != null && !selection.isEmpty() && selection.hashCode() == lastHash) {
    5050                // 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);
    5252            } else {
    5353                idx = num;
     
    5757            do {  //  select next history element
    5858                if (idx > 0) idx--; else idx = num-1;
    59                 cmd = MainApplication.undoRedo.commands.get(idx);
     59                cmd = UndoRedoHandler.getInstance().commands.get(idx);
    6060                Collection<? extends OsmPrimitive> pp = cmd.getParticipatingPrimitives();
    6161                ways.clear();
Note: See TracChangeset for help on using the changeset viewer.