Changeset 34452 in osm for applications/editors/josm
- Timestamp:
- 2018-08-13T21:54:52+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/.classpath
r34131 r34452 10 10 <classpathentry kind="src" path="modules/fr.toulouse/resources"/> 11 11 <classpathentry kind="src" path="util"/> 12 <classpathentry kind="src" path="test/unit"/> 12 <classpathentry kind="src" output="bintest" path="test/unit"> 13 <attributes> 14 <attribute name="test" value="true"/> 15 </attributes> 16 </classpathentry> 13 17 <classpathentry combineaccessrules="false" kind="src" path="/JOSM"/> 14 18 <classpathentry combineaccessrules="false" kind="src" path="/JOSM-utilsplugin2"/> -
applications/editors/josm/plugins/opendata/.settings/org.eclipse.wst.validation.prefs
r33379 r34452 2 2 USER_BUILD_PREFERENCE=enabledBuildValidatorList 3 3 USER_MANUAL_PREFERENCE=enabledManualValidatorList 4 USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.70 0.v2015082517494 USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.701.v201707142105 5 5 eclipse.preferences.version=1 6 6 override=true 7 7 suspend=false 8 8 vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01 9 vals/org.eclipse.wst.html.core.HTMLValidator/global=FF01 9 10 vals/org.eclipse.wst.xml.core.xml/global=FF03 10 11 vals/org.eclipse.wst.xsd.core.xsd/global=FF02162org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator -
applications/editors/josm/plugins/opendata/build.xml
r34409 r34452 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <project name="opendata" default="dist" basedir="."> 3 <property name="plugin.main.version" value="1 3927"/>3 <property name="plugin.main.version" value="14153"/> 4 4 <property name="plugin.author" value="Don-vip"/> 5 5 <property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/> -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java
r33790 r34452 14 14 import javax.swing.JMenuItem; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.actions.ExtensionFileFilter; 18 17 import org.openstreetmap.josm.gui.MainApplication; 18 import org.openstreetmap.josm.gui.MainFrame; 19 19 import org.openstreetmap.josm.gui.MainMenu; 20 20 import org.openstreetmap.josm.gui.MapFrame; … … 187 187 188 188 private void loadModules() { 189 List<ModuleInformation> modulesToLoad = ModuleHandler.buildListOfModulesToLoad(Main.parent); 190 if (!modulesToLoad.isEmpty() && ModuleHandler.checkAndConfirmModuleUpdate(Main.parent)) { 191 modulesToLoad = ModuleHandler.updateModules(Main.parent, modulesToLoad, null); 189 MainFrame parent = MainApplication.getMainFrame(); 190 List<ModuleInformation> modulesToLoad = ModuleHandler.buildListOfModulesToLoad(parent); 191 if (!modulesToLoad.isEmpty() && ModuleHandler.checkAndConfirmModuleUpdate(parent)) { 192 modulesToLoad = ModuleHandler.updateModules(parent, modulesToLoad, null); 192 193 } 193 194 194 195 ModuleHandler.installDownloadedModules(true); 195 ModuleHandler.loadModules( Main.parent, modulesToLoad, null);196 ModuleHandler.loadModules(parent, modulesToLoad, null); 196 197 } 197 198 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataTask.java
r34292 r34452 11 11 import javax.swing.JOptionPane; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 15 14 import org.openstreetmap.josm.actions.downloadtasks.DownloadParams; … … 118 117 119 118 } catch (IOException e) { 120 JOptionPane.showMessageDialog(Main .parent, tr("License URL not available: {0}", license.toString()));119 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("License URL not available: {0}", license.toString())); 121 120 return false; 122 121 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenPreferencesActions.java
r30806 r34452 7 7 import java.awt.event.KeyEvent; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.actions.JosmAction; 10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.gui.preferences.PreferenceDialog; 12 12 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; … … 15 15 16 16 public class OpenPreferencesActions extends JosmAction { 17 17 18 18 public OpenPreferencesActions() { 19 super(tr("OpenData preferences"), OdConstants.ICON_CORE_24, null, 19 super(tr("OpenData preferences"), OdConstants.ICON_CORE_24, null, 20 20 Shortcut.registerShortcut("opendata_open_preferences", tr("OpenData preferences"), 21 21 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), true, false); 22 22 } 23 23 24 24 @Override 25 25 public void actionPerformed(ActionEvent e) { 26 final PreferenceDialog p = new PreferenceDialog(Main .parent);26 final PreferenceDialog p = new PreferenceDialog(MainApplication.getMainFrame()); 27 27 p.selectPreferencesTabByClass(OdPreferenceSetting.class); 28 28 p.setVisible(true); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/DataSetUpdater.java
r33978 r34452 10 10 import java.util.stream.Collectors; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.SimplifyWayAction; 14 13 import org.openstreetmap.josm.command.SequenceCommand; … … 22 21 import org.openstreetmap.josm.io.OsmApi; 23 22 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 23 import org.openstreetmap.josm.spi.preferences.Config; 24 24 25 25 public abstract class DataSetUpdater { … … 35 35 } 36 36 } 37 if (! Main.pref.getBoolean(OdConstants.PREF_RAWDATA)) {37 if (!Config.getPref().getBoolean(OdConstants.PREF_RAWDATA)) { 38 38 handler.updateDataSet(dataSet); 39 39 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/WayCombiner.java
r33438 r34452 14 14 import java.util.Set; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.command.Command; 18 17 import org.openstreetmap.josm.corrector.ReverseWayTagCorrector; … … 23 22 import org.openstreetmap.josm.data.osm.TagCollection; 24 23 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.MainApplication; 25 25 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; 26 26 import org.openstreetmap.josm.tools.UserCancelException; … … 132 132 completeTagCollectionForEditing(tagsToEdit); 133 133 134 CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog(Main .parent);134 CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog(MainApplication.getMainFrame()); 135 135 dialog.getTagConflictResolverModel().populate(tagsToEdit, completeWayTags.getKeysWithMultipleValues()); 136 136 dialog.setTargetPrimitive(targetWay); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/be/BelgianDataSetHandler.java
r32545 r34452 6 6 import java.util.Locale; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.coor.EastNorth; 10 9 import org.openstreetmap.josm.data.coor.LatLon; … … 14 13 import org.openstreetmap.josm.plugins.opendata.core.datasets.SimpleDataSetHandler; 15 14 import org.openstreetmap.josm.plugins.opendata.core.io.tabular.DefaultCsvHandler; 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 17 17 public abstract class BelgianDataSetHandler extends SimpleDataSetHandler implements BelgianConstants { … … 92 92 try { 93 93 String nationalPortalPath = ""; 94 String lang = Main.pref.get("language");94 String lang = Config.getPref().get("language"); 95 95 if (lang == null || lang.isEmpty()) { 96 96 lang = Locale.getDefault().toString(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/AskLicenseAgreementDialog.java
r30723 r34452 6 6 import java.io.IOException; 7 7 8 import org.openstreetmap.josm. Main;8 import org.openstreetmap.josm.gui.MainApplication; 9 9 import org.openstreetmap.josm.plugins.opendata.core.licenses.License; 10 10 11 11 public class AskLicenseAgreementDialog extends ViewLicenseDialog { 12 12 13 13 public AskLicenseAgreementDialog(License license) throws IOException { 14 super(license, Main .parent, tr("License Agreement"), new String[] {tr("Accept"), "", tr("Refuse")});15 14 super(license, MainApplication.getMainFrame(), tr("License Agreement"), new String[] {tr("Accept"), "", tr("Refuse")}); 15 16 16 setToolTipTexts(new String[] { 17 17 tr("I understand and accept these terms and conditions"), -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ChooserLauncher.java
r30583 r34452 4 4 import java.awt.Component; 5 5 6 import org.openstreetmap.josm.Main;7 6 import org.openstreetmap.josm.data.projection.Projection; 7 import org.openstreetmap.josm.gui.MainApplication; 8 8 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 9 9 import org.openstreetmap.josm.gui.util.GuiHelper; … … 20 20 @Override 21 21 public void run() { 22 Component parent = progressMonitor == null ? Main .parent: progressMonitor.getWindowParent();22 Component parent = progressMonitor == null ? MainApplication.getMainFrame() : progressMonitor.getWindowParent(); 23 23 ProjectionChooser dialog = (ProjectionChooser) new ProjectionChooser(parent).showDialog(); 24 24 if (dialog.getValue() == 1) { … … 26 26 } 27 27 } 28 28 29 29 public static Projection askForProjection(ProgressMonitor pm) { 30 30 ChooserLauncher launcher = new ChooserLauncher(pm); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java
r33790 r34452 39 39 import javax.swing.event.DocumentListener; 40 40 41 import org.openstreetmap.josm.Main;42 41 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 43 42 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; … … 54 53 import org.openstreetmap.josm.plugins.opendata.core.modules.ReadLocalModuleInformationTask; 55 54 import org.openstreetmap.josm.plugins.opendata.core.modules.ReadRemoteModuleInformationTask; 55 import org.openstreetmap.josm.spi.preferences.Config; 56 56 import org.openstreetmap.josm.tools.GBC; 57 57 import org.openstreetmap.josm.tools.ImageProvider; … … 225 225 LinkedList<String> l = new LinkedList<>(model.getSelectedModuleNames()); 226 226 Collections.sort(l); 227 Main.pref.putList(OdConstants.PREF_MODULES, l);227 Config.getPref().putList(OdConstants.PREF_MODULES, l); 228 228 return true; 229 229 } … … 484 484 } 485 485 String s = (String) JOptionPane.showInputDialog( 486 Main .parent,486 MainApplication.getMainFrame(), 487 487 tr("Edit Open Data Module description URL."), 488 488 tr("Open Data Module description URL"), -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreferencesModel.java
r33790 r34452 13 13 import java.util.Set; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.gui.util.ChangeNotifier; 17 16 import org.openstreetmap.josm.plugins.opendata.OdPlugin; … … 19 18 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleException; 20 19 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleInformation; 20 import org.openstreetmap.josm.spi.preferences.Config; 21 21 22 22 public class ModulePreferencesModel extends ChangeNotifier { … … 29 29 30 30 protected List<String> getModules(List<String> def) { 31 return Main.pref.getList(OdConstants.PREF_MODULES, def);31 return Config.getPref().getList(OdConstants.PREF_MODULES, def); 32 32 } 33 33 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdPreferenceSetting.java
r33790 r34452 22 22 import javax.swing.SwingUtilities; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.gui.MainApplication; 26 25 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; … … 29 28 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleDownloadTask; 30 29 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleInformation; 30 import org.openstreetmap.josm.spi.preferences.Config; 31 31 import org.openstreetmap.josm.tools.GBC; 32 32 … … 59 59 */ 60 60 public static final Collection<String> getModuleSites() { 61 return Main.pref.getList(OdConstants.PREF_MODULES_SITES, Arrays.asList(OdConstants.DEFAULT_MODULE_SITES));61 return Config.getPref().getList(OdConstants.PREF_MODULES_SITES, Arrays.asList(OdConstants.DEFAULT_MODULE_SITES)); 62 62 } 63 63 … … 68 68 */ 69 69 public static void setModuleSites(List<String> sites) { 70 Main.pref.putList(OdConstants.PREF_MODULES_SITES, sites);70 Config.getPref().putList(OdConstants.PREF_MODULES_SITES, sites); 71 71 } 72 72 … … 88 88 89 89 // option to enable raw data 90 rawData.setSelected( Main.pref.getBoolean(OdConstants.PREF_RAWDATA, OdConstants.DEFAULT_RAWDATA));90 rawData.setSelected(Config.getPref().getBoolean(OdConstants.PREF_RAWDATA, OdConstants.DEFAULT_RAWDATA)); 91 91 rawData.setToolTipText(tr("Import only raw data (i.e. do not add/delete tags or replace them by standard OSM tags)")); 92 92 general.add(rawData, GBC.eop().insets(0, 0, 0, 0)); … … 103 103 bgCoordinates.add(rbCC43); 104 104 bgCoordinates.add(rbWGS84); 105 String currentCoordinates = Main.pref.get(PREF_COORDINATES, VALUE_CC9ZONES);105 String currentCoordinates = Config.getPref().get(PREF_COORDINATES, VALUE_CC9ZONES); 106 106 if (currentCoordinates.equals(VALUE_WGS84)) 107 107 rbWGS84.setSelected(true); … … 113 113 // option to set the Overpass API server 114 114 JLabel jLabelOapi = new JLabel(tr("Overpass API server:")); 115 oapi.setText( Main.pref.get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI));115 oapi.setText(Config.getPref().get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI)); 116 116 oapi.setToolTipText(tr("Overpass API server used to download OSM data")); 117 117 general.add(jLabelOapi, GBC.std().insets(0, 5, 10, 0)); … … 120 120 // option to set the XAPI server 121 121 JLabel jLabelXapi = new JLabel(tr("XAPI server:")); 122 xapi.setText( Main.pref.get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI));122 xapi.setText(Config.getPref().get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI)); 123 123 xapi.setToolTipText(tr("XAPI server used to download OSM data when Overpass API is not available")); 124 124 general.add(jLabelXapi, GBC.std().insets(0, 5, 10, 0)); … … 134 134 public boolean ok() { 135 135 boolean result = modulePref.ok(); 136 // Main.pref.put(PREF_COORDINATES, rbWGS84.isSelected() ? VALUE_WGS84 : VALUE_CC9ZONES);137 Main.pref.put(OdConstants.PREF_OAPI, oapi.getText());138 Main.pref.put(OdConstants.PREF_XAPI, xapi.getText());139 Main.pref.putBoolean(OdConstants.PREF_RAWDATA, rawData.isSelected());136 //Config.getPref().put(PREF_COORDINATES, rbWGS84.isSelected() ? VALUE_WGS84 : VALUE_CC9ZONES); 137 Config.getPref().put(OdConstants.PREF_OAPI, oapi.getText()); 138 Config.getPref().put(OdConstants.PREF_XAPI, xapi.getText()); 139 Config.getPref().putBoolean(OdConstants.PREF_RAWDATA, rawData.isSelected()); 140 140 141 141 // create a task for downloading modules if the user has activated, yet not downloaded, … … 178 178 if ((task != null && !task.isCanceled()) || requiresRestart) { 179 179 JOptionPane.showMessageDialog( 180 Main .parent,180 MainApplication.getMainFrame(), 181 181 sb.toString(), 182 182 tr("Warning"), … … 184 184 ); 185 185 } 186 Main .parent.repaint();186 MainApplication.getMainFrame().repaint(); 187 187 }; 188 188 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ViewLicenseDialog.java
r30723 r34452 14 14 import javax.swing.JScrollPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.gui.ExtendedDialog; 17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.plugins.opendata.core.licenses.License; 19 19 import org.openstreetmap.josm.tools.ImageProvider; … … 24 24 private final JEditorPane htmlPane; 25 25 private boolean summary; 26 26 27 27 public ViewLicenseDialog(License license) throws IOException { 28 this(license, Main .parent, tr("License"), new String[] {tr("OK"), "", tr("Cancel")});28 this(license, MainApplication.getMainFrame(), tr("License"), new String[] {tr("OK"), "", tr("Cancel")}); 29 29 } 30 30 31 31 public ViewLicenseDialog(License license, Component parent, String title, String[] buttonTexts) throws IOException { 32 32 super(parent, title, buttonTexts); 33 33 34 34 this.license = license; 35 35 this.htmlPane = new JEditorPane(); … … 44 44 JScrollPane scrollPane = new JScrollPane(htmlPane); 45 45 scrollPane.setPreferredSize(new Dimension(800, 600)); 46 46 47 47 setButtonIcons(new Icon[] { 48 48 ImageProvider.get("ok"), -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/OsmDownloader.java
r33518 r34452 6 6 import java.util.Collection; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.gui.MainApplication; 10 9 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 10 import org.openstreetmap.josm.spi.preferences.Config; 11 11 import org.openstreetmap.josm.tools.Logging; 12 12 … … 20 20 if (oapiReq != null) { 21 21 try { 22 String oapiServer = Main.pref.get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI);22 String oapiServer = Config.getPref().get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI); 23 23 Logging.info(oapiReq); 24 24 String oapiReqEnc = URLEncoder.encode(oapiReq, OdConstants.UTF8); … … 32 32 public static void downloadXapi(Collection<String> xapiReqs) { 33 33 if (xapiReqs != null) { 34 String xapiServer = Main.pref.get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI);34 String xapiServer = Config.getPref().get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI); 35 35 for (String xapiReq : xapiReqs) { 36 36 MainApplication.getMenu().openLocation.openUrl(false, xapiServer+xapiReq); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/DefaultShpHandler.java
r33518 r34452 20 20 import org.opengis.referencing.datum.GeodeticDatum; 21 21 import org.opengis.referencing.operation.MathTransform; 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.osm.DataSet; 24 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 33 32 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 34 33 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 34 import org.openstreetmap.josm.spi.preferences.Config; 35 35 import org.openstreetmap.josm.tools.Logging; 36 36 import org.openstreetmap.josm.tools.Pair; … … 50 50 51 51 private static boolean equals(Double a, Double b) { 52 boolean res = Math.abs(a - b) <= Main.pref.getDouble(52 boolean res = Math.abs(a - b) <= Config.getPref().getDouble( 53 53 OdConstants.PREF_CRS_COMPARISON_TOLERANCE, OdConstants.DEFAULT_CRS_COMPARISON_TOLERANCE); 54 if ( Main.pref.getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) {54 if (Config.getPref().getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) { 55 55 Logging.debug("Comparing "+a+" and "+b+" -> "+res); 56 56 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r33518 r34452 44 44 import org.opengis.referencing.operation.OperationNotFoundException; 45 45 import org.opengis.referencing.operation.TransformException; 46 import org.openstreetmap.josm.Main;47 46 import org.openstreetmap.josm.data.coor.LatLon; 48 47 import org.openstreetmap.josm.data.osm.DataSet; … … 59 58 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 60 59 import org.openstreetmap.josm.plugins.opendata.core.gui.DialogPrompter; 60 import org.openstreetmap.josm.spi.preferences.Config; 61 61 import org.openstreetmap.josm.tools.ImageOverlay; 62 62 import org.openstreetmap.josm.tools.ImageProvider; … … 372 372 if (candidate instanceof AbstractCRS && crs instanceof AbstractIdentifiedObject) { 373 373 374 Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE, Main.pref.getDouble(374 Hints.putSystemDefault(Hints.COMPARISON_TOLERANCE, Config.getPref().getDouble( 375 375 OdConstants.PREF_CRS_COMPARISON_TOLERANCE, OdConstants.DEFAULT_CRS_COMPARISON_TOLERANCE)); 376 376 if (((AbstractCRS) candidate).equals((AbstractIdentifiedObject) crs, false)) { 377 377 Logging.info("Found a potential CRS: "+candidate.getName()); 378 378 candidates.add(candidate); 379 } else if ( Main.pref.getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) {379 } else if (Config.getPref().getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) { 380 380 compareDebug(crs, candidate); 381 381 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GmlReader.java
r33518 r34452 20 20 import org.opengis.referencing.operation.MathTransform; 21 21 import org.opengis.referencing.operation.TransformException; 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.osm.DataSet; 24 23 import org.openstreetmap.josm.data.osm.Node; 25 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 26 25 import org.openstreetmap.josm.data.osm.Way; 26 import org.openstreetmap.josm.gui.MainApplication; 27 27 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 28 28 import org.openstreetmap.josm.io.UTFInputStreamReader; … … 93 93 private DataSet parseDoc(ProgressMonitor instance) throws XMLStreamException, GeoCrsException, FactoryException, 94 94 GeoMathTransformException, MismatchedDimensionException, TransformException { 95 Component parent = instance != null ? instance.getWindowParent() : Main .parent;95 Component parent = instance != null ? instance.getWindowParent() : MainApplication.getMainFrame(); 96 96 while (parser.hasNext()) { 97 97 int event = parser.next(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
r34196 r34452 40 40 import org.opengis.referencing.FactoryException; 41 41 import org.opengis.referencing.operation.TransformException; 42 import org.openstreetmap.josm.Main;43 42 import org.openstreetmap.josm.data.osm.DataSet; 44 43 import org.openstreetmap.josm.data.osm.Node; … … 46 45 import org.openstreetmap.josm.data.osm.Relation; 47 46 import org.openstreetmap.josm.data.osm.Way; 47 import org.openstreetmap.josm.gui.MainApplication; 48 48 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 49 49 import org.openstreetmap.josm.gui.util.GuiHelper; … … 235 235 int n = 0; 236 236 237 Component parent = instance != null ? instance.getWindowParent() : Main .parent;237 Component parent = instance != null ? instance.getWindowParent() : MainApplication.getMainFrame(); 238 238 239 239 try (FeatureIterator<?> iterator = collection.features()) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsDocument.java
r33518 r34452 12 12 import org.jopendocument.model.OpenDocument; 13 13 import org.openstreetmap.josm.tools.Logging; 14 import org.openstreetmap.josm.tools. Utils;14 import org.openstreetmap.josm.tools.XmlUtils; 15 15 import org.xml.sax.InputSource; 16 16 import org.xml.sax.XMLReader; … … 37 37 try { 38 38 final ZipInputStream zis = new ZipInputStream(in); 39 final XMLReader rdr = Utils.newSafeSAXParser().getXMLReader();39 final XMLReader rdr = XmlUtils.newSafeSAXParser().getXMLReader(); 40 40 41 41 ZipEntry entry; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java
r34185 r34452 18 18 import java.util.regex.Pattern; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.data.coor.EastNorth; 22 21 import org.openstreetmap.josm.data.osm.DataSet; … … 29 28 import org.openstreetmap.josm.plugins.opendata.core.gui.ChooserLauncher; 30 29 import org.openstreetmap.josm.plugins.opendata.core.io.ProjectionPatterns; 30 import org.openstreetmap.josm.spi.preferences.Config; 31 31 import org.openstreetmap.josm.tools.Logging; 32 32 … … 254 254 } 255 255 if (n == firstNode || n.getCoor().greatCircleDistance(firstNode.getCoor()) 256 > Main.pref.getDouble(OdConstants.PREF_TOLERANCE, OdConstants.DEFAULT_TOLERANCE)) {256 > Config.getPref().getDouble(OdConstants.PREF_TOLERANCE, OdConstants.DEFAULT_TOLERANCE)) { 257 257 ds.addPrimitive(n); 258 258 } else { … … 261 261 } 262 262 } 263 if (handler != null && ! Main.pref.getBoolean(OdConstants.PREF_RAWDATA)) {263 if (handler != null && !Config.getPref().getBoolean(OdConstants.PREF_RAWDATA)) { 264 264 handler.nodesAdded(ds, nodes, header, lineNumber); 265 265 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java
r34153 r34452 34 34 import javax.swing.JPanel; 35 35 36 import org.openstreetmap.josm.Main;37 36 import org.openstreetmap.josm.data.PreferencesUtils; 38 37 import org.openstreetmap.josm.data.preferences.sources.SourceProvider; … … 48 47 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 49 48 import org.openstreetmap.josm.plugins.opendata.core.gui.OdPreferenceSetting; 49 import org.openstreetmap.josm.spi.preferences.Config; 50 50 import org.openstreetmap.josm.tools.CheckParameterUtil; 51 51 import org.openstreetmap.josm.tools.I18n; … … 101 101 String togglePreferenceKey = null; 102 102 long tim = System.currentTimeMillis(); 103 long last = Main.pref.getLong("opendata.modulemanager.lastupdate", 0);104 Integer maxTime = Main.pref.getInt("opendata.modulemanager.time-based-update.interval", 60);103 long last = Config.getPref().getLong("opendata.modulemanager.lastupdate", 0); 104 Integer maxTime = Config.getPref().getInt("opendata.modulemanager.time-based-update.interval", 60); 105 105 long d = (tim - last) / (24 * 60 * 60 * 1000L); 106 106 if ((last <= 0) || (maxTime <= 0)) { 107 Main.pref.put("opendata.modulemanager.lastupdate", Long.toString(tim));107 Config.getPref().put("opendata.modulemanager.lastupdate", Long.toString(tim)); 108 108 } else if (d > maxTime) { 109 109 message = … … 136 136 // check whether automatic update at startup was disabled 137 137 // 138 String policy = Main.pref.get(togglePreferenceKey, "ask");138 String policy = Config.getPref().get(togglePreferenceKey, "ask"); 139 139 policy = policy.trim().toLowerCase(); 140 140 if (policy.equals("never")) { … … 169 169 switch(ret) { 170 170 case 0: 171 Main.pref.put(togglePreferenceKey, "always");171 Config.getPref().put(togglePreferenceKey, "always"); 172 172 break; 173 173 case JOptionPane.CLOSED_OPTION: 174 174 case 1: 175 Main.pref.put(togglePreferenceKey, "never");175 Config.getPref().put(togglePreferenceKey, "never"); 176 176 break; 177 177 } 178 178 } else { 179 Main.pref.put(togglePreferenceKey, "ask");179 Config.getPref().put(togglePreferenceKey, "ask"); 180 180 } 181 181 return ret == 0; … … 258 258 } 259 259 if (msg != null && confirmDisableModule(parent, msg, module.name)) { 260 PreferencesUtils.removeFromList( Main.pref, OdConstants.PREF_MODULES, module.name);260 PreferencesUtils.removeFromList(Config.getPref(), OdConstants.PREF_MODULES, module.name); 261 261 } 262 262 } … … 364 364 public static List<ModuleInformation> buildListOfModulesToLoad(Component parent) { 365 365 Set<String> modules = new HashSet<>(); 366 modules.addAll( Main.pref.getList(OdConstants.PREF_MODULES, new LinkedList<String>()));366 modules.addAll(Config.getPref().getList(OdConstants.PREF_MODULES, new LinkedList<String>())); 367 367 if (System.getProperty("josm."+OdConstants.PREF_MODULES) != null) { 368 368 modules.addAll(Arrays.asList(System.getProperty("josm."+OdConstants.PREF_MODULES).split(","))); … … 494 494 // remember the update because it was successful 495 495 // 496 Main.pref.put("opendata.modulemanager.lastupdate", Long.toString(System.currentTimeMillis()));496 Config.getPref().put("opendata.modulemanager.lastupdate", Long.toString(System.currentTimeMillis())); 497 497 return modules; 498 498 } … … 613 613 614 614 int ret = HelpAwareOptionPane.showOptionDialog( 615 Main .parent,615 MainApplication.getMainFrame(), 616 616 msg.toString(), 617 617 tr("Update modules"), … … 670 670 671 671 Set<String> modules = new HashSet<String>( 672 Main.pref.getCollection(PREF_MODULES, Collections.<String> emptySet())672 Config.getPref().getCollection(PREF_MODULES, Collections.<String> emptySet()) 673 673 ); 674 674 if (! modules.contains(module.getModuleInformation().name)) … … 683 683 // deactivate the module 684 684 modules.remove(module.getModuleInformation().name); 685 Main.pref.putCollection(PREF_MODULES, modules);685 Config.getPref().putCollection(PREF_MODULES, modules); 686 686 JOptionPane.showMessageDialog( 687 Main .parent,687 MainApplication.getMainFrame(), 688 688 tr("The module has been removed from the configuration. Please restart JOSM to unload the module."), 689 689 tr("Information"), … … 695 695 /*public static String getBugReportText() { 696 696 String text = ""; 697 LinkedList <String> pl = new LinkedList<String>( Main.pref.getCollection(PREF_MODULES, new LinkedList<String>()));697 LinkedList <String> pl = new LinkedList<String>(Config.getPref().getCollection(PREF_MODULES, new LinkedList<String>())); 698 698 for (final Module pp : moduleList) { 699 699 ModuleInformation pi = pp.getModuleInformation(); … … 729 729 a.setEditable(false); 730 730 a.setText(b.toString()); 731 JOptionPane.showMessageDialog(Main .parent, new JScrollPane(a), tr("Module information"),731 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), new JScrollPane(a), tr("Module information"), 732 732 JOptionPane.INFORMATION_MESSAGE); 733 733 } … … 780 780 781 781 public void initDontShowAgain(String preferencesKey) { 782 String policy = Main.pref.get(preferencesKey, "ask");782 String policy = Config.getPref().get(preferencesKey, "ask"); 783 783 policy = policy.trim().toLowerCase(); 784 784 cbDontShowAgain.setSelected(!policy.equals("ask")); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleInformation.java
r34153 r34452 24 24 import javax.swing.ImageIcon; 25 25 26 import org.openstreetmap.josm. Main;26 import org.openstreetmap.josm.data.Preferences; 27 27 import org.openstreetmap.josm.plugins.opendata.OdPlugin; 28 28 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; … … 261 261 262 262 public static Collection<String> getModuleLocations() { 263 Collection<String> locations = Main.pref.getAllPossiblePreferenceDirs();263 Collection<String> locations = Preferences.getAllPossiblePreferenceDirs(); 264 264 Collection<String> all = new ArrayList<>(locations.size()); 265 265 for (String s : locations) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/OdUtils.java
r33617 r34452 14 14 15 15 import org.apache.commons.lang3.StringUtils; 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 17 import org.openstreetmap.josm.data.osm.Relation; 18 import org.openstreetmap.josm.spi.preferences.Config; 19 19 import org.openstreetmap.josm.tools.ImageProvider; 20 20 import org.openstreetmap.josm.tools.Utils; … … 71 71 72 72 public static final String getJosmLanguage() { 73 String lang = Main.pref.get("language");73 String lang = Config.getPref().get("language"); 74 74 if (lang == null || lang.isEmpty()) { 75 75 lang = Locale.getDefault().toString();
Note:
See TracChangeset
for help on using the changeset viewer.