Changeset 33786 in osm for applications
- Timestamp:
- 2017-11-05T19:56:06+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/mapdust
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapdust/.project
r32787 r33786 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <projectDescription> 3 <name>JOSM-mapdust</name> 4 <comment></comment> 5 <projects> 6 </projects> 7 <buildSpec> 8 <buildCommand> 9 <name>org.eclipse.jdt.core.javabuilder</name> 10 <arguments> 11 </arguments> 12 </buildCommand> 13 <buildCommand> 14 <name>org.sonarlint.eclipse.core.sonarlintBuilder</name> 15 <arguments> 16 </arguments> 17 </buildCommand> 18 <buildCommand> 19 <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> 20 <arguments> 21 </arguments> 22 </buildCommand> 23 </buildSpec> 24 <natures> 25 <nature>org.eclipse.jdt.core.javanature</nature> 26 <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> 27 </natures> 3 <name>JOSM-mapdust</name> 4 <comment></comment> 5 <projects> 6 </projects> 7 <buildSpec> 8 <buildCommand> 9 <name>org.eclipse.jdt.core.javabuilder</name> 10 <arguments> 11 </arguments> 12 </buildCommand> 13 <buildCommand> 14 <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> 15 <arguments> 16 </arguments> 17 </buildCommand> 18 </buildSpec> 19 <natures> 20 <nature>org.eclipse.jdt.core.javanature</nature> 21 <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> 22 </natures> 28 23 </projectDescription> -
applications/editors/josm/plugins/mapdust/build.xml
r32787 r33786 3 3 <!-- properties --> 4 4 <property name="commit.message" value="MapDust bug reporter plugin"/> 5 <property name="plugin.main.version" value="1 0580"/>5 <property name="plugin.main.version" value="12881"/> 6 6 <property name="apidoc.dir" value="doc"/> 7 7 -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java
r32787 r33786 42 42 import org.openstreetmap.josm.Main; 43 43 import org.openstreetmap.josm.data.Bounds; 44 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 45 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 46 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 44 import org.openstreetmap.josm.data.UserIdentityManager; 45 import org.openstreetmap.josm.gui.MainApplication; 47 46 import org.openstreetmap.josm.gui.MapFrame; 48 47 import org.openstreetmap.josm.gui.MapView; … … 66 65 import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBugFilter; 67 66 import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustRelevance; 67 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent; 68 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; 68 69 import org.openstreetmap.josm.tools.Shortcut; 69 70 … … 131 132 Main.pref.put("mapdust.pluginState", MapdustPluginState.ONLINE.getValue()); 132 133 Main.pref.put("mapdust.nickname", ""); 133 Main.pref.put ("mapdust.showError", true);134 Main.pref.putBoolean("mapdust.showError", true); 134 135 Main.pref.put("mapdust.version", getPluginInformation().version); 135 136 Main.pref.put("mapdust.localVersion", getPluginInformation().localversion); … … 157 158 /* add Listeners */ 158 159 NavigatableComponent.addZoomChangeListener(this); 159 Main .getLayerManager().addLayerChangeListener(this);160 MainApplication.getLayerManager().addLayerChangeListener(this); 160 161 newMapFrame.mapView.addMouseListener(this); 161 162 /* put username to preferences */ 162 Main.pref.put("mapdust.josmUserName", JosmUserIdentityManager.getInstance().getUserName());163 Main.pref.put("mapdust.josmUserName", UserIdentityManager.getInstance().getUserName()); 163 164 } else { 164 165 /* if new MapFrame is null, remove listener */ 165 166 oldMapFrame.mapView.removeMouseListener(this); 166 Main .getLayerManager().removeLayerChangeListener(this);167 MainApplication.getLayerManager().removeLayerChangeListener(this); 167 168 NavigatableComponent.removeZoomChangeListener(this); 168 169 mapdustGUI.removeObserver(this); … … 186 187 && mapdustLayer.isVisible()) { 187 188 if (event.getKey().equals("osm-server.username")) { 188 String newUserName = JosmUserIdentityManager.getInstance().getUserName();189 String newUserName = UserIdentityManager.getInstance().getUserName(); 189 190 String oldUserName = Main.pref.get("mapdust.josmUserName"); 190 191 String nickname = Main.pref.get("mapdust.nickname"); … … 222 223 } 223 224 if (getMapdustGUI().isDialogShowing()) { 224 if (Main .map != null && Main.map.mapView != null) {225 if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) { 225 226 MapdustBug oldBug = null; 226 227 for (MapdustBug bug : mapdustBugList) { … … 251 252 mapdustLayer.setBugSelected(null); 252 253 mapdustGUI.enableBtnPanel(true); 253 Main .map.mapView.repaint();254 MainApplication.getMap().mapView.repaint(); 254 255 String title = "MapDust"; 255 256 String message = "The operation was successful."; … … 368 369 if (event.getButton() == MouseEvent.BUTTON1) { 369 370 if (event.getClickCount() == 2 && !event.isConsumed()) { 370 if (Main .getLayerManager().getActiveLayer() == getMapdustLayer()) {371 if (MainApplication.getLayerManager().getActiveLayer() == getMapdustLayer()) { 371 372 /* show add bug dialog */ 372 373 MapdustBug bug = mapdustGUI.getSelectedBug(); … … 394 395 /* set also in the list of bugs the element */ 395 396 mapdustGUI.setSelectedBug(nearestBug); 396 Main .map.mapView.repaint();397 MainApplication.getMap().mapView.repaint(); 397 398 } 398 399 return; … … 414 415 MapdustBug nearestBug = null; 415 416 for (MapdustBug bug : mapdustBugList) { 416 Point sp = Main .map.mapView.getPoint(bug.getLatLon());417 Point sp = MainApplication.getMap().mapView.getPoint(bug.getLatLon()); 417 418 double dist = p.distanceSq(sp); 418 419 if (minDistanceSq > dist && p.distance(sp) < snapDistance) { … … 454 455 NavigatableComponent.removeZoomChangeListener(this); 455 456 if (mapdustGUI != null) { 456 Main .map.remove(mapdustGUI);457 MainApplication.getMap().remove(mapdustGUI); 457 458 mapdustGUI.destroy(); 458 459 } … … 518 519 */ 519 520 private BoundingBox getBBox() { 520 MapView mapView = Main .map.mapView;521 MapView mapView = MainApplication.getMap().mapView; 521 522 Bounds bounds = new Bounds(mapView.getLatLon(0, mapView.getHeight()), 522 523 mapView.getLatLon(mapView.getWidth(), 0)); … … 531 532 */ 532 533 private void updatePluginData() { 533 Main .worker.execute(new Runnable() {534 MainApplication.worker.execute(new Runnable() { 534 535 @Override 535 536 public void run() { … … 537 538 } 538 539 }); 539 540 540 } 541 541 … … 546 546 */ 547 547 protected synchronized void updateMapdustData() { 548 if (Main .map != null && Main.map.mapView != null) {549 /* Down -loads the MapDust data */548 if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) { 549 /* Downloads the MapDust data */ 550 550 try { 551 551 MapdustServiceHandler handler = new MapdustServiceHandler(); … … 568 568 } 569 569 }); 570 571 } 572 } 573 570 } 571 } 574 572 575 573 /** … … 578 576 */ 579 577 protected void updateView() { 580 if (Main .map != null && Main.map.mapView != null) {578 if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) { 581 579 /* update the MapdustLayer */ 582 580 boolean needRepaint = false; … … 588 586 mapdustLayer = new MapdustLayer("MapDust", mapdustGUI, 589 587 mapdustBugList); 590 Main .getLayerManager().addLayer(this.mapdustLayer);591 Main .map.mapView.moveLayer(this.mapdustLayer, 0);592 Main .map.mapView.addMouseListener(this);588 MainApplication.getLayerManager().addLayer(this.mapdustLayer); 589 MainApplication.getMap().mapView.moveLayer(this.mapdustLayer, 0); 590 MainApplication.getMap().mapView.addMouseListener(this); 593 591 NavigatableComponent.addZoomChangeListener(this); 594 592 needRepaint = true; … … 606 604 /* force repaint */ 607 605 mapdustGUI.revalidate(); 608 Main .map.mapView.revalidate();609 Main .map.repaint();606 MainApplication.getMap().mapView.revalidate(); 607 MainApplication.getMap().repaint(); 610 608 } 611 609 } … … 620 618 */ 621 619 private boolean containsMapdustLayer() { 622 return mapdustLayer != null && Main .getLayerManager().containsLayer(mapdustLayer);620 return mapdustLayer != null && MainApplication.getLayerManager().containsLayer(mapdustLayer); 623 621 } 624 622 … … 631 629 if (showErrorMessage) { 632 630 /* show errprMessage, and remove the layer */ 633 Main.pref.put ("mapdust.showError", false);631 Main.pref.putBoolean("mapdust.showError", false); 634 632 String errorMessage = "There was a Mapdust service error."; 635 633 errorMessage += " Please try later."; -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java
r33231 r33786 37 37 import javax.swing.JTabbedPane; 38 38 import org.openstreetmap.josm.Main; 39 import org.openstreetmap.josm.gui.MainApplication; 39 40 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; 40 41 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin; … … 194 195 } 195 196 revalidate(); 196 Main .map.mapView.revalidate();197 Main .map.repaint();197 MainApplication.getMap().mapView.revalidate(); 198 MainApplication.getMap().repaint(); 198 199 } 199 200 -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteAddBug.java
r30737 r33786 37 37 import org.openstreetmap.josm.Main; 38 38 import org.openstreetmap.josm.data.coor.LatLon; 39 import org.openstreetmap.josm.gui.MainApplication; 39 40 import org.openstreetmap.josm.plugins.mapdust.gui.MapdustGUI; 40 41 import org.openstreetmap.josm.plugins.mapdust.gui.component.dialog.CreateBugDialog; … … 120 121 LatLon latlon = null; 121 122 if (p != null) { 122 latlon = Main .map.mapView.getLatLon(p.x, p.y);123 latlon = MainApplication.getMap().mapView.getLatLon(p.x, p.y); 123 124 } 124 125 MapdustBug bug = new MapdustBug(latlon, type, commentText, -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteRefresh.java
r32787 r33786 72 72 JToggleButton btn = (JToggleButton) event.getSource(); 73 73 /* update the bugs */ 74 Main.pref.put ("mapdust.showError", true);74 Main.pref.putBoolean("mapdust.showError", true); 75 75 notifyObservers(null, false); 76 76 btn.setSelected(false); -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java
r32787 r33786 43 43 import javax.swing.event.ListSelectionListener; 44 44 import org.openstreetmap.josm.Main; 45 import org.openstreetmap.josm.gui.MainApplication; 45 46 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin; 46 47 import org.openstreetmap.josm.plugins.mapdust.gui.MapdustGUI; … … 272 273 } 273 274 /* re-paint */ 274 Main .map.mapView.repaint();275 MainApplication.getMap().mapView.repaint(); 275 276 mapdustGUI.repaint(); 276 277 } else { -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/http/HttpConnector.java
r33232 r33786 44 44 import org.openstreetmap.josm.plugins.mapdust.util.retry.RetryAgent; 45 45 import org.openstreetmap.josm.plugins.mapdust.util.retry.RetrySetup; 46 import org.openstreetmap.josm.tools.Logging; 46 47 47 48 … … 234 235 postParameters.get(key), "utf-8")); 235 236 } catch (UnsupportedEncodingException e) { 236 Main.error(e);237 Logging.error(e); 237 238 } 238 239 i++; -
applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/retry/RetryAgent.java
r32787 r33786 29 29 30 30 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.tools.Logging; 31 32 32 33 /** … … 130 131 Thread.sleep(delay); 131 132 } catch (InterruptedException e1) { 132 Main.error(e1);133 Logging.error(e1); 133 134 // throw e; 134 135 } … … 140 141 } catch (Exception e) { 141 142 /* if it can't be cleaned up, there's nothing to do */ 142 Main.error("Could not clean up", e);143 Logging.error("Could not clean up", e); 143 144 } 144 145 } … … 157 158 T result = null; 158 159 boolean success = false; 159 intdelay = setup.getBaseDelay();160 intmaxTime = setup.getStopCondition();160 long delay = setup.getBaseDelay(); 161 long maxTime = setup.getStopCondition(); 161 162 do { 162 163 long time = System.currentTimeMillis(); … … 173 174 Thread.sleep(delay); 174 175 } catch (InterruptedException e1) { 175 Main.error(e1);176 Logging.error(e1); 176 177 throw e; 177 178 } … … 183 184 } catch (Exception e) { 184 185 /* if it can't be cleaned up, there's nothing to do */ 185 Main.error("Could not clean up", e);186 Logging.log(Logging.LEVEL_ERROR, "Could not clean up", e); 186 187 } 187 188 }
Note:
See TracChangeset
for help on using the changeset viewer.