Ignore:
Timestamp:
2018-08-18T17:58:01+02:00 (6 years ago)
Author:
donvip
Message:

update to JOSM 14153

Location:
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/GraphViewPlugin.java

    r33842 r34516  
    1717import javax.swing.JOptionPane;
    1818
    19 import org.openstreetmap.josm.Main;
    2019import org.openstreetmap.josm.gui.MainApplication;
    2120import org.openstreetmap.josm.gui.MapFrame;
     
    9796
    9897                if (accessRuleset == null) {
    99                     JOptionPane.showMessageDialog(Main.parent, tr("No ruleset has been selected!"), tr("No ruleset"), JOptionPane.ERROR_MESSAGE);
     98                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("No ruleset has been selected!"), tr("No ruleset"), JOptionPane.ERROR_MESSAGE);
    10099                } else {
    101100                    transitionStructure.setAccessParametersAndRuleset(preferences.getCurrentParameterBookmark(), accessRuleset);
     
    108107
    109108                if (accessRuleset == null) {
    110                     JOptionPane.showMessageDialog(Main.parent, tr("No ruleset has been selected!"),
     109                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("No ruleset has been selected!"),
    111110                            tr("No ruleset"), JOptionPane.ERROR_MESSAGE);
    112111                } else {
     
    129128            }
    130129        } catch (AccessRulesetSyntaxException e) {
    131             JOptionPane.showMessageDialog(Main.parent, tr("Syntax exception in access ruleset:\n{0}", e));
     130            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Syntax exception in access ruleset:\n{0}", e));
    132131            Logging.error(e);
    133132        } catch (FileNotFoundException e) {
    134             JOptionPane.showMessageDialog(Main.parent, tr("File not found:\n{0}", e));
     133            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("File not found:\n{0}", e));
    135134            Logging.error(e);
    136135        } catch (IOException e) {
    137             JOptionPane.showMessageDialog(Main.parent, tr("Problem when accessing a file:\n{0}", e));
     136            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Problem when accessing a file:\n{0}", e));
    138137            Logging.error(e);
    139138        }
     
    148147
    149148                if (accessRuleset == null) {
    150                     JOptionPane.showMessageDialog(Main.parent, tr("No ruleset has been selected!"),
     149                    JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("No ruleset has been selected!"),
    151150                            tr("No ruleset"), JOptionPane.ERROR_MESSAGE);
    152151                } else {
     
    157156            }
    158157        } catch (AccessRulesetSyntaxException e) {
    159             JOptionPane.showMessageDialog(Main.parent, tr("Syntax exception in access ruleset:\n{0}", e));
     158            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Syntax exception in access ruleset:\n{0}", e));
    160159            Logging.error(e);
    161160        } catch (FileNotFoundException e) {
    162             JOptionPane.showMessageDialog(Main.parent, tr("File not found:\n", e));
     161            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("File not found:\n", e));
    163162            Logging.error(e);
    164163        } catch (IOException e) {
    165             JOptionPane.showMessageDialog(Main.parent, tr("Problem when accessing a file:\n{0}", e));
     164            JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Problem when accessing a file:\n{0}", e));
    166165            Logging.error(e);
    167166        }
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/layer/GraphViewLayer.java

    r32620 r34516  
    1818import javax.swing.Icon;
    1919
    20 import org.openstreetmap.josm.Main;
    2120import org.openstreetmap.josm.actions.RenameLayerAction;
    2221import org.openstreetmap.josm.data.Bounds;
     
    2423import org.openstreetmap.josm.data.coor.LatLon;
    2524import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     25import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    2626import org.openstreetmap.josm.gui.MapView;
    2727import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    319319    private static Point getNodePoint(LatLonCoords coords, MapView mv) {
    320320        LatLon latLon = new LatLon(coords.getLat(), coords.getLon());
    321         EastNorth eastNorth = Main.getProjection().latlon2eastNorth(latLon);
     321        EastNorth eastNorth = ProjectionRegistry.getProjection().latlon2eastNorth(latLon);
    322322        return mv.getPoint(eastNorth);
    323323    }
  • applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/GraphViewPreferences.java

    r33842 r34516  
    2525import java.util.regex.Pattern;
    2626
    27 import org.openstreetmap.josm.Main;
    2827import org.openstreetmap.josm.data.preferences.NamedColorProperty;
    2928import org.openstreetmap.josm.plugins.graphview.core.access.AccessParameters;
     
    3332import org.openstreetmap.josm.plugins.graphview.plugin.layer.PreferencesColorScheme;
    3433import org.openstreetmap.josm.plugins.graphview.plugin.preferences.VehiclePropertyStringParser.PropertyValueSyntaxException;
     34import org.openstreetmap.josm.spi.preferences.Config;
    3535
    3636/**
     
    252252    private void writePreferences() {
    253253
    254         Main.pref.put("graphview.parameterBookmarks",
     254        Config.getPref().put("graphview.parameterBookmarks",
    255255                createAccessParameterBookmarksString(parameterBookmarks));
    256256
    257257        if (currentParameterBookmarkName != null) {
    258             Main.pref.put("graphview.activeBookmark", currentParameterBookmarkName);
    259         }
    260 
    261         Main.pref.putBoolean("graphview.useInternalRulesets", useInternalRulesets);
    262 
    263         Main.pref.put("graphview.rulesetFolder", rulesetFolder.getPath());
     258            Config.getPref().put("graphview.activeBookmark", currentParameterBookmarkName);
     259        }
     260
     261        Config.getPref().putBoolean("graphview.useInternalRulesets", useInternalRulesets);
     262
     263        Config.getPref().put("graphview.rulesetFolder", rulesetFolder.getPath());
    264264
    265265        if (currentRulesetFile != null) {
    266             Main.pref.put("graphview.rulesetFile", currentRulesetFile.getPath());
     266            Config.getPref().put("graphview.rulesetFile", currentRulesetFile.getPath());
    267267        }
    268268        if (currentInternalRuleset != null) {
    269             Main.pref.put("graphview.rulesetResource", currentInternalRuleset.toString());
    270         }
    271 
    272         Main.pref.putBoolean("graphview.separateDirections", separateDirections);
    273 
    274         Main.pref.putDouble("graphview.arrowheadPlacement", arrowheadPlacement);
     269            Config.getPref().put("graphview.rulesetResource", currentInternalRuleset.toString());
     270        }
     271
     272        Config.getPref().putBoolean("graphview.separateDirections", separateDirections);
     273
     274        Config.getPref().putDouble("graphview.arrowheadPlacement", arrowheadPlacement);
    275275
    276276    }
     
    278278    private void readPreferences() {
    279279
    280         if (!Main.pref.get("graphview.parameterBookmarks").isEmpty()) {
    281             String bookmarksString = Main.pref.get("graphview.parameterBookmarks");
     280        if (!Config.getPref().get("graphview.parameterBookmarks").isEmpty()) {
     281            String bookmarksString = Config.getPref().get("graphview.parameterBookmarks");
    282282            parameterBookmarks = parseAccessParameterBookmarksString(bookmarksString);
    283283        }
    284284
    285         if (!Main.pref.get("graphview.activeBookmark").isEmpty()) {
    286             currentParameterBookmarkName = Main.pref.get("graphview.activeBookmark");
     285        if (!Config.getPref().get("graphview.activeBookmark").isEmpty()) {
     286            currentParameterBookmarkName = Config.getPref().get("graphview.activeBookmark");
    287287        }
    288288        if (!parameterBookmarks.containsKey(currentParameterBookmarkName)) {
     
    291291
    292292
    293         useInternalRulesets = Main.pref.getBoolean("graphview.useInternalRulesets", true);
    294 
    295         if (!Main.pref.get("graphview.rulesetFolder").isEmpty()) {
    296             String dirString = Main.pref.get("graphview.rulesetFolder");
     293        useInternalRulesets = Config.getPref().getBoolean("graphview.useInternalRulesets", true);
     294
     295        if (!Config.getPref().get("graphview.rulesetFolder").isEmpty()) {
     296            String dirString = Config.getPref().get("graphview.rulesetFolder");
    297297            rulesetFolder = new File(dirString);
    298298        }
    299         if (!Main.pref.get("graphview.rulesetFile").isEmpty()) {
    300             String fileString = Main.pref.get("graphview.rulesetFile");
     299        if (!Config.getPref().get("graphview.rulesetFile").isEmpty()) {
     300            String fileString = Config.getPref().get("graphview.rulesetFile");
    301301            currentRulesetFile = new File(fileString);
    302302        }
    303303
    304         if (!Main.pref.get("graphview.rulesetResource").isEmpty()) {
    305             String rulesetString = Main.pref.get("graphview.rulesetResource");
     304        if (!Config.getPref().get("graphview.rulesetResource").isEmpty()) {
     305            String rulesetString = Config.getPref().get("graphview.rulesetResource");
    306306            //get the enum value for the string
    307307            //(InternalRuleset.valueOf cannot be used because it cannot handle invalid strings well)
     
    317317        segmentColor = new NamedColorProperty(marktr("graphview default segment"), Color.WHITE).get();
    318318        arrowheadFillColor = new NamedColorProperty(marktr("graphview arrowhead core"), Color.BLACK).get();
    319         separateDirections = Main.pref.getBoolean("graphview.separateDirections", false);
    320 
    321         arrowheadPlacement = Main.pref.getDouble("graphview.arrowheadPlacement", 1.0);
     319        separateDirections = Config.getPref().getBoolean("graphview.separateDirections", false);
     320
     321        arrowheadPlacement = Config.getPref().getDouble("graphview.arrowheadPlacement", 1.0);
    322322        if (arrowheadPlacement < 0.0 || arrowheadPlacement >= 1.0) {
    323323            arrowheadPlacement = 1.0;
Note: See TracChangeset for help on using the changeset viewer.