Changeset 16629 in osm


Ignore:
Timestamp:
2009-07-21T22:06:43+02:00 (15 years ago)
Author:
jttt
Message:

Make it work without Main.ds

Location:
applications/editors/josm/plugins/validator
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/validator/build.xml

    r16409 r16629  
    2626                <attribute name="Plugin-Description" value="An OSM data validator. It checks for problems in data, and provides fixes for the common ones. Spellcheck integrated for tag names."/>
    2727                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Validator"/>
    28                 <attribute name="Plugin-Mainversion" value="1755"/>
     28                <attribute name="Plugin-Mainversion" value="1815"/>
    2929                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    3030            </manifest>
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java

    r16294 r16629  
    11package org.openstreetmap.josm.plugins.validator;
    22
    3 import java.awt.*;
     3import java.awt.Color;
     4import java.awt.Component;
     5import java.awt.Graphics;
     6import java.awt.Point;
    47import java.awt.geom.Point2D;
    58
     
    1114import org.openstreetmap.josm.actions.RenameLayerAction;
    1215import org.openstreetmap.josm.data.coor.EastNorth;
    13 import org.openstreetmap.josm.data.osm.*;
     16import org.openstreetmap.josm.data.osm.Node;
     17import org.openstreetmap.josm.data.osm.OsmPrimitive;
     18import org.openstreetmap.josm.data.osm.Relation;
     19import org.openstreetmap.josm.data.osm.Way;
     20import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
    1421import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    15 import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
    1622import org.openstreetmap.josm.gui.MapView;
    1723import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    6571        g.setColor(Color.RED.darker().darker());
    6672        HighlightCellVisitor visitor = new HighlightCellVisitor(g, mv, gridWidth);
    67         for(OsmPrimitive p : Main.ds.getSelected() )
     73        for(OsmPrimitive p : Main.main.getCurrentDataSet().getSelected() )
    6874            p.visit(visitor);
    6975
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java

    r13497 r16629  
    3737     */
    3838    public ValidateAction(OSMValidatorPlugin plugin) {
    39         super(tr("Validation"), "validator", tr("Performs the data validation"), 
     39        super(tr("Validation"), "validator", tr("Performs the data validation"),
    4040        Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), KeyEvent.VK_V, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
    4141        this.plugin = plugin;
     
    6868        Collection<OsmPrimitive> selection;
    6969        if (getSelectedItems) {
    70             selection = Main.ds.getSelected();
     70            selection = Main.main.getCurrentDataSet().getSelected();
    7171            if (selection.isEmpty()) {
    72                 selection = Main.ds.allNonDeletedPrimitives();
     72                selection = Main.main.getCurrentDataSet().allNonDeletedPrimitives();
    7373                lastSelection = null;
    7474            } else {
     
    7979        } else {
    8080            if (lastSelection == null)
    81                 selection = Main.ds.allNonDeletedPrimitives();
     81                selection = Main.main.getCurrentDataSet().allNonDeletedPrimitives();
    8282            else
    8383                selection = lastSelection;
     
    109109        plugin.validationDialog.tree.setErrors(errors);
    110110        plugin.validationDialog.setVisible(true);
    111         DataSet.fireSelectionChanged(Main.ds.getSelected());
     111        DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
    112112    }
    113113}
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java

    r14015 r16629  
    120120            plugin.validationDialog.tree.setErrors(errors);
    121121            plugin.validationDialog.setVisible(true);
    122             DataSet.fireSelectionChanged(Main.ds.getSelected());
     122            DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
    123123        }
    124124        return res == JOptionPane.YES_OPTION;
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java

    r16290 r16629  
    4242 * respects clicks into the selection list. Ctrl-click will remove entries from
    4343 * the list while single click will make the clicked entry the only selection.
    44  * 
     44 *
    4545 * @author frsantos
    4646 */
     
    127127    /**
    128128     * Fix selected errors
    129      * 
     129     *
    130130     * @param e
    131131     */
     
    163163        Main.map.repaint();
    164164        tree.resetErrors();
    165         DataSet.fireSelectionChanged(Main.ds.getSelected());
     165        DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
    166166    }
    167167
    168168    /**
    169169     * Set selected errors to ignore state
    170      * 
     170     *
    171171     * @param e
    172172     */
     
    295295        }
    296296
    297         Main.ds.setSelected(sel);
     297        Main.main.getCurrentDataSet().setSelected(sel);
    298298    }
    299299
     
    313313     * Checks for fixes in selected element and, if needed, adds to the sel
    314314     * parameter all selected elements
    315      * 
     315     *
    316316     * @param sel
    317317     *            The collection where to add all selected elements
     
    381381
    382382            if (isDblClick) {
    383                 Main.ds.setSelected(sel);
     383                Main.main.getCurrentDataSet().setSelected(sel);
    384384            }
    385385        }
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java

    r13497 r16629  
    1414import org.openstreetmap.josm.command.Command;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
    16 import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
     16import org.openstreetmap.josm.plugins.validator.util.NameVisitor;
    1717import org.openstreetmap.josm.tools.ImageProvider;
    1818
    1919/**
    2020 * Command that replaces the key of several objects
    21  * 
     21 *
    2222 */
    2323public class ChangePropertyKeyCommand extends Command {
     
    3434     */
    3535    private final String newKey;
    36    
     36
    3737    /**
    3838     * Constructor
    39      * 
     39     *
    4040     * @param objects all objects subject to change replacement
    4141     * @param key The key to replace
     
    4747        this.newKey = newKey;
    4848    }
    49    
     49
    5050    @Override public boolean executeCommand() {
    5151        if (!super.executeCommand()) return false; // save old
    5252        for (OsmPrimitive osm : objects) {
    53             if(osm.keys != null) 
     53            if(osm.keys != null)
    5454            {
    5555                osm.modified = true;
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java

    r16159 r16629  
    33import static org.openstreetmap.josm.tools.I18n.tr;
    44
    5 import java.util.*;
     5import java.util.Collection;
     6import java.util.LinkedList;
     7import java.util.List;
    68
    79import org.openstreetmap.josm.actions.MergeNodesAction;
    8 import org.openstreetmap.josm.command.*;
     10import org.openstreetmap.josm.command.Command;
    911import org.openstreetmap.josm.data.coor.LatLon;
    10 import org.openstreetmap.josm.data.osm.*;
     12import org.openstreetmap.josm.data.osm.Node;
     13import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1114import org.openstreetmap.josm.plugins.validator.Severity;
    1215import org.openstreetmap.josm.plugins.validator.Test;
     
    9093            target = nodes.iterator().next();
    9194
    92         MergeNodesAction.mergeNodes(nodes, target);
     95        new  MergeNodesAction().mergeNodes(nodes, target);
    9396
    9497        return null; // undoRedo handling done in mergeNodes
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java

    r16345 r16629  
    66import java.awt.geom.Line2D;
    77import java.util.Arrays;
    8 import java.util.Map;
    98import java.util.HashMap;
    109import java.util.HashSet;
     10import java.util.Map;
    1111import java.util.Set;
    1212
     13import org.openstreetmap.josm.Main;
    1314import org.openstreetmap.josm.data.osm.Node;
    1415import org.openstreetmap.josm.data.osm.OsmUtils;
    1516import org.openstreetmap.josm.data.osm.Way;
    16 import org.openstreetmap.josm.Main;
    1717import org.openstreetmap.josm.plugins.validator.PreferenceEditor;
    1818import org.openstreetmap.josm.plugins.validator.Severity;
     
    6262    public void endTest()
    6363    {
    64         Area a = Main.ds.getDataSourceArea();
     64        Area a = Main.main.getCurrentDataSet().getDataSourceArea();
    6565        Map<Node, Way> map = new HashMap<Node, Way>();
    6666        for(Node en : endnodes_highway)
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java

    r14121 r16629  
    33import static org.openstreetmap.josm.tools.I18n.tr;
    44
    5 import java.util.*;
     5import java.util.Collection;
     6import java.util.HashSet;
     7import java.util.Set;
    68
    79import org.openstreetmap.josm.Main;
     
    911import org.openstreetmap.josm.command.DeleteCommand;
    1012import org.openstreetmap.josm.data.osm.Node;
     13import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1114import org.openstreetmap.josm.data.osm.Way;
    12 import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1315import org.openstreetmap.josm.plugins.validator.Severity;
    1416import org.openstreetmap.josm.plugins.validator.Test;
     
    5456                }
    5557            }
    56             for (Way w : Main.ds.ways) {
     58            for (Way w : Main.main.getCurrentDataSet().ways) {
    5759                visit(w);
    5860            }
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java

    r16434 r16629  
    115115    {
    116116        multipolygonways = new LinkedList<Way>();
    117         for (final Relation r : Main.ds.relations)
     117        for (final Relation r : Main.main.getCurrentDataSet().relations)
    118118        {
    119119            if(!r.deleted && !r.incomplete && r.keys != null
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/MultipleNameVisitor.java

    r13497 r16629  
    1010
    1111import org.openstreetmap.josm.data.osm.OsmPrimitive;
    12 import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
    1312import org.openstreetmap.josm.tools.ImageProvider;
    1413
Note: See TracChangeset for help on using the changeset viewer.