Changeset 34516 in osm for applications/editors/josm/plugins/graphview/src
- Timestamp:
- 2018-08-18T17:58:01+02:00 (6 years ago)
- 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 17 17 import javax.swing.JOptionPane; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.gui.MainApplication; 21 20 import org.openstreetmap.josm.gui.MapFrame; … … 97 96 98 97 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); 100 99 } else { 101 100 transitionStructure.setAccessParametersAndRuleset(preferences.getCurrentParameterBookmark(), accessRuleset); … … 108 107 109 108 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!"), 111 110 tr("No ruleset"), JOptionPane.ERROR_MESSAGE); 112 111 } else { … … 129 128 } 130 129 } 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)); 132 131 Logging.error(e); 133 132 } 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)); 135 134 Logging.error(e); 136 135 } 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)); 138 137 Logging.error(e); 139 138 } … … 148 147 149 148 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!"), 151 150 tr("No ruleset"), JOptionPane.ERROR_MESSAGE); 152 151 } else { … … 157 156 } 158 157 } 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)); 160 159 Logging.error(e); 161 160 } 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)); 163 162 Logging.error(e); 164 163 } 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)); 166 165 Logging.error(e); 167 166 } -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/layer/GraphViewLayer.java
r32620 r34516 18 18 import javax.swing.Icon; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.actions.RenameLayerAction; 22 21 import org.openstreetmap.josm.data.Bounds; … … 24 23 import org.openstreetmap.josm.data.coor.LatLon; 25 24 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 25 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 26 26 import org.openstreetmap.josm.gui.MapView; 27 27 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; … … 319 319 private static Point getNodePoint(LatLonCoords coords, MapView mv) { 320 320 LatLon latLon = new LatLon(coords.getLat(), coords.getLon()); 321 EastNorth eastNorth = Main.getProjection().latlon2eastNorth(latLon);321 EastNorth eastNorth = ProjectionRegistry.getProjection().latlon2eastNorth(latLon); 322 322 return mv.getPoint(eastNorth); 323 323 } -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/GraphViewPreferences.java
r33842 r34516 25 25 import java.util.regex.Pattern; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 29 28 import org.openstreetmap.josm.plugins.graphview.core.access.AccessParameters; … … 33 32 import org.openstreetmap.josm.plugins.graphview.plugin.layer.PreferencesColorScheme; 34 33 import org.openstreetmap.josm.plugins.graphview.plugin.preferences.VehiclePropertyStringParser.PropertyValueSyntaxException; 34 import org.openstreetmap.josm.spi.preferences.Config; 35 35 36 36 /** … … 252 252 private void writePreferences() { 253 253 254 Main.pref.put("graphview.parameterBookmarks",254 Config.getPref().put("graphview.parameterBookmarks", 255 255 createAccessParameterBookmarksString(parameterBookmarks)); 256 256 257 257 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()); 264 264 265 265 if (currentRulesetFile != null) { 266 Main.pref.put("graphview.rulesetFile", currentRulesetFile.getPath());266 Config.getPref().put("graphview.rulesetFile", currentRulesetFile.getPath()); 267 267 } 268 268 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); 275 275 276 276 } … … 278 278 private void readPreferences() { 279 279 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"); 282 282 parameterBookmarks = parseAccessParameterBookmarksString(bookmarksString); 283 283 } 284 284 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"); 287 287 } 288 288 if (!parameterBookmarks.containsKey(currentParameterBookmarkName)) { … … 291 291 292 292 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"); 297 297 rulesetFolder = new File(dirString); 298 298 } 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"); 301 301 currentRulesetFile = new File(fileString); 302 302 } 303 303 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"); 306 306 //get the enum value for the string 307 307 //(InternalRuleset.valueOf cannot be used because it cannot handle invalid strings well) … … 317 317 segmentColor = new NamedColorProperty(marktr("graphview default segment"), Color.WHITE).get(); 318 318 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); 322 322 if (arrowheadPlacement < 0.0 || arrowheadPlacement >= 1.0) { 323 323 arrowheadPlacement = 1.0;
Note:
See TracChangeset
for help on using the changeset viewer.