Changeset 33786 in osm


Ignore:
Timestamp:
2017-11-05T19:56:06+01:00 (7 years ago)
Author:
donvip
Message:

update to JOSM 12881

Location:
applications/editors/josm/plugins/mapdust
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapdust/.project

    r32787 r33786  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<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>
    2823</projectDescription>
  • applications/editors/josm/plugins/mapdust/build.xml

    r32787 r33786  
    33    <!-- properties -->
    44    <property name="commit.message" value="MapDust bug reporter plugin"/>
    5     <property name="plugin.main.version" value="10580"/>
     5    <property name="plugin.main.version" value="12881"/>
    66    <property name="apidoc.dir" value="doc"/>
    77
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java

    r32787 r33786  
    4242import org.openstreetmap.josm.Main;
    4343import 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;
     44import org.openstreetmap.josm.data.UserIdentityManager;
     45import org.openstreetmap.josm.gui.MainApplication;
    4746import org.openstreetmap.josm.gui.MapFrame;
    4847import org.openstreetmap.josm.gui.MapView;
     
    6665import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBugFilter;
    6766import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustRelevance;
     67import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent;
     68import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener;
    6869import org.openstreetmap.josm.tools.Shortcut;
    6970
     
    131132        Main.pref.put("mapdust.pluginState", MapdustPluginState.ONLINE.getValue());
    132133        Main.pref.put("mapdust.nickname", "");
    133         Main.pref.put("mapdust.showError", true);
     134        Main.pref.putBoolean("mapdust.showError", true);
    134135        Main.pref.put("mapdust.version", getPluginInformation().version);
    135136        Main.pref.put("mapdust.localVersion", getPluginInformation().localversion);
     
    157158            /* add Listeners */
    158159            NavigatableComponent.addZoomChangeListener(this);
    159             Main.getLayerManager().addLayerChangeListener(this);
     160            MainApplication.getLayerManager().addLayerChangeListener(this);
    160161            newMapFrame.mapView.addMouseListener(this);
    161162            /* put username to preferences */
    162             Main.pref.put("mapdust.josmUserName", JosmUserIdentityManager.getInstance().getUserName());
     163            Main.pref.put("mapdust.josmUserName", UserIdentityManager.getInstance().getUserName());
    163164        } else {
    164165            /* if new MapFrame is null, remove listener */
    165166            oldMapFrame.mapView.removeMouseListener(this);
    166             Main.getLayerManager().removeLayerChangeListener(this);
     167            MainApplication.getLayerManager().removeLayerChangeListener(this);
    167168            NavigatableComponent.removeZoomChangeListener(this);
    168169            mapdustGUI.removeObserver(this);
     
    186187                && mapdustLayer.isVisible()) {
    187188            if (event.getKey().equals("osm-server.username")) {
    188                 String newUserName = JosmUserIdentityManager.getInstance().getUserName();
     189                String newUserName = UserIdentityManager.getInstance().getUserName();
    189190                String oldUserName = Main.pref.get("mapdust.josmUserName");
    190191                String nickname = Main.pref.get("mapdust.nickname");
     
    222223        }
    223224        if (getMapdustGUI().isDialogShowing()) {
    224             if (Main.map != null && Main.map.mapView != null) {
     225            if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) {
    225226                MapdustBug oldBug = null;
    226227                for (MapdustBug bug : mapdustBugList) {
     
    251252                    mapdustLayer.setBugSelected(null);
    252253                    mapdustGUI.enableBtnPanel(true);
    253                     Main.map.mapView.repaint();
     254                    MainApplication.getMap().mapView.repaint();
    254255                    String title = "MapDust";
    255256                    String message = "The operation was successful.";
     
    368369            if (event.getButton() == MouseEvent.BUTTON1) {
    369370                if (event.getClickCount() == 2 && !event.isConsumed()) {
    370                     if (Main.getLayerManager().getActiveLayer() == getMapdustLayer()) {
     371                    if (MainApplication.getLayerManager().getActiveLayer() == getMapdustLayer()) {
    371372                        /* show add bug dialog */
    372373                        MapdustBug bug = mapdustGUI.getSelectedBug();
     
    394395                        /* set also in the list of bugs the element */
    395396                        mapdustGUI.setSelectedBug(nearestBug);
    396                         Main.map.mapView.repaint();
     397                        MainApplication.getMap().mapView.repaint();
    397398                    }
    398399                    return;
     
    414415        MapdustBug nearestBug = null;
    415416        for (MapdustBug bug : mapdustBugList) {
    416             Point sp = Main.map.mapView.getPoint(bug.getLatLon());
     417            Point sp = MainApplication.getMap().mapView.getPoint(bug.getLatLon());
    417418            double dist = p.distanceSq(sp);
    418419            if (minDistanceSq > dist && p.distance(sp) < snapDistance) {
     
    454455            NavigatableComponent.removeZoomChangeListener(this);
    455456            if (mapdustGUI != null) {
    456                 Main.map.remove(mapdustGUI);
     457                MainApplication.getMap().remove(mapdustGUI);
    457458                mapdustGUI.destroy();
    458459            }
     
    518519     */
    519520    private BoundingBox getBBox() {
    520         MapView mapView = Main.map.mapView;
     521        MapView mapView = MainApplication.getMap().mapView;
    521522        Bounds bounds = new Bounds(mapView.getLatLon(0, mapView.getHeight()),
    522523                mapView.getLatLon(mapView.getWidth(), 0));
     
    531532     */
    532533    private void updatePluginData() {
    533         Main.worker.execute(new Runnable() {
     534        MainApplication.worker.execute(new Runnable() {
    534535            @Override
    535536            public void run() {
     
    537538            }
    538539        });
    539 
    540540    }
    541541
     
    546546     */
    547547    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 */
    550550            try {
    551551                MapdustServiceHandler handler = new MapdustServiceHandler();
     
    568568                }
    569569            });
    570 
    571         }
    572     }
    573 
     570        }
     571    }
    574572
    575573    /**
     
    578576     */
    579577    protected void updateView() {
    580         if (Main.map != null && Main.map.mapView != null) {
     578        if (MainApplication.getMap() != null && MainApplication.getMap().mapView != null) {
    581579            /* update the MapdustLayer */
    582580            boolean needRepaint = false;
     
    588586                    mapdustLayer = new MapdustLayer("MapDust", mapdustGUI,
    589587                            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);
    593591                    NavigatableComponent.addZoomChangeListener(this);
    594592                    needRepaint = true;
     
    606604                /* force repaint */
    607605                mapdustGUI.revalidate();
    608                 Main.map.mapView.revalidate();
    609                 Main.map.repaint();
     606                MainApplication.getMap().mapView.revalidate();
     607                MainApplication.getMap().repaint();
    610608            }
    611609        }
     
    620618     */
    621619    private boolean containsMapdustLayer() {
    622         return mapdustLayer != null && Main.getLayerManager().containsLayer(mapdustLayer);
     620        return mapdustLayer != null && MainApplication.getLayerManager().containsLayer(mapdustLayer);
    623621    }
    624622
     
    631629        if (showErrorMessage) {
    632630            /* show errprMessage, and remove the layer */
    633             Main.pref.put("mapdust.showError", false);
     631            Main.pref.putBoolean("mapdust.showError", false);
    634632            String errorMessage = "There was a Mapdust service error.";
    635633            errorMessage += " Please try later.";
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java

    r33231 r33786  
    3737import javax.swing.JTabbedPane;
    3838import org.openstreetmap.josm.Main;
     39import org.openstreetmap.josm.gui.MainApplication;
    3940import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
    4041import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin;
     
    194195        }
    195196        revalidate();
    196         Main.map.mapView.revalidate();
    197         Main.map.repaint();
     197        MainApplication.getMap().mapView.revalidate();
     198        MainApplication.getMap().repaint();
    198199    }
    199200
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteAddBug.java

    r30737 r33786  
    3737import org.openstreetmap.josm.Main;
    3838import org.openstreetmap.josm.data.coor.LatLon;
     39import org.openstreetmap.josm.gui.MainApplication;
    3940import org.openstreetmap.josm.plugins.mapdust.gui.MapdustGUI;
    4041import org.openstreetmap.josm.plugins.mapdust.gui.component.dialog.CreateBugDialog;
     
    120121            LatLon latlon = null;
    121122            if (p != null) {
    122                 latlon = Main.map.mapView.getLatLon(p.x, p.y);
     123                latlon = MainApplication.getMap().mapView.getLatLon(p.x, p.y);
    123124            }
    124125            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  
    7272            JToggleButton btn = (JToggleButton) event.getSource();
    7373            /* update the bugs */
    74             Main.pref.put("mapdust.showError", true);
     74            Main.pref.putBoolean("mapdust.showError", true);
    7575            notifyObservers(null, false);
    7676            btn.setSelected(false);
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java

    r32787 r33786  
    4343import javax.swing.event.ListSelectionListener;
    4444import org.openstreetmap.josm.Main;
     45import org.openstreetmap.josm.gui.MainApplication;
    4546import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin;
    4647import org.openstreetmap.josm.plugins.mapdust.gui.MapdustGUI;
     
    272273            }
    273274            /* re-paint */
    274             Main.map.mapView.repaint();
     275            MainApplication.getMap().mapView.repaint();
    275276            mapdustGUI.repaint();
    276277        } else {
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/http/HttpConnector.java

    r33232 r33786  
    4444import org.openstreetmap.josm.plugins.mapdust.util.retry.RetryAgent;
    4545import org.openstreetmap.josm.plugins.mapdust.util.retry.RetrySetup;
     46import org.openstreetmap.josm.tools.Logging;
    4647
    4748
     
    234235                        postParameters.get(key), "utf-8"));
    235236            } catch (UnsupportedEncodingException e) {
    236                 Main.error(e);
     237                Logging.error(e);
    237238            }
    238239            i++;
  • applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/retry/RetryAgent.java

    r32787 r33786  
    2929
    3030import org.openstreetmap.josm.Main;
     31import org.openstreetmap.josm.tools.Logging;
    3132
    3233/**
     
    130131                        Thread.sleep(delay);
    131132                    } catch (InterruptedException e1) {
    132                         Main.error(e1);
     133                        Logging.error(e1);
    133134                        // throw e;
    134135                    }
     
    140141                } catch (Exception e) {
    141142                    /* 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);
    143144                }
    144145            }
     
    157158        T result = null;
    158159        boolean success = false;
    159         int delay = setup.getBaseDelay();
    160         int maxTime = setup.getStopCondition();
     160        long delay = setup.getBaseDelay();
     161        long maxTime = setup.getStopCondition();
    161162        do {
    162163            long time = System.currentTimeMillis();
     
    173174                        Thread.sleep(delay);
    174175                    } catch (InterruptedException e1) {
    175                         Main.error(e1);
     176                        Logging.error(e1);
    176177                        throw e;
    177178                    }
     
    183184                } catch (Exception e) {
    184185                    /* 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);
    186187                }
    187188            }
Note: See TracChangeset for help on using the changeset viewer.