Changeset 19505 in osm for applications/editors
- Timestamp:
- 2010-01-13T21:33:51+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java
r19485 r19505 10 10 import java.io.IOException; 11 11 import java.io.PrintWriter; 12 import java.lang.reflect.InvocationTargetException;13 12 import java.util.ArrayList; 14 13 import java.util.Collection; … … 62 61 public class OSMValidatorPlugin extends Plugin implements LayerChangeListener { 63 62 64 protected static OSMValidatorPlugin plugin;65 66 63 protected static ErrorLayer errorLayer = null; 67 64 … … 109 106 public OSMValidatorPlugin(PluginInformation info) { 110 107 super(info); 111 plugin = this;112 108 checkPluginDir(); 113 109 initializeGridDetail(); … … 273 269 try { 274 270 if (test.enabled) { 275 test.getClass().getMethod("initialize", new Class[] { OSMValidatorPlugin.class }).invoke(null, 276 new Object[] { this }); 271 test.initialize(this); 277 272 } 278 } catch (InvocationTargetException ite) {279 ite.getCause().printStackTrace();280 JOptionPane.showMessageDialog(Main.parent,281 tr("Error initializing test {0}:\n {1}", test.getClass()282 .getSimpleName(), ite.getCause().getMessage()),283 tr("Error"),284 JOptionPane.ERROR_MESSAGE);285 273 } catch (Exception e) { 286 274 e.printStackTrace(); -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/Test.java
r19335 r19505 86 86 * @throws Exception When cannot initialize the test 87 87 */ 88 public staticvoid initialize(OSMValidatorPlugin plugin) throws Exception {}88 public void initialize(OSMValidatorPlugin plugin) throws Exception {} 89 89 90 90 /** -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java
r18377 r19505 14 14 import org.openstreetmap.josm.Main; 15 15 import org.openstreetmap.josm.actions.JosmAction; 16 import org.openstreetmap.josm.data.osm.DataSet;17 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 17 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 66 65 return; 67 66 68 OSMValidatorPlugin.plugin.initializeErrorLayer();67 plugin.initializeErrorLayer(); 69 68 70 69 Collection<Test> tests = OSMValidatorPlugin.getEnabledTests(false); … … 91 90 92 91 ValidationTask task = new ValidationTask(tests, selection, lastSelection); 93 Main.worker.submit(task); 92 Main.worker.submit(task); 94 93 } 95 94 … … 98 97 setEnabled(getEditLayer() != null); 99 98 } 100 99 101 100 /** 102 101 * Asynchronous task for running a collection of tests against a collection 103 * of primitives 102 * of primitives 104 103 * 105 104 */ 106 105 107 106 class ValidationTask extends PleaseWaitRunnable { 108 107 private Collection<Test> tests; … … 111 110 private boolean canceled; 112 111 private List<TestError> errors; 113 112 114 113 /** 115 * 116 * @param tests the tests to run 117 * @param validatedPrimitives the collection of primitives to validate. 114 * 115 * @param tests the tests to run 116 * @param validatedPrimitives the collection of primitives to validate. 118 117 * @param formerValidatedPrimitives the last collection of primitives being validates. May be null. 119 118 */ … … 124 123 this.tests = tests; 125 124 } 126 125 127 126 @Override 128 127 protected void cancel() { 129 this.canceled = true; 128 this.canceled = true; 130 129 } 131 130 … … 133 132 protected void finish() { 134 133 if (canceled) return; 135 134 136 135 // update GUI on Swing EDT 137 136 // … … 141 140 plugin.validationDialog.setVisible(true); 142 141 Main.main.getCurrentDataSet().fireSelectionChanged(); 143 } 142 } 144 143 }; 145 144 if (SwingUtilities.isEventDispatchThread()) { 146 r.run(); 145 r.run(); 147 146 } else { 148 147 SwingUtilities.invokeLater(r); … … 153 152 protected void realRun() throws SAXException, IOException, 154 153 OsmTransferException { 155 if (tests == null || tests.isEmpty()) return; 154 if (tests == null || tests.isEmpty()) return; 156 155 errors = new ArrayList<TestError>(200); 157 156 getProgressMonitor().setTicksCount(tests.size() * validatedPrimitmives.size()); 158 157 int testCounter = 0; 159 for (Test test : tests) { 158 for (Test test : tests) { 160 159 if (canceled) return; 161 160 testCounter++; -
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/TagChecker.java
r19335 r19505 76 76 /** The TagChecker data */ 77 77 protected static List<CheckerData> checkerData = new ArrayList<CheckerData>(); 78 protected static ArrayList<String> ignoreDataStartsWith = new ArrayList<String>();79 protected static ArrayList<String> ignoreDataEquals = new ArrayList<String>();80 protected static ArrayList<String> ignoreDataEndsWith = new ArrayList<String>();81 protected static ArrayList<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>();82 protected static ArrayList<IgnoreTwoKeyPair> ignoreDataTwoKeyPair = new ArrayList<IgnoreTwoKeyPair>();78 protected static List<String> ignoreDataStartsWith = new ArrayList<String>(); 79 protected static List<String> ignoreDataEquals = new ArrayList<String>(); 80 protected static List<String> ignoreDataEndsWith = new ArrayList<String>(); 81 protected static List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>(); 82 protected static List<IgnoreTwoKeyPair> ignoreDataTwoKeyPair = new ArrayList<IgnoreTwoKeyPair>(); 83 83 84 84 /** The preferences prefix */ … … 152 152 } 153 153 154 public static void initialize(OSMValidatorPlugin plugin) throws Exception 154 @Override 155 public void initialize(OSMValidatorPlugin plugin) throws Exception 155 156 { 156 157 initializeData();
Note:
See TracChangeset
for help on using the changeset viewer.