Changeset 33518 in osm for applications
- Timestamp:
- 2017-08-25T22:50:43+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 56 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/.settings/org.eclipse.jdt.core.prefs
r32699 r33518 3 3 org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore 4 4 org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull 5 org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= 5 6 org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault 7 org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= 6 8 org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable 9 org.eclipse.jdt.core.compiler.annotation.nullable.secondary= 7 10 org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled 8 11 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled … … 19 22 org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning 20 23 org.eclipse.jdt.core.compiler.problem.deadCode=warning 21 org.eclipse.jdt.core.compiler.problem.deprecation= ignore24 org.eclipse.jdt.core.compiler.problem.deprecation=warning 22 25 org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled 23 26 org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled … … 51 54 org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore 52 55 org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning 56 org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning 53 57 org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error 54 58 org.eclipse.jdt.core.compiler.problem.nullReference=warning … … 57 61 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning 58 62 org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore 63 org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning 59 64 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore 60 65 org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore … … 73 78 org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled 74 79 org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore 80 org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning 75 81 org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning 76 82 org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled … … 79 85 org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore 80 86 org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning 87 org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning 88 org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled 89 org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info 81 90 org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore 82 91 org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning … … 86 95 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled 87 96 org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled 97 org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore 88 98 org.eclipse.jdt.core.compiler.problem.unusedImport=warning 89 99 org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -
applications/editors/josm/plugins/opendata/build.xml
r33438 r33518 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <project name="opendata" default="dist" basedir="."> 3 <property name="plugin.main.version" value="12 463"/>3 <property name="plugin.main.version" value="12649"/> 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/modules/fr.datagouvfr/src/org/openstreetmap/josm/plugins/opendata/modules/fr/datagouvfr/datasets/administration/GeoFlaHandler.java
r30908 r33518 7 7 import java.util.List; 8 8 9 import org.apache.commons.lang3.text.WordUtils; 10 import org.openstreetmap.josm.Main; 9 import org.apache.commons.text.WordUtils; 11 10 import org.openstreetmap.josm.data.coor.EastNorth; 12 11 import org.openstreetmap.josm.data.coor.LatLon; … … 17 16 import org.openstreetmap.josm.data.osm.RelationMember; 18 17 import org.openstreetmap.josm.plugins.opendata.modules.fr.datagouvfr.datasets.DataGouvDataSetHandler; 18 import org.openstreetmap.josm.tools.Logging; 19 19 import org.openstreetmap.josm.tools.Pair; 20 20 … … 24 24 */ 25 25 public class GeoFlaHandler extends DataGouvDataSetHandler { 26 26 27 27 private static final String ADMIN_LEVEL = "admin_level"; 28 28 29 29 /** 30 30 * Constructs a new {@code GeoFlaHandler}. … … 36 36 setLocalPortalURL("http://professionnels.ign.fr/geofla#tab-3"); 37 37 } catch (MalformedURLException e) { 38 Main.error(e);38 Logging.error(e); 39 39 } 40 40 } … … 49 49 return isDepartementFile(filename) || isCommuneFile(filename) || isCantonFile(filename) || isArrondissementFile(filename); 50 50 } 51 51 52 52 protected boolean isDepartementFile(String filename) { 53 53 return acceptsShpMifFilename(filename, "DEPARTEMENT") || acceptsShpMifFilename(filename, "LIMITE_DEPARTEMENT"); … … 96 96 } else if (isDepartementFile(filename) || "Limite de département".equalsIgnoreCase(nature)) { 97 97 p.put(ADMIN_LEVEL, "6"); 98 } else if (isArrondissementFile(filename) || "Limite d'arrondissement".equalsIgnoreCase(nature)) {98 } else if (isArrondissementFile(filename) || "Limite d'arrondissement".equalsIgnoreCase(nature)) { 99 99 p.put(ADMIN_LEVEL, "7"); 100 } else if (isCommuneFile(filename)) {100 } else if (isCommuneFile(filename)) { 101 101 p.put(ADMIN_LEVEL, "8"); 102 102 } … … 135 135 } 136 136 } catch (NumberFormatException e) { 137 Main.warn("Invalid population: "+population);137 Logging.warn("Invalid population: "+population); 138 138 } 139 139 } … … 145 145 } 146 146 } 147 147 148 148 protected static boolean hasKeyIgnoreCase(OsmPrimitive p, String ... strings) { 149 149 return getIgnoreCase(p, strings) != null; … … 167 167 } 168 168 } 169 169 170 170 protected static String getAndRemoveIgnoreCase(OsmPrimitive p, String ... strings) { 171 171 String result = getIgnoreCase(p, strings); … … 192 192 dptCode = "976"; 193 193 } else { 194 Main.error("Unknown French department: "+dptName);194 Logging.error("Unknown French department: "+dptName); 195 195 } 196 196 } 197 197 return getLatLonByDptCode(new EastNorth(Double.parseDouble(x), Double.parseDouble(y)), dptCode, false); 198 198 } catch (NumberFormatException e) { 199 Main.error(e);199 Logging.error(e); 200 200 } 201 201 } 202 202 return null; 203 203 } 204 204 205 205 private Pair<String, URL> getGeoflaURL(String name, String urlSuffix) throws MalformedURLException { 206 206 return new Pair<>(name, new URL("https://wxs-telechargement.ign.fr/oikr5jryiph0iwhw36053ptm/telechargement/inspire/"+urlSuffix)); … … 239 239 result.add(getGeoflaURL("2014 Départements Mayotte", "GEOFLA_THEME-DEPARTEMENTS_2014_GEOFLA_2-0_DEPARTEMENT_SHP_RGM04UTM38S_D976_2014-12-05/file/GEOFLA_2-0_DEPARTEMENT_SHP_RGM04UTM38S_D976_2014-12-05.7z")); 240 240 } catch (MalformedURLException e) { 241 Main.error(e);241 Logging.error(e); 242 242 } 243 243 return result; -
applications/editors/josm/plugins/opendata/modules/fr.datagouvfr/src/org/openstreetmap/josm/plugins/opendata/modules/fr/datagouvfr/datasets/agriculture/RegistreParcellaireHandler.java
r30731 r33518 9 9 import org.openstreetmap.josm.data.osm.DataSet; 10 10 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 import org.openstreetmap.josm. gui.preferences.SourceEditor.ExtendedSourceEntry;11 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 12 12 import org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchAdministrativeUnit; 13 13 import org.openstreetmap.josm.plugins.opendata.modules.fr.datagouvfr.datasets.DataGouvDataSetHandler; -
applications/editors/josm/plugins/opendata/modules/fr.datagouvfr/src/org/openstreetmap/josm/plugins/opendata/modules/fr/datagouvfr/datasets/hydrologie/EauxDeSurfaceHandler.java
r30738 r33518 14 14 import java.util.regex.Pattern; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.osm.DataSet; 18 17 import org.openstreetmap.josm.plugins.opendata.core.io.archive.DefaultArchiveHandler; 19 18 import org.openstreetmap.josm.plugins.opendata.modules.fr.datagouvfr.datasets.DataGouvDataSetHandler; 19 import org.openstreetmap.josm.tools.Logging; 20 20 import org.openstreetmap.josm.tools.Pair; 21 21 … … 127 127 } 128 128 } catch (Exception e) { 129 Main.error(e);129 Logging.error(e); 130 130 } 131 131 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModule.java
r30701 r33518 6 6 import java.util.TreeSet; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.osm.DataSet; 10 9 import org.openstreetmap.josm.data.osm.Relation; 10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 12 12 import org.openstreetmap.josm.io.OsmTransferException; … … 109 109 handlers.add(PointsLumineuxHandler.class); 110 110 } 111 111 112 112 public static final DataSet data = new DataSet(); 113 113 114 114 private static final Collection<Relation> getBoundaries(int admin_level) { 115 115 Collection<Relation> result = new TreeSet<>(new Comparator<Relation>() { … … 127 127 synchronized (data) { 128 128 for (Relation r : data.getRelations()) { 129 if (r.hasTag("admin_level", Integer.toString(admin_level)) && 129 if (r.hasTag("admin_level", Integer.toString(admin_level)) && 130 130 (r.hasKey("name") || r.hasKey("ref") || r.hasKey("description"))) { 131 131 result.add(r); … … 135 135 return result; 136 136 } 137 137 138 138 public static final void downloadData() { 139 139 synchronized (data) { … … 141 141 for (final ToulouseDataSetHandler handler : new ToulouseDataSetHandler[]{ 142 142 new CommuneHandler(), new SecteursHandler(), new QuartiersHandler()}) { 143 Main .worker.submit(new Runnable() {143 MainApplication.worker.submit(new Runnable() { 144 144 @Override 145 145 public void run() { … … 160 160 } 161 161 } 162 162 163 163 public static final Collection<Relation> getMunicipalities() { 164 164 return getBoundaries(8); 165 165 } 166 166 167 167 public static final Collection<Relation> getSectors() { 168 168 return getBoundaries(10); -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/ToulouseDataSetHandler.java
r32934 r33518 10 10 import java.util.Collections; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.JosmAction; 14 13 import org.openstreetmap.josm.data.osm.DataSet; … … 27 26 import org.openstreetmap.josm.data.osm.event.TagsChangedEvent; 28 27 import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent; 28 import org.openstreetmap.josm.gui.MainApplication; 29 29 import org.openstreetmap.josm.plugins.opendata.OdPlugin; 30 30 import org.openstreetmap.josm.plugins.opendata.core.datasets.DataSetCategory; … … 142 142 public void actionPerformed(ActionEvent e) { 143 143 final String baseName = OdPlugin.getInstance().getDialog().getDataLayer().getName(); 144 final DataSet baseDs = Main .getLayerManager().getEditDataSet();144 final DataSet baseDs = MainApplication.getLayerManager().getEditDataSet(); 145 145 for (OsmPrimitive boundary : getBoundaries()) { 146 146 DataSet data = new DataSet(); … … 162 162 name = boundary.get("description"); 163 163 } 164 Main .getLayerManager().addLayer(new OdDataLayer(data, baseName+"/"+name, null, ToulouseDataSetHandler.this));164 MainApplication.getLayerManager().addLayer(new OdDataLayer(data, baseName+"/"+name, null, ToulouseDataSetHandler.this)); 165 165 } 166 166 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/associations/Club3eAgeHandler.java
r30340 r33518 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.associations; 3 3 4 import org.apache.commons. lang3.text.WordUtils;4 import org.apache.commons.text.WordUtils; 5 5 import org.openstreetmap.josm.data.osm.DataSet; 6 6 import org.openstreetmap.josm.data.osm.Node; … … 14 14 setCategory(CAT_ASSOCIATIONS); 15 15 } 16 16 17 17 @Override 18 18 public boolean acceptsFilename(String filename) { -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/culture/MuseeHandler.java
r30340 r33518 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.culture; 3 3 4 import org.apache.commons. lang3.text.WordUtils;4 import org.apache.commons.text.WordUtils; 5 5 import org.openstreetmap.josm.data.osm.DataSet; 6 6 import org.openstreetmap.josm.data.osm.Node; -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/enfance/CrechesHandler.java
r30340 r33518 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.enfance; 3 3 4 import org.apache.commons. lang3.text.WordUtils;4 import org.apache.commons.text.WordUtils; 5 5 import org.openstreetmap.josm.data.osm.DataSet; 6 6 import org.openstreetmap.josm.data.osm.Node; -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/enfance/EcoleElementaireHandler.java
r30340 r33518 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.enfance; 3 3 4 import org.apache.commons. lang3.text.WordUtils;4 import org.apache.commons.text.WordUtils; 5 5 import org.openstreetmap.josm.data.osm.DataSet; 6 6 import org.openstreetmap.josm.data.osm.Node; … … 13 13 setWikiPage("Écoles élémentaires publiques"); 14 14 setCategory(CAT_ENFANCE); 15 for (String forbidden : new String[]{"maternelle", "primaire","collège","lycée","secondaire"}) {15 for (String forbidden : new String[]{"maternelle", "primaire", "collège", "lycée", "secondaire"}) { 16 16 addForbiddenTag("school:FR="+forbidden); 17 17 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/services/MarchesPleinVentHandler.java
r30340 r33518 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.services; 3 3 4 import org.apache.commons. lang3.text.WordUtils;4 import org.apache.commons.text.WordUtils; 5 5 import org.openstreetmap.josm.data.osm.DataSet; 6 6 import org.openstreetmap.josm.data.osm.Node; … … 29 29 @Override public String replace(String value) { 30 30 return WordUtils.capitalizeFully(value).replace(", ", "").replace("MarchÉ", "Marché"); 31 } });31 } }); 32 32 n.put("amenity", "marketplace"); 33 33 replace(n, "Type", "note"); 34 34 String hours = ""; 35 35 for (String[] day : new String[][]{ 36 new String[]{"Lundi", "Mo"},37 new String[]{"mardi", "Tu"},38 new String[]{"mercredi", "We"},39 new String[]{"jeudi", "Th"},40 new String[]{"vendredi", "Fr"},41 new String[]{"samedi", "Sa"},42 new String[]{"dimanche", "Su"}36 new String[]{"Lundi", "Mo"}, 37 new String[]{"mardi", "Tu"}, 38 new String[]{"mercredi", "We"}, 39 new String[]{"jeudi", "Th"}, 40 new String[]{"vendredi", "Fr"}, 41 new String[]{"samedi", "Sa"}, 42 new String[]{"dimanche", "Su"} 43 43 }) { 44 44 String value = n.get(day[0]); -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/HorodateurHandler.java
r30920 r33518 5 5 import java.util.regex.Pattern; 6 6 7 import org.apache.commons. lang3.text.WordUtils;7 import org.apache.commons.text.WordUtils; 8 8 import org.openstreetmap.josm.data.osm.DataSet; 9 9 import org.openstreetmap.josm.data.osm.Node; … … 23 23 return acceptsCsvKmzTabFilename(filename, "Horodateur"); 24 24 } 25 25 26 26 private String parseHour(String hour) { 27 27 String s = hour.replaceFirst("[hH]", ":"); … … 31 31 return s; 32 32 } 33 33 34 34 protected String parseOpeningHours(String horaire) { 35 35 final String hour = "\\p{Digit}{1,2}[hH]\\p{Digit}{0,2}"; -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/VeloToulouseHandler.java
r30340 r33518 2 2 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport; 3 3 4 import org.apache.commons. lang3.text.WordUtils;4 import org.apache.commons.text.WordUtils; 5 5 import org.openstreetmap.josm.data.osm.DataSet; 6 6 import org.openstreetmap.josm.data.osm.Node; -
applications/editors/josm/plugins/opendata/src/org/geotools/data/shapefile/files/TabFiles.java
r30738 r33518 47 47 48 48 import org.geotools.data.DataUtilities; 49 import org.openstreetmap.josm. Main;49 import org.openstreetmap.josm.tools.Logging; 50 50 51 51 /** … … 177 177 return files[0].toURI().toURL(); 178 178 } catch (MalformedURLException e) { 179 Main.error(e);179 Logging.error(e); 180 180 } 181 181 } … … 213 213 StringBuilder sb = new StringBuilder("The following locker still has a lock: "); 214 214 sb.append(locker); 215 Main.error(sb.toString());215 Logging.error(sb.toString()); 216 216 } 217 217 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java
r32545 r33518 16 16 import org.openstreetmap.josm.Main; 17 17 import org.openstreetmap.josm.actions.ExtensionFileFilter; 18 import org.openstreetmap.josm.gui.MainApplication; 18 19 import org.openstreetmap.josm.gui.MainMenu; 19 20 import org.openstreetmap.josm.gui.MapFrame; … … 75 76 } 76 77 77 menu = Main.main.menu.dataMenu; 78 79 new Thread(new Runnable() { 80 @Override 81 public void run() { 82 // Load modules in new thread 83 loadModules(); 84 // Add menu in EDT 85 GuiHelper.runInEDT(new Runnable() { 86 @Override 87 public void run() { 88 buildMenu(); 89 } 90 }); 91 } 78 menu = MainApplication.getMenu().dataMenu; 79 80 new Thread(() -> { 81 // Load modules in new thread 82 loadModules(); 83 // Add menu in EDT 84 GuiHelper.runInEDT(() -> buildMenu()); 92 85 }).start(); 93 86 94 87 // Add download task 95 Main .main.menu.openLocation.addDownloadTaskClass(DownloadDataTask.class);88 MainApplication.getMenu().openLocation.addDownloadTaskClass(DownloadDataTask.class); 96 89 // Delete previous temp dirs if any (old plugin versions did not remove them correctly) 97 90 OdUtils.deletePreviousTempDirs(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataAction.java
r30723 r33518 7 7 import javax.swing.Action; 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.plugins.opendata.core.modules.Module; 12 12 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 15 15 16 16 private final URL url; 17 17 18 18 public DownloadDataAction(Module module, String name, URL url) { 19 19 super(false); … … 24 24 this.url = url; 25 25 } 26 26 27 27 @Override 28 28 public void actionPerformed(ActionEvent e) { 29 Main .main.menu.openLocation.openUrl(true, url.toString());29 MainApplication.getMenu().openLocation.openUrl(true, url.toString()); 30 30 } 31 31 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/DownloadDataTask.java
r32545 r33518 14 14 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 15 15 import org.openstreetmap.josm.data.Bounds; 16 import org.openstreetmap.josm.gui.MainApplication; 16 17 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 17 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 39 40 currentBounds = null; 40 41 if (handler == null || !handler.hasLicenseToBeAccepted() || askLicenseAgreement(handler.getLicense())) { 41 return Main .worker.submit(downloadTask);42 return MainApplication.worker.submit(downloadTask); 42 43 } else { 43 44 return null; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenLinkAction.java
r30795 r33518 10 10 import javax.swing.Action; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.JosmAction; 14 13 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 15 14 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 15 import org.openstreetmap.josm.tools.Logging; 16 16 import org.openstreetmap.josm.tools.OpenBrowser; 17 17 … … 19 19 20 20 private URL url; 21 21 22 22 public OpenLinkAction(URL url, String icon24Name, String title, String description) { 23 23 super(title, null, description, null, false); … … 29 29 public void actionPerformed(ActionEvent e) { 30 30 try { 31 Main.info("Opening "+url);31 Logging.info("Opening "+url); 32 32 OpenBrowser.displayUrl(url.toURI()); 33 33 } catch (URISyntaxException e1) { 34 34 try { 35 Main.error(e1.getLocalizedMessage());35 Logging.error(e1.getLocalizedMessage()); 36 36 int index = e1.getIndex(); 37 37 if (index > -1) { … … 39 39 s = url.toString().replace(s, URLEncoder.encode(s, OdConstants.UTF8)); 40 40 URI uri = new URI(s); 41 Main.info("Opening "+uri);41 Logging.info("Opening "+uri); 42 42 OpenBrowser.displayUrl(uri); 43 43 } 44 44 } catch (Exception e2) { 45 Main.error(e2);45 Logging.error(e2); 46 46 } 47 47 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/AbstractDataSetHandler.java
r32545 r33518 18 18 import org.openstreetmap.josm.data.osm.IPrimitive; 19 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 import org.openstreetmap.josm. gui.preferences.SourceEditor.ExtendedSourceEntry;20 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 21 21 import org.openstreetmap.josm.io.AbstractReader; 22 22 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java
r32545 r33518 42 42 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 43 43 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 44 import org.openstreetmap.josm.gui.MainApplication; 44 45 import org.openstreetmap.josm.gui.help.HelpUtil; 45 46 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; … … 238 239 public void readLocalModuleInformation() { 239 240 final ReadLocalModuleInformationTask task = new ReadLocalModuleInformationTask(); 240 Runnable r = new Runnable() { 241 @Override 242 public void run() { 243 if (task.isCanceled()) return; 244 SwingUtilities.invokeLater(new Runnable() { 245 @Override 246 public void run() { 247 model.setAvailableModules(task.getAvailableModules()); 248 pnlModulePreferences.refreshView(); 249 } 250 }); 251 } 241 Runnable r = () -> { 242 if (task.isCanceled()) return; 243 SwingUtilities.invokeLater(() -> { 244 model.setAvailableModules(task.getAvailableModules()); 245 pnlModulePreferences.refreshView(); 246 }); 252 247 }; 253 Main .worker.submit(task);254 Main .worker.submit(r);248 MainApplication.worker.submit(task); 249 MainApplication.worker.submit(r); 255 250 } 256 251 … … 270 265 public void actionPerformed(ActionEvent e) { 271 266 final ReadRemoteModuleInformationTask task = new ReadRemoteModuleInformationTask(OdPreferenceSetting.getModuleSites()); 272 Runnable continuation = new Runnable() { 273 @Override 274 public void run() { 275 if (task.isCanceled()) return; 276 SwingUtilities.invokeLater(new Runnable() { 277 @Override 278 public void run() { 279 model.updateAvailableModules(task.getAvailableModules()); 280 pnlModulePreferences.refreshView(); 281 } 282 }); 283 } 267 Runnable continuation = () -> { 268 if (task.isCanceled()) return; 269 SwingUtilities.invokeLater(() -> { 270 model.updateAvailableModules(task.getAvailableModules()); 271 pnlModulePreferences.refreshView(); 272 }); 284 273 }; 285 Main .worker.submit(task);286 Main .worker.submit(continuation);274 MainApplication.worker.submit(task); 275 MainApplication.worker.submit(continuation); 287 276 } 288 277 } … … 319 308 320 309 protected void alertNothingToUpdate() { 321 GuiHelper.runInEDTAndWait(new Runnable() { 322 @Override 323 public void run() { 324 HelpAwareOptionPane.showOptionDialog( 325 pnlModulePreferences, 326 tr("All installed modules are up to date. JOSM does not have to download newer versions."), 327 tr("Modules up to date"), 328 JOptionPane.INFORMATION_MESSAGE, 329 null // FIXME: provide help context 330 ); 331 } 332 }); 310 GuiHelper.runInEDTAndWait(() -> HelpAwareOptionPane.showOptionDialog( 311 pnlModulePreferences, 312 tr("All installed modules are up to date. JOSM does not have to download newer versions."), 313 tr("Modules up to date"), 314 JOptionPane.INFORMATION_MESSAGE, 315 null // FIXME: provide help context 316 )); 333 317 } 334 318 … … 348 332 // to be run asynchronously after the module download 349 333 // 350 final Runnable moduleDownloadContinuation = new Runnable() { 351 @Override 352 public void run() { 353 if (moduleDownloadTask.isCanceled()) 354 return; 355 notifyDownloadResults(moduleDownloadTask); 356 model.refreshLocalModuleVersion(moduleDownloadTask.getDownloadedModules()); 357 model.clearPendingModules(moduleDownloadTask.getDownloadedModules()); 358 GuiHelper.runInEDT(new Runnable() { 359 @Override 360 public void run() { 361 pnlModulePreferences.refreshView(); 362 } 363 }); 364 } 334 final Runnable moduleDownloadContinuation = () -> { 335 if (moduleDownloadTask.isCanceled()) 336 return; 337 notifyDownloadResults(moduleDownloadTask); 338 model.refreshLocalModuleVersion(moduleDownloadTask.getDownloadedModules()); 339 model.clearPendingModules(moduleDownloadTask.getDownloadedModules()); 340 GuiHelper.runInEDT(new Runnable() { 341 @Override 342 public void run() { 343 pnlModulePreferences.refreshView(); 344 } 345 }); 365 346 }; 366 347 367 348 // to be run asynchronously after the module list download 368 349 // 369 final Runnable moduleInfoDownloadContinuation = new Runnable() { 370 @Override 371 public void run() { 372 if (moduleInfoDownloadTask.isCanceled()) 373 return; 374 model.updateAvailableModules(moduleInfoDownloadTask.getAvailableModules()); 375 // select modules which actually have to be updated 376 // 377 Iterator<ModuleInformation> it = toUpdate.iterator(); 378 while (it.hasNext()) { 379 ModuleInformation pi = it.next(); 380 if (!pi.isUpdateRequired()) { 381 it.remove(); 382 } 383 } 384 if (toUpdate.isEmpty()) { 385 alertNothingToUpdate(); 386 return; 387 } 388 moduleDownloadTask.setModulesToDownload(toUpdate); 389 Main.worker.submit(moduleDownloadTask); 390 Main.worker.submit(moduleDownloadContinuation); 350 final Runnable moduleInfoDownloadContinuation = () -> { 351 if (moduleInfoDownloadTask.isCanceled()) 352 return; 353 model.updateAvailableModules(moduleInfoDownloadTask.getAvailableModules()); 354 // select modules which actually have to be updated 355 // 356 Iterator<ModuleInformation> it = toUpdate.iterator(); 357 while (it.hasNext()) { 358 ModuleInformation pi = it.next(); 359 if (!pi.isUpdateRequired()) { 360 it.remove(); 361 } 391 362 } 363 if (toUpdate.isEmpty()) { 364 alertNothingToUpdate(); 365 return; 366 } 367 moduleDownloadTask.setModulesToDownload(toUpdate); 368 MainApplication.worker.submit(moduleDownloadTask); 369 MainApplication.worker.submit(moduleDownloadContinuation); 392 370 }; 393 371 394 Main .worker.submit(moduleInfoDownloadTask);395 Main .worker.submit(moduleInfoDownloadContinuation);372 MainApplication.worker.submit(moduleInfoDownloadTask); 373 MainApplication.worker.submit(moduleInfoDownloadContinuation); 396 374 } 397 375 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdDialog.java
r32545 r33518 17 17 import javax.swing.tree.TreeModel; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.actions.JosmAction; 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.gui.SideButton; 22 22 import org.openstreetmap.josm.gui.dialogs.ToggleDialog; … … 50 50 @Override 51 51 public void actionPerformed(ActionEvent e) { 52 if (Main .getLayerManager().getEditLayer() instanceof OdLayer) {52 if (MainApplication.getLayerManager().getEditLayer() instanceof OdLayer) { 53 53 dataLayer.downloadOsmData(); 54 54 diffButton.setEnabled(dataLayer.osmLayer != null); … … 76 76 @Override 77 77 public void actionPerformed(ActionEvent e) { 78 if (Main .getLayerManager().getEditLayer() instanceof OdLayer) {78 if (MainApplication.getLayerManager().getEditLayer() instanceof OdLayer) { 79 79 dataLayer.makeDiff(); 80 80 } … … 108 108 @Override 109 109 public void mousePressed(MouseEvent e) { 110 if (Main .getLayerManager().getEditLayer() instanceof OdLayer) {110 if (MainApplication.getLayerManager().getEditLayer() instanceof OdLayer) { 111 111 JPopupMenu popup = new JPopupMenu(); 112 112 for (JosmAction tool : dataLayer.handler.getTools()) { … … 125 125 createLayout(new JTree(treeModel), true, buttons); 126 126 127 Main .getLayerManager().addActiveLayerChangeListener(this);127 MainApplication.getLayerManager().addActiveLayerChangeListener(this); 128 128 } 129 129 … … 136 136 @Override 137 137 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 138 Layer newLayer = Main .getLayerManager().getActiveLayer();138 Layer newLayer = MainApplication.getLayerManager().getActiveLayer(); 139 139 if (newLayer instanceof OdLayer) { 140 140 dataLayer = ((OdLayer) newLayer).getDataLayer(); … … 158 158 public void destroy() { 159 159 super.destroy(); 160 Main .getLayerManager().removeActiveLayerChangeListener(this);160 MainApplication.getLayerManager().removeActiveLayerChangeListener(this); 161 161 } 162 162 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdPreferenceSetting.java
r32545 r33518 23 23 24 24 import org.openstreetmap.josm.Main; 25 import org.openstreetmap.josm.gui.MainApplication; 25 26 import org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting; 26 27 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; … … 151 152 // this is the task which will run *after* the modules are downloaded 152 153 // 153 final Runnable continuation = new Runnable() { 154 @Override 155 public void run() { 156 boolean requiresRestart = false; 157 if (task != null && !task.isCanceled()) { 158 if (!task.getDownloadedModules().isEmpty()) { 159 requiresRestart = true; 160 } 154 final Runnable continuation = () -> { 155 boolean requiresRestart = false; 156 if (task != null && !task.isCanceled()) { 157 if (!task.getDownloadedModules().isEmpty()) { 158 requiresRestart = true; 161 159 } 162 163 // build the messages. We only display one message, including the status 164 // information from the module download task and - if necessary - a hint165 // to restart JOSM166 //167 StringBuilder sb = new StringBuilder();168 sb.append("<html>");169 if (task != null && !task.isCanceled()) {170 sb.append(ModulePreference.buildDownloadSummary(task));171 }172 if (requiresRestart) {173 sb.append(tr("You have to restart JOSM for some settings to take effect."));174 }175 sb.append("</html>");176 177 // display the message, if necessary 178 //179 if ((task != null && !task.isCanceled()) || requiresRestart) {180 JOptionPane.showMessageDialog(181 Main.parent,182 sb.toString(),183 tr("Warning"),184 JOptionPane.WARNING_MESSAGE185 );186 }187 Main.parent.repaint();188 }160 } 161 162 // build the messages. We only display one message, including the status 163 // information from the module download task and - if necessary - a hint 164 // to restart JOSM 165 // 166 StringBuilder sb = new StringBuilder(); 167 sb.append("<html>"); 168 if (task != null && !task.isCanceled()) { 169 sb.append(ModulePreference.buildDownloadSummary(task)); 170 } 171 if (requiresRestart) { 172 sb.append(tr("You have to restart JOSM for some settings to take effect.")); 173 } 174 sb.append("</html>"); 175 176 // display the message, if necessary 177 // 178 if ((task != null && !task.isCanceled()) || requiresRestart) { 179 JOptionPane.showMessageDialog( 180 Main.parent, 181 sb.toString(), 182 tr("Warning"), 183 JOptionPane.WARNING_MESSAGE 184 ); 185 } 186 Main.parent.repaint(); 189 187 }; 190 188 … … 193 191 // by the remaining "save preferences" activites run on the Swing EDT. 194 192 // 195 Main.worker.submit(task); 196 Main.worker.submit( 197 new Runnable() { 198 @Override 199 public void run() { 200 SwingUtilities.invokeLater(continuation); 201 } 202 } 203 ); 193 MainApplication.worker.submit(task); 194 MainApplication.worker.submit(() -> SwingUtilities.invokeLater(continuation)); 204 195 } else { 205 196 // no need for asynchronous activities. Simply run the remaining "save preference" -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ProjectionChooser.java
r32545 r33518 15 15 import javax.swing.JPanel; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.Bounds; 19 18 import org.openstreetmap.josm.data.coor.CoordinateFormat; … … 24 23 import org.openstreetmap.josm.gui.preferences.projection.SubPrefsOptions; 25 24 import org.openstreetmap.josm.tools.GBC; 25 import org.openstreetmap.josm.tools.Logging; 26 26 27 27 /** … … 151 151 ProjectionChoice pc = (ProjectionChoice) projectionCombo.getSelectedItem(); 152 152 if (pc != null) { 153 Main.info("Chosen projection: "+pc+" ("+pc.getProjection()+")");153 Logging.info("Chosen projection: "+pc+" ("+pc.getProjection()+")"); 154 154 return pc.getProjection(); 155 155 } else { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/AbstractImporter.java
r30723 r33518 10 10 import java.io.InputStream; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.ExtensionFileFilter; 14 13 import org.openstreetmap.josm.data.osm.DataSet; … … 22 21 import org.openstreetmap.josm.plugins.opendata.core.modules.Module; 23 22 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleHandler; 23 import org.openstreetmap.josm.tools.Logging; 24 24 25 25 public abstract class AbstractImporter extends OsmImporter { 26 26 27 27 protected AbstractDataSetHandler handler; 28 28 29 29 protected File file; 30 30 31 31 public AbstractImporter(ExtensionFileFilter filter) { 32 32 super(filter); 33 33 } 34 34 35 35 protected final AbstractDataSetHandler findDataSetHandler(File file) { 36 36 for (Module module : ModuleHandler.moduleList) { … … 55 55 importData(in, file, progressMonitor); 56 56 } catch (FileNotFoundException e) { 57 Main.error(e);57 Logging.error(e); 58 58 throw new IOException(tr("File ''{0}'' does not exist.", file.getName()), e); 59 59 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NeptuneReader.java
r33245 r33518 23 23 import javax.xml.validation.Validator; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.data.coor.LatLon; 27 26 import org.openstreetmap.josm.data.osm.DataSet; … … 35 34 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 36 35 import org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchConstants; 36 import org.openstreetmap.josm.tools.Logging; 37 37 import org.xml.sax.SAXException; 38 38 … … 103 103 Validator validator = schema.newValidator(); 104 104 validator.validate(xmlFile); 105 Main.info(xmlFile.getSystemId() + " is valid");105 Logging.info(xmlFile.getSystemId() + " is valid"); 106 106 return true; 107 107 } catch (SAXException e) { 108 Main.error(xmlFile.getSystemId() + " is NOT valid");109 Main.error("Reason: " + e.getLocalizedMessage());108 Logging.error(xmlFile.getSystemId() + " is NOT valid"); 109 Logging.error("Reason: " + e.getLocalizedMessage()); 110 110 } catch (IOException e) { 111 Main.error(xmlFile.getSystemId() + " is NOT valid");112 Main.error("Reason: " + e.getLocalizedMessage());111 Logging.error(xmlFile.getSystemId() + " is NOT valid"); 112 Logging.error("Reason: " + e.getLocalizedMessage()); 113 113 } 114 114 } catch (IOException e) { 115 Main.error(e);115 Logging.error(e); 116 116 } 117 117 … … 135 135 p.put("ref:neptune", object.getObjectId()); 136 136 if (tridentObjects.put(object.getObjectId(), p) != null) { 137 Main.error("Trident object duplicated !!! : "+object.getObjectId());137 Logging.error("Trident object duplicated !!! : "+object.getObjectId()); 138 138 } 139 139 } … … 192 192 r.put(OSM_ROUTE_MASTER, OSM_TROLLEYBUS); break; 193 193 default: 194 Main.warn("Unsupported transport mode: "+line.getTransportModeName());194 Logging.warn("Unsupported transport mode: "+line.getTransportModeName()); 195 195 } 196 196 r.put("ref", line.getNumber()); … … 263 263 StopArea child = findStopArea(childId); 264 264 if (child == null) { 265 Main.warn("Cannot find StopArea: "+childId);265 Logging.warn("Cannot find StopArea: "+childId); 266 266 } else { 267 267 if (child.getStopAreaExtension().getAreaType().equals(ChouetteAreaType.BOARDING_POSITION)) { … … 270 270 StopPoint grandchild = findStopPoint(grandchildId); 271 271 if (grandchild == null) { 272 Main.warn("Cannot find StopPoint: "+grandchildId);272 Logging.warn("Cannot find StopPoint: "+grandchildId); 273 273 } else { 274 274 if (grandchild.getLongLatType().equals(LongLatTypeType.WGS_84)) { … … 276 276 stopArea.addMember(new RelationMember(OSM_PLATFORM, platform)); 277 277 } else { 278 Main.warn("Unsupported long/lat type: "+grandchild.getLongLatType());278 Logging.warn("Unsupported long/lat type: "+grandchild.getLongLatType()); 279 279 } 280 280 } 281 281 } else { 282 Main.warn("Unsupported grandchild: "+grandchildId);282 Logging.warn("Unsupported grandchild: "+grandchildId); 283 283 } 284 284 } … … 286 286 AreaCentroid areaCentroid = findAreaCentroid(centroidId); 287 287 if (areaCentroid == null) { 288 Main.warn("Cannot find AreaCentroid: "+centroidId);288 Logging.warn("Cannot find AreaCentroid: "+centroidId); 289 289 } else if (!areaCentroid.getLongLatType().equals(LongLatTypeType.WGS_84)) { 290 Main.warn("Unsupported long/lat type: "+areaCentroid.getLongLatType());290 Logging.warn("Unsupported long/lat type: "+areaCentroid.getLongLatType()); 291 291 } else { 292 292 for (RelationMember member : stopArea.getMembers()) { … … 298 298 } 299 299 } else { 300 Main.warn("Unsupported child type: "+child.getStopAreaExtension().getAreaType());300 Logging.warn("Unsupported child type: "+child.getStopAreaExtension().getAreaType()); 301 301 } 302 302 } … … 305 305 StopPoint child = findStopPoint(childId); 306 306 if (child == null) { 307 Main.warn("Cannot find StopPoint: "+childId);307 Logging.warn("Cannot find StopPoint: "+childId); 308 308 } else { 309 309 // TODO 310 Main.info("TODO: handle StopPoint "+childId);310 Logging.info("TODO: handle StopPoint "+childId); 311 311 } 312 312 313 313 } else { 314 Main.warn("Unsupported child: "+childId);314 Logging.warn("Unsupported child: "+childId); 315 315 } 316 316 } … … 318 318 //Main.info("skipping StopArea with type "+sa.getStopAreaExtension().getAreaType()+": "+sa.getObjectId()); 319 319 } else { 320 Main.warn("Unsupported StopArea type: "+sa.getStopAreaExtension().getAreaType());320 Logging.warn("Unsupported StopArea type: "+sa.getStopAreaExtension().getAreaType()); 321 321 } 322 322 } … … 331 331 PTLinkType ptlink = findPtLink(id); 332 332 if (ptlink == null) { 333 Main.warn("Cannot find PTLinkType: "+id);333 Logging.warn("Cannot find PTLinkType: "+id); 334 334 } else { 335 335 /*StopPoint start = findStopPoint(ptlink.getStartOfLink()); … … 338 338 OsmPrimitive end = tridentObjects.get(ptlink.getEndOfLink()); 339 339 if (start == null) { 340 Main.warn("Cannot find start StopPoint: "+ptlink.getStartOfLink());340 Logging.warn("Cannot find start StopPoint: "+ptlink.getStartOfLink()); 341 341 } else if (start.get(OSM_PUBLIC_TRANSPORT).equals(OSM_STOP) || start.get(OSM_PUBLIC_TRANSPORT).equals(OSM_PLATFORM)) { 342 342 addStopToRoute(route, start); … … 344 344 345 345 if (end == null) { 346 Main.warn("Cannot find end StopPoint: "+ptlink.getEndOfLink());346 Logging.warn("Cannot find end StopPoint: "+ptlink.getEndOfLink()); 347 347 } else if (end.get(OSM_PUBLIC_TRANSPORT).equals(OSM_STOP) || end.get(OSM_PUBLIC_TRANSPORT).equals(OSM_PLATFORM)) { 348 348 addStopToRoute(route, end); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NetworkReader.java
r32545 r33518 11 11 import java.util.regex.Pattern; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.osm.DataSet; 15 14 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 32 31 import org.openstreetmap.josm.plugins.opendata.core.io.tabular.XlsReader; 33 32 import org.openstreetmap.josm.tools.CheckParameterUtil; 33 import org.openstreetmap.josm.tools.Logging; 34 34 35 35 public class NetworkReader extends OsmServerReader { … … 110 110 //return CsvReader.class;//FIXME, can also be .tar.gz 111 111 } else { 112 Main.warn("Unsupported content type: "+contentType);112 Logging.warn("Unsupported content type: "+contentType); 113 113 } 114 114 return null; … … 190 190 } 191 191 } catch (Exception e) { 192 Main.trace(e);192 Logging.trace(e); 193 193 } 194 194 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/OsmDownloader.java
r32545 r33518 7 7 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.gui.MainApplication; 9 10 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 11 import org.openstreetmap.josm.tools.Logging; 10 12 11 13 public final class OsmDownloader { … … 19 21 try { 20 22 String oapiServer = Main.pref.get(OdConstants.PREF_OAPI, OdConstants.DEFAULT_OAPI); 21 Main.info(oapiReq);23 Logging.info(oapiReq); 22 24 String oapiReqEnc = URLEncoder.encode(oapiReq, OdConstants.UTF8); 23 Main .main.menu.openLocation.openUrl(false, oapiServer+"data="+oapiReqEnc);25 MainApplication.getMenu().openLocation.openUrl(false, oapiServer+"data="+oapiReqEnc); 24 26 } catch (UnsupportedEncodingException e) { 25 27 e.printStackTrace(); … … 32 34 String xapiServer = Main.pref.get(OdConstants.PREF_XAPI, OdConstants.DEFAULT_XAPI); 33 35 for (String xapiReq : xapiReqs) { 34 Main .main.menu.openLocation.openUrl(false, xapiServer+xapiReq);36 MainApplication.getMenu().openLocation.openUrl(false, xapiServer+xapiReq); 35 37 } 36 38 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ArchiveReader.java
r33245 r33518 17 17 import javax.xml.stream.XMLStreamException; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.osm.DataSet; 21 20 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 39 38 import org.openstreetmap.josm.plugins.opendata.core.io.tabular.XlsReader; 40 39 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 40 import org.openstreetmap.josm.tools.Logging; 41 41 42 42 public abstract class ArchiveReader extends AbstractReader { … … 123 123 } 124 124 } catch (IllegalArgumentException e) { 125 Main.error(e.getMessage());125 Logging.error(e.getMessage()); 126 126 } finally { 127 127 OdUtils.deleteDir(temp); … … 144 144 return null; 145 145 } else if (!f.exists()) { 146 Main.warn("File does not exist: "+f.getPath());146 Logging.warn("File does not exist: "+f.getPath()); 147 147 return null; 148 148 } else { 149 Main.info("Parsing file "+f.getName());149 Logging.info("Parsing file "+f.getName()); 150 150 DataSet from = null; 151 151 FileInputStream in = new FileInputStream(f); … … 176 176 from = NeptuneReader.parseDataSet(in, handler, instance); 177 177 } else { 178 Main.warn("Unsupported XML file: "+f.getName());178 Logging.warn("Unsupported XML file: "+f.getName()); 179 179 } 180 180 } else { 181 Main.warn("Unsupported file extension: "+f.getName());181 Logging.warn("Unsupported file extension: "+f.getName()); 182 182 } 183 183 return from; -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/SevenZipReader.java
r33245 r33518 23 23 import org.j7zip.SevenZip.Archive.IInArchive; 24 24 import org.j7zip.SevenZip.Archive.SevenZip.Handler; 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.data.osm.DataSet; 27 26 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 29 28 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 30 29 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 30 import org.openstreetmap.josm.tools.Logging; 31 31 32 32 public class SevenZipReader extends ArchiveReader { … … 44 44 if (archive.Open(random) != 0) { 45 45 String message = "Unable to open 7z archive: "+tmpFile.getPath(); 46 Main.warn(message);46 Logging.warn(message); 47 47 random.close(); 48 48 if (!tmpFile.delete()) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReader.java
r33245 r33518 17 17 import javax.xml.stream.XMLStreamException; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.osm.DataSet; 21 20 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 22 21 import org.openstreetmap.josm.io.IllegalDataException; 23 22 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 23 import org.openstreetmap.josm.tools.Logging; 24 24 25 25 public class ZipReader extends ArchiveReader { … … 47 47 protected void extractArchive(final File temp, final List<File> candidates) throws IOException, FileNotFoundException { 48 48 while ((entry = zis.getNextEntry()) != null) { 49 if (Main.isDebugEnabled()) { 50 Main.debug("Extracting "+entry.getName()); 51 } 49 Logging.debug("Extracting {0}", entry.getName()); 52 50 File file = new File(temp + File.separator + entry.getName()); 53 51 File parent = file.getParentFile(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/AbstractMapInfoReader.java
r33245 r33518 13 13 import java.util.List; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.osm.DataSet; 17 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 19 18 import org.openstreetmap.josm.io.IllegalDataException; 20 19 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 20 import org.openstreetmap.josm.tools.Logging; 21 21 22 22 public abstract class AbstractMapInfoReader extends AbstractReader { … … 78 78 return Charset.forName(OdConstants.MAC_ROMAN); 79 79 } else { 80 Main.error("Line "+lineNum+". Unknown charset detected: "+line);80 Logging.error("Line "+lineNum+". Unknown charset detected: "+line); 81 81 return Charset.forName(words[index]); 82 82 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/DefaultShpHandler.java
r32545 r33518 33 33 import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference; 34 34 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 35 import org.openstreetmap.josm.tools.Logging; 35 36 import org.openstreetmap.josm.tools.Pair; 36 37 … … 52 53 OdConstants.PREF_CRS_COMPARISON_TOLERANCE, OdConstants.DEFAULT_CRS_COMPARISON_TOLERANCE); 53 54 if (Main.pref.getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) { 54 Main.debug("Comparing "+a+" and "+b+" -> "+res);55 Logging.debug("Comparing "+a+" and "+b+" -> "+res); 55 56 } 56 57 return res; … … 105 106 result.add(CRS.findMathTransform(CRS.decode(p.toCode()), targetCRS, lenient)); 106 107 } catch (FactoryException e) { 107 Main.error(e.getMessage());108 Logging.error(e.getMessage()); 108 109 } 109 110 } … … 116 117 if (!result.isEmpty()) { 117 118 if (result.size() > 1) { 118 Main.warn("Found multiple projections !"); // TODO: something119 Logging.warn("Found multiple projections !"); // TODO: something 119 120 } 120 121 return result.get(0); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GeographicReader.java
r33358 r33518 62 62 import org.openstreetmap.josm.tools.ImageProvider; 63 63 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 64 import org.openstreetmap.josm.tools.Logging; 64 65 import org.openstreetmap.josm.tools.UserCancelException; 65 66 import org.openstreetmap.josm.tools.Utils; … … 180 181 tempWay.addNode(createOrGetNode(ls.getPointN(i))); 181 182 } catch (TransformException | IllegalArgumentException e) { 182 Main.error("Exception for " + ls + ": " + e.getClass().getName() + ": " + e.getMessage());183 Logging.error("Exception for " + ls + ": " + e.getClass().getName() + ": " + e.getMessage()); 183 184 } 184 185 } … … 250 251 251 252 private static void compareDebug(CoordinateReferenceSystem crs1, CoordinateReferenceSystem crs2) { 252 Main.debug("-- COMPARING "+crs1.getName()+" WITH "+crs2.getName()+" --");253 Logging.debug("-- COMPARING "+crs1.getName()+" WITH "+crs2.getName()+" --"); 253 254 compareDebug("class", crs1.getClass(), crs2.getClass()); 254 255 CoordinateSystem cs1 = crs1.getCoordinateSystem(); … … 279 280 } 280 281 } 281 Main.debug("-- COMPARING FINISHED --");282 Logging.debug("-- COMPARING FINISHED --"); 282 283 } 283 284 … … 295 296 296 297 private static boolean compareDebug(String text, boolean result, Object o1, Object o2) { 297 Main.debug(text + ": " + result + "("+o1+", "+o2+")");298 Logging.debug(text + ": " + result + "("+o1+", "+o2+")"); 298 299 return result; 299 300 } … … 309 310 310 311 private static void loadEsriWkid() throws IOException { 311 Main.info("Loading ESRI WKID database...");312 Logging.info("Loading ESRI WKID database..."); 312 313 try (InputStream in = getEsriWkidStream(); 313 314 JsonReader json = JsonProvider.provider().createReader(in)) { … … 322 323 } 323 324 } 324 Main.info("ESRI WKID database loaded");325 Logging.info("ESRI WKID database loaded"); 325 326 } 326 327 … … 330 331 loadEsriWkid(); 331 332 } catch (IOException e) { 332 Main.error(e);333 Logging.error(e); 333 334 } 334 335 } … … 352 353 f.set(crs, Collections.singleton(new NamedIdentifier(Citations.fromName("EPSG"), epsgCode.toString()))); 353 354 } catch (ReflectiveOperationException | SecurityException e) { 354 Main.error(e);355 Logging.error(e); 355 356 } 356 357 } … … 360 361 transform = CRS.findMathTransform(crs, wgs84); 361 362 } catch (OperationNotFoundException e) { 362 Main.info(crs.getName()+": "+e.getMessage()); // Bursa wolf parameters required.363 Logging.info(crs.getName()+": "+e.getMessage()); // Bursa wolf parameters required. 363 364 364 365 if (findSimiliarCrs) { … … 374 375 OdConstants.PREF_CRS_COMPARISON_TOLERANCE, OdConstants.DEFAULT_CRS_COMPARISON_TOLERANCE)); 375 376 if (((AbstractCRS) candidate).equals((AbstractIdentifiedObject) crs, false)) { 376 Main.info("Found a potential CRS: "+candidate.getName());377 Logging.info("Found a potential CRS: "+candidate.getName()); 377 378 candidates.add(candidate); 378 379 } else if (Main.pref.getBoolean(OdConstants.PREF_CRS_COMPARISON_DEBUG, false)) { … … 382 383 } 383 384 } catch (FactoryException ex) { 384 Main.trace(ex);385 Logging.trace(ex); 385 386 } 386 387 } 387 388 388 389 if (candidates.size() > 1) { 389 Main.warn("Found several potential CRS: "+Arrays.toString(candidates.toArray()));390 Logging.warn("Found several potential CRS: "+Arrays.toString(candidates.toArray())); 390 391 // TODO: ask user which one to use 391 392 } … … 396 397 transform = CRS.findMathTransform(newCRS, wgs84, false); 397 398 } catch (OperationNotFoundException ex) { 398 Main.warn(newCRS.getName()+": "+e.getMessage());399 Logging.warn(newCRS.getName()+": "+e.getMessage()); 399 400 } 400 401 } … … 407 408 transform = handler.findMathTransform(crs, wgs84, false); 408 409 } catch (OperationNotFoundException ex) { 409 Main.warn(crs.getName()+": "+ex.getMessage()); // Bursa wolf parameters required.410 Logging.warn(crs.getName()+": "+ex.getMessage()); // Bursa wolf parameters required. 410 411 } 411 412 } else { … … 417 418 } 418 419 } catch (OperationNotFoundException ex) { 419 Main.warn(crs.getName()+": "+ex.getMessage()); // Bursa wolf parameters required.420 Logging.warn(crs.getName()+": "+ex.getMessage()); // Bursa wolf parameters required. 420 421 } 421 422 } … … 427 428 throw new UserCancelException(); 428 429 } 429 Main.info("Searching for a lenient math transform.");430 Logging.info("Searching for a lenient math transform."); 430 431 transform = CRS.findMathTransform(crs, wgs84, true); 431 432 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/GmlReader.java
r33051 r33518 30 30 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 31 31 import org.openstreetmap.josm.plugins.opendata.core.datasets.NationalHandlers; 32 import org.openstreetmap.josm.tools.Logging; 32 33 import org.openstreetmap.josm.tools.UserCancelException; 33 34 … … 109 110 110 111 private void findCRS(String srs) throws NoSuchAuthorityCodeException, FactoryException { 111 Main.info("Finding CRS for "+srs);112 Logging.info("Finding CRS for "+srs); 112 113 if (gmlHandler != null) { 113 114 crs = gmlHandler.getCrsFor(srs); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/KmzReader.java
r33245 r33518 12 12 import javax.xml.stream.XMLStreamException; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.osm.DataSet; 16 15 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 17 16 import org.openstreetmap.josm.io.AbstractReader; 18 17 import org.openstreetmap.josm.io.IllegalDataException; 18 import org.openstreetmap.josm.tools.Logging; 19 19 20 20 public class KmzReader extends AbstractReader { … … 42 42 entry = zis.getNextEntry(); 43 43 if (entry == null) { 44 Main.warn("No KML file found");44 Logging.warn("No KML file found"); 45 45 return null; 46 46 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/MifReader.java
r32545 r33518 17 17 import java.util.Arrays; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.coor.EastNorth; 21 20 import org.openstreetmap.josm.data.osm.DataSet; … … 36 35 import org.openstreetmap.josm.plugins.opendata.core.io.InputStreamReaderUnbuffered; 37 36 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 37 import org.openstreetmap.josm.tools.Logging; 38 38 39 39 /** … … 110 110 private void parseUnique(String[] words) { 111 111 // TODO 112 Main.warn("TODO Unique: "+line);112 Logging.warn("TODO Unique: "+line); 113 113 } 114 114 115 115 private void parseIndex(String[] words) { 116 116 // TODO 117 Main.warn("TODO Index: "+line);117 Logging.warn("TODO Index: "+line); 118 118 } 119 119 … … 285 285 286 286 if (josmProj == null) { 287 Main.info(line);288 Main.info(params);287 Logging.info(line); 288 Logging.info(params); 289 289 josmProj = new CustomProjection(params); 290 290 } … … 312 312 maxx = Double.valueOf(words[index+3].substring(1)); 313 313 maxy = Double.valueOf(words[index+4].substring(0, words[index+4].length()-1)); 314 if ( Main.isTraceEnabled()) {315 Main.trace(Arrays.toString(words) + " -> "+minx+","+miny+","+maxx+","+maxy);314 if (Logging.isTraceEnabled()) { 315 Logging.trace(Arrays.toString(words) + " -> "+minx+","+miny+","+maxx+","+maxy); 316 316 } 317 317 } … … 348 348 case "table": 349 349 case "window": 350 Main.error("Unsupported CoordSys clause: "+line);350 Logging.error("Unsupported CoordSys clause: "+line); 351 351 break; 352 352 default: 353 Main.error("Line "+lineNum+". Invalid CoordSys clause: "+line);353 Logging.error("Line "+lineNum+". Invalid CoordSys clause: "+line); 354 354 } 355 355 } … … 357 357 private void parseTransform(String[] words) { 358 358 // TODO 359 Main.warn("TODO Transform: "+line);359 Logging.warn("TODO Transform: "+line); 360 360 } 361 361 … … 427 427 private void parseArc(String[] words) { 428 428 // TODO 429 Main.warn("TODO Arc: "+line);429 Logging.warn("TODO Arc: "+line); 430 430 } 431 431 432 432 private void parseText(String[] words) { 433 433 // TODO 434 Main.warn("TODO Text: "+line);434 Logging.warn("TODO Text: "+line); 435 435 } 436 436 437 437 private void parseRect(String[] words) { 438 438 // TODO 439 Main.warn("TODO Rect: "+line);439 Logging.warn("TODO Rect: "+line); 440 440 } 441 441 442 442 private void parseRoundRect(String[] words) { 443 443 // TODO 444 Main.warn("TODO RoundRect: "+line);444 Logging.warn("TODO RoundRect: "+line); 445 445 } 446 446 447 447 private void parseEllipse(String[] words) { 448 448 // TODO 449 Main.warn("TODO Ellipse: "+line);449 Logging.warn("TODO Ellipse: "+line); 450 450 } 451 451 … … 580 580 // Do nothing 581 581 } else if (!words[0].isEmpty()) { 582 Main.warn("Line "+lineNum+". Unknown clause in data section: "+line);582 Logging.warn("Line "+lineNum+". Unknown clause in data section: "+line); 583 583 } 584 584 } else if (state == State.READING_COLUMNS && numcolumns > 0) { … … 588 588 } 589 589 } else if (!line.isEmpty()) { 590 Main.warn("Line "+lineNum+". Unknown clause in header: "+line);590 Logging.warn("Line "+lineNum+". Unknown clause in header: "+line); 591 591 } 592 592 } … … 598 598 String[] fields = OdUtils.stripQuotesAndExtraChars(midLine.split(delimiter.toString()), delimiter.toString()); 599 599 if (columns.size() != fields.length) { 600 Main.error("Incoherence between MID and MIF files ("+columns.size()+" columns vs "+fields.length+" fields)");600 Logging.error("Incoherence between MID and MIF files ("+columns.size()+" columns vs "+fields.length+" fields)"); 601 601 } 602 602 for (int i = 0; i < Math.min(columns.size(), fields.length); i++) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java
r33378 r33518 49 49 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 50 50 import org.openstreetmap.josm.plugins.opendata.core.datasets.NationalHandlers; 51 import org.openstreetmap.josm.tools.Logging; 51 52 import org.openstreetmap.josm.tools.UserCancelException; 52 53 … … 93 94 crs = desc.getCoordinateReferenceSystem(); 94 95 } else if (!GraphicsEnvironment.isHeadless()) { 95 GuiHelper.runInEDTAndWait(new Runnable() { 96 @Override 97 public void run() { 98 if (0 == JOptionPane.showConfirmDialog( 99 parent, 100 tr("Unable to detect Coordinate Reference System.\nWould you like to fallback to ESPG:4326 (WGS 84) ?"), 101 tr("Warning: CRS not found"), 102 JOptionPane.YES_NO_CANCEL_OPTION 103 )) { 104 crs = wgs84; 105 } 96 GuiHelper.runInEDTAndWait(() -> { 97 if (0 == JOptionPane.showConfirmDialog( 98 parent, 99 tr("Unable to detect Coordinate Reference System.\nWould you like to fallback to ESPG:4326 (WGS 84) ?"), 100 tr("Warning: CRS not found"), 101 JOptionPane.YES_NO_CANCEL_OPTION 102 )) { 103 crs = wgs84; 106 104 } 107 105 }); … … 126 124 int nGeometries = mp.getNumGeometries(); 127 125 if (nGeometries < 1) { 128 Main.error("empty geometry collection found");126 Logging.error("empty geometry collection found"); 129 127 } else { 130 128 Relation r = null; … … 154 152 readNonGeometricAttributes(feature, createOrGetNode((Point) g)); 155 153 } else { 156 Main.error("unsupported geometry : "+g);154 Logging.error("unsupported geometry : "+g); 157 155 } 158 156 } … … 161 159 } else { 162 160 // Debug unknown geometry 163 Main.debug("\ttype: "+geometry.getType());164 Main.debug("\tbounds: "+geometry.getBounds());165 Main.debug("\tdescriptor: "+desc);166 Main.debug("\tname: "+geometry.getName());167 Main.debug("\tvalue: "+geometry.getValue());168 Main.debug("\tid: "+geometry.getIdentifier());169 Main.debug("-------------------------------------------------------------");161 Logging.debug("\ttype: "+geometry.getType()); 162 Logging.debug("\tbounds: "+geometry.getBounds()); 163 Logging.debug("\tdescriptor: "+desc); 164 Logging.debug("\tname: "+geometry.getName()); 165 Logging.debug("\tvalue: "+geometry.getValue()); 166 Logging.debug("\tid: "+geometry.getIdentifier()); 167 Logging.debug("-------------------------------------------------------------"); 170 168 } 171 169 … … 196 194 charset = Charset.forName(reader.readLine()); 197 195 } catch (IOException | UnsupportedCharsetException | IllegalCharsetNameException e) { 198 Main.warn(e);196 Logging.warn(e); 199 197 } 200 198 } 201 199 } 202 200 if (charset != null) { 203 Main.info("Using charset "+charset);201 Logging.info("Using charset "+charset); 204 202 params.put(ShapefileDataStoreFactory.DBFCHARSET.key, charset.name()); 205 203 } … … 249 247 } 250 248 } catch (IOException e) { 251 Main.error(e);249 Logging.error(e); 252 250 throw e; 253 251 } catch (Exception e) { 254 Main.error(e);252 Logging.error(e); 255 253 throw new IOException(e); 256 254 } … … 277 275 } 278 276 } catch (Exception e) { 279 Main.error(e);277 Logging.error(e); 280 278 } 281 279 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/TabReader.java
r32545 r33518 16 16 import org.geotools.data.shapefile.dbf.DbaseFileReader.Row; 17 17 import org.geotools.data.shapefile.files.TabFiles; 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.osm.DataSet; 20 19 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 23 22 import org.openstreetmap.josm.plugins.opendata.core.io.tabular.SpreadSheetHandler; 24 23 import org.openstreetmap.josm.plugins.opendata.core.io.tabular.SpreadSheetReader; 24 import org.openstreetmap.josm.tools.Logging; 25 25 26 26 /** … … 83 83 doParse(columns.toArray(new String[0]), instance); 84 84 } catch (IOException e) { 85 Main.error(e.getMessage());85 Logging.error(e.getMessage()); 86 86 } 87 87 return ds; … … 105 105 parseColumns(words); 106 106 } else if (!line.isEmpty()) { 107 Main.warn("Line "+lineNum+". Unknown clause in header: "+line);107 Logging.warn("Line "+lineNum+". Unknown clause in header: "+line); 108 108 } 109 109 } … … 118 118 datCharset = parseCharset(words, 3); 119 119 } else { 120 Main.warn("Line "+lineNum+". Unknown Type clause in header: "+line);120 Logging.warn("Line "+lineNum+". Unknown Type clause in header: "+line); 121 121 } 122 122 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvImporter.java
r33040 r33518 10 10 import java.io.InputStream; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.ExtensionFileFilter; 14 13 import org.openstreetmap.josm.data.osm.DataSet; … … 17 16 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 18 17 import org.openstreetmap.josm.plugins.opendata.core.io.AbstractImporter; 18 import org.openstreetmap.josm.tools.Logging; 19 19 20 20 public class CsvImporter extends AbstractImporter { … … 52 52 result = line != null && line.equalsIgnoreCase(COLOMBUS_HEADER); 53 53 } catch (IOException e) { 54 Main.trace(e);54 Logging.trace(e); 55 55 } 56 56 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvReader.java
r32545 r33518 8 8 import java.nio.charset.Charset; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.osm.DataSet; 12 11 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 14 13 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 15 14 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 15 import org.openstreetmap.josm.tools.Logging; 16 16 17 17 public class CsvReader extends SpreadSheetReader { … … 44 44 if (csvHandler == null || csvHandler.getSeparator() == null || ";".equals(csvHandler.getSeparator())) { 45 45 // If default sep has been used, try comma 46 Main.warn(e.getMessage());46 Logging.warn(e.getMessage()); 47 47 csvReader.sep = ","; 48 48 return csvReader.doParse(csvReader.splitLine(), instance); … … 55 55 @Override 56 56 protected void initResources(InputStream in, ProgressMonitor progressMonitor) throws IOException { 57 Main.info("Parsing CSV file using charset "+charset+" and separator '"+sep+"'");57 Logging.info("Parsing CSV file using charset "+charset+" and separator '"+sep+"'"); 58 58 59 59 reader = new BufferedReader(new InputStreamReader(in, charset)); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsDocument.java
r32904 r33518 11 11 import org.jopendocument.io.SaxContentUnmarshaller; 12 12 import org.jopendocument.model.OpenDocument; 13 import org.openstreetmap.josm. Main;13 import org.openstreetmap.josm.tools.Logging; 14 14 import org.openstreetmap.josm.tools.Utils; 15 15 import org.xml.sax.InputSource; … … 45 45 if (entry.getName().equals("content.xml")) { 46 46 rdr.setContentHandler(contentHandler); 47 Main.info("Parsing content.xml");47 Logging.info("Parsing content.xml"); 48 48 rdr.parse(getEntryInputSource(zis)); 49 49 contentParsed = true; … … 52 52 53 53 } catch (Exception e) { 54 Main.error(e);54 Logging.error(e); 55 55 } 56 56 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/OdsReader.java
r30723 r33518 13 13 import org.jopendocument.model.table.TableTableRow; 14 14 import org.jopendocument.model.text.TextP; 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.osm.DataSet; 17 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 17 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 18 import org.openstreetmap.josm.tools.Logging; 19 19 20 20 public class OdsReader extends SpreadSheetReader { … … 24 24 private List<TableTableRow> rows; 25 25 private int rowIndex; 26 26 27 27 private static final String SEP = "TextP:["; 28 28 29 29 public OdsReader(SpreadSheetHandler handler) { 30 30 super(handler); … … 39 39 protected void initResources(InputStream in, ProgressMonitor progressMonitor) throws IOException { 40 40 try { 41 Main.info("Parsing ODS file");41 Logging.info("Parsing ODS file"); 42 42 doc = new OdsDocument(in); 43 43 List<OfficeSpreadsheet> spreadsheets = doc.getBody().getOfficeSpreadsheets(); … … 63 63 64 64 if (rowIndex % 5000 == 0) { 65 Main.info("Lines read: "+rowIndex);65 Logging.info("Lines read: "+rowIndex); 66 66 } 67 67 … … 76 76 } 77 77 } 78 78 79 79 return rowIndex == 1 || !allFieldsBlank ? result.toArray(new String[0]) : null; 80 80 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java
r33245 r33518 29 29 import org.openstreetmap.josm.plugins.opendata.core.gui.ChooserLauncher; 30 30 import org.openstreetmap.josm.plugins.opendata.core.io.ProjectionPatterns; 31 import org.openstreetmap.josm.tools.Logging; 31 32 32 33 public abstract class SpreadSheetReader extends AbstractReader { … … 94 95 95 96 public DataSet doParse(String[] header, ProgressMonitor progressMonitor) throws IOException { 96 Main.info("Header: "+Arrays.toString(header));97 Logging.info("Header: "+Arrays.toString(header)); 97 98 98 99 Map<ProjectionPatterns, List<CoordinateColumns>> projColumns = new HashMap<>(); … … 173 174 } 174 175 175 Main.info("Loading data using projections "+message);176 Logging.info("Loading data using projections "+message); 176 177 177 178 final DataSet ds = new DataSet(); … … 194 195 195 196 if (fields.length > header.length) { 196 Main.warn(tr("Invalid file. Bad length on line {0}. Expected {1} columns, got {2}.", lineNumber, header.length, fields.length));197 Main.warn(Arrays.toString(fields));197 Logging.warn(tr("Invalid file. Bad length on line {0}. Expected {1} columns, got {2}.", lineNumber, header.length, fields.length)); 198 Logging.warn(Arrays.toString(fields)); 198 199 } 199 200 … … 235 236 } 236 237 } catch (ParseException e) { 237 Main.warn("Parsing error on line "+lineNumber+": "+e.getMessage());238 Logging.warn("Parsing error on line "+lineNumber+": "+e.getMessage()); 238 239 } 239 240 } … … 245 246 n.setCoor(c.proj != null && !handlerOK ? c.proj.eastNorth2latlon(en) : handler != null ? handler.getCoor(en, fields) : null); 246 247 } else { 247 Main.warn("Skipping line "+lineNumber+" because no valid coordinates have been found at columns "+c);248 Logging.warn("Skipping line "+lineNumber+" because no valid coordinates have been found at columns "+c); 248 249 } 249 250 if (n.getCoor() != null) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/XlsReader.java
r30795 r33518 14 14 import org.apache.poi.ss.usermodel.Sheet; 15 15 import org.apache.poi.ss.usermodel.Workbook; 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.osm.DataSet; 18 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 18 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 19 import org.openstreetmap.josm.tools.Logging; 20 20 21 21 public class XlsReader extends SpreadSheetReader { … … 24 24 private Sheet sheet; 25 25 private int rowIndex; 26 26 27 27 public XlsReader(SpreadSheetHandler handler) { 28 28 super(handler); … … 36 36 @Override 37 37 protected void initResources(InputStream in, ProgressMonitor progressMonitor) throws IOException { 38 Main.info("Parsing XLS file");38 Logging.info("Parsing XLS file"); 39 39 try { 40 40 wb = new HSSFWorkbook(new POIFSFileSystem(in)); … … 44 44 Throwable ex = e.getException(); 45 45 if (ex != null && ex.getMessage() != null) { 46 Main.error(ex.getClass()+": "+ex.getMessage());46 Logging.error(ex.getClass()+": "+ex.getMessage()); 47 47 } 48 48 throw new IOException(e); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdDataLayer.java
r32811 r33518 11 11 import javax.swing.Action; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.Bounds; 15 14 import org.openstreetmap.josm.data.coor.LatLon; 16 15 import org.openstreetmap.josm.data.osm.DataSet; 17 16 import org.openstreetmap.josm.data.osm.Node; 17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.gui.layer.LayerManager.LayerAddEvent; 19 19 import org.openstreetmap.josm.gui.layer.LayerManager.LayerChangeListener; … … 55 55 } 56 56 } 57 Main .getLayerManager().addLayerChangeListener(this);57 MainApplication.getLayerManager().addLayerChangeListener(this); 58 58 } 59 59 … … 65 65 removeOsmLayer(); 66 66 osmLayer = layer; 67 Main .getLayerManager().addLayer(osmLayer);67 MainApplication.getLayerManager().addLayer(osmLayer); 68 68 } 69 69 70 70 public void removeOsmLayer() { 71 71 if (osmLayer != null) { 72 Main .getLayerManager().removeLayer(osmLayer);72 MainApplication.getLayerManager().removeLayer(osmLayer); 73 73 osmLayer = null; 74 74 } … … 78 78 removeDiffLayer(); 79 79 diffLayer = layer; 80 Main .getLayerManager().addLayer(diffLayer);80 MainApplication.getLayerManager().addLayer(diffLayer); 81 81 } 82 82 83 83 public void removeDiffLayer() { 84 84 if (diffLayer != null) { 85 Main .getLayerManager().removeLayer(diffLayer);85 MainApplication.getLayerManager().removeLayer(diffLayer); 86 86 diffLayer = null; 87 87 } … … 96 96 final OdOsmDataLayer layer = new OdOsmDataLayer(this, dataSet, getName()+"/OSM"); 97 97 addOsmLayer(layer); 98 Main .getLayerManager().setActiveLayer(osmLayer);98 MainApplication.getLayerManager().setActiveLayer(osmLayer); 99 99 if (oapiReq != null) { 100 100 OsmDownloader.downloadOapi(oapiReq); … … 110 110 @Override 111 111 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 112 if (Main .getLayerManager().getActiveLayer() == this && this.handler != null) {112 if (MainApplication.getLayerManager().getActiveLayer() == this && this.handler != null) { 113 113 this.handler.notifyActive(); 114 114 } … … 184 184 final OdDiffLayer layer = new OdDiffLayer(this, getName()+"/Diff"); 185 185 addDiffLayer(layer); 186 Main .getLayerManager().setActiveLayer(diffLayer);186 MainApplication.getLayerManager().setActiveLayer(diffLayer); 187 187 } 188 188 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdOsmDataLayer.java
r30795 r33518 7 7 import java.util.List; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.data.osm.DataSet; 11 10 import org.openstreetmap.josm.data.osm.Node; 12 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 12 import org.openstreetmap.josm.data.osm.Way; 13 import org.openstreetmap.josm.gui.MainApplication; 14 14 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 15 15 … … 22 22 this.dataLayer = dataLayer; 23 23 } 24 24 25 25 public final void removeForbiddenTags() { 26 26 if (dataLayer != null && dataLayer.handler != null && dataLayer.handler.hasForbiddenTags()) { 27 Main.worker.submit(new Runnable() { 28 @Override 29 public void run() { 30 data.clearSelection(); 31 for (Iterator<OsmPrimitive> it = data.allPrimitives().iterator(); it.hasNext();) { 32 OsmPrimitive p = it.next(); 33 if (dataLayer.handler.isForbidden(p)) { 34 data.addSelected(p); 35 36 List<Node> nodes = null; 37 if (p instanceof Way) { 38 nodes = ((Way) p).getNodes(); 39 } 40 if (nodes != null) { 41 for (Node n : nodes) { 42 List<OsmPrimitive> refferingAllowedWays = new ArrayList<>(); 43 for (OsmPrimitive referrer : n.getReferrers()) { 44 if (referrer instanceof Way && !dataLayer.handler.isForbidden(referrer)) { 45 refferingAllowedWays.add(referrer); 46 } 27 MainApplication.worker.submit(() -> { 28 data.clearSelection(); 29 for (Iterator<OsmPrimitive> it = data.allPrimitives().iterator(); it.hasNext();) { 30 OsmPrimitive p = it.next(); 31 if (dataLayer.handler.isForbidden(p)) { 32 data.addSelected(p); 33 34 List<Node> nodes = null; 35 if (p instanceof Way) { 36 nodes = ((Way) p).getNodes(); 37 } 38 if (nodes != null) { 39 for (Node n : nodes) { 40 List<OsmPrimitive> refferingAllowedWays = new ArrayList<>(); 41 for (OsmPrimitive referrer : n.getReferrers()) { 42 if (referrer instanceof Way && !dataLayer.handler.isForbidden(referrer)) { 43 refferingAllowedWays.add(referrer); 47 44 } 48 49 if (refferingAllowedWays.isEmpty()) { 50 data.addSelected(n);51 }45 } 46 47 if (refferingAllowedWays.isEmpty()) { 48 data.addSelected(n); 52 49 } 53 50 } 54 51 } 55 52 } 56 Collection<OsmPrimitive> sel = data.getSelected();57 if (!sel.isEmpty()) {58 Main.main.menu.purge.actionPerformed(null);59 }53 } 54 Collection<OsmPrimitive> sel = data.getSelected(); 55 if (!sel.isEmpty()) { 56 MainApplication.getMenu().purge.actionPerformed(null); 60 57 } 61 58 }); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/AbstractModule.java
r32904 r33518 10 10 import java.util.List; 11 11 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry; 14 import org.openstreetmap.josm.gui.preferences.SourceEntry; 15 import org.openstreetmap.josm.gui.preferences.SourceProvider; 12 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 13 import org.openstreetmap.josm.data.preferences.sources.SourceEntry; 14 import org.openstreetmap.josm.data.preferences.sources.SourceProvider; 16 15 import org.openstreetmap.josm.plugins.opendata.OdPlugin; 17 16 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 18 17 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 18 import org.openstreetmap.josm.tools.Logging; 19 19 20 20 public abstract class AbstractModule implements Module { … … 62 62 FileOutputStream out = new FileOutputStream(path)) { 63 63 String dir = path.substring(0, path.lastIndexOf(File.separatorChar)); 64 if (new File(dir).mkdirs() && Main.isDebugEnabled()) {65 Main.debug("Created directory: "+dir);64 if (new File(dir).mkdirs() && Logging.isDebugEnabled()) { 65 Logging.debug("Created directory: "+dir); 66 66 } 67 67 while ((n = in.read(buffer)) > 0) { … … 72 72 sources.add(src); 73 73 } catch (IOException e) { 74 Main.error(e.getMessage());74 Logging.error(e.getMessage()); 75 75 } 76 76 } … … 108 108 result.add(handlerClass.getConstructor().newInstance()); 109 109 } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException t) { 110 Main.error(t, "Cannot instantiate "+handlerClass+" because of "+t.getClass().getName());110 Logging.log(Logging.LEVEL_ERROR, "Cannot instantiate "+handlerClass+" because of "+t.getClass().getName(), t); 111 111 } 112 112 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/Module.java
r32545 r33518 4 4 import java.util.List; 5 5 6 import org.openstreetmap.josm. gui.preferences.SourceProvider;6 import org.openstreetmap.josm.data.preferences.sources.SourceProvider; 7 7 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 8 8 -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleDownloadTask.java
r32545 r33518 16 16 import java.util.LinkedList; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.Version; 20 19 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 23 22 import org.openstreetmap.josm.plugins.opendata.OdPlugin; 24 23 import org.openstreetmap.josm.tools.CheckParameterUtil; 24 import org.openstreetmap.josm.tools.Logging; 25 25 import org.xml.sax.SAXException; 26 26 … … 95 95 if (pi.downloadlink == null) { 96 96 String msg = tr("Warning: Cannot download module ''{0}''. Its download link is not known. Skipping download.", pi.name); 97 Main.warn(msg);97 Logging.warn(msg); 98 98 throw new ModuleDownloadException(msg); 99 99 } … … 118 118 String msg = tr("Warning: Cannot download module ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.", 119 119 pi.name, pi.downloadlink); 120 Main.warn(msg);120 Logging.warn(msg); 121 121 throw new ModuleDownloadException(msg); 122 122 } catch (IOException e) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java
r32545 r33518 35 35 36 36 import org.openstreetmap.josm.Main; 37 import org.openstreetmap.josm.data.preferences.sources.SourceProvider; 37 38 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 38 39 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 39 40 import org.openstreetmap.josm.gui.help.HelpUtil; 40 import org.openstreetmap.josm.gui.preferences.SourceProvider;41 41 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference; 42 42 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; … … 50 50 import org.openstreetmap.josm.tools.I18n; 51 51 import org.openstreetmap.josm.tools.ImageProvider; 52 import org.openstreetmap.josm.tools.Logging; 52 53 53 54 /** … … 138 139 if (policy.equals("never")) { 139 140 if ("opendata.modulemanager.time-based-update.policy".equals(togglePreferenceKey)) { 140 Main.info(tr("Skipping module update after elapsed update interval. Automatic update at startup is disabled."));141 Logging.info(tr("Skipping module update after elapsed update interval. Automatic update at startup is disabled.")); 141 142 } 142 143 return false; … … 145 146 if (policy.equals("always")) { 146 147 if ("opendata.modulemanager.time-based-update.policy".equals(togglePreferenceKey)) { 147 Main.info(tr("Running module update after elapsed update interval. Automatic update at startup is disabled."));148 Logging.info(tr("Running module update after elapsed update interval. Automatic update at startup is disabled.")); 148 149 } 149 150 return true; … … 151 152 152 153 if (!policy.equals("ask")) { 153 Main.warn(tr("Unexpected value ''{0}'' for preference ''{1}''. Assuming value ''ask''.", policy, togglePreferenceKey));154 Logging.warn(tr("Unexpected value ''{0}'' for preference ''{1}''. Assuming value ''ask''.", policy, togglePreferenceKey)); 154 155 } 155 156 int ret = HelpAwareOptionPane.showOptionDialog( … … 231 232 Class<? extends Module> klass = module.loadClass(moduleClassLoader); 232 233 if (klass != null) { 233 Main.info(tr("loading module ''{0}'' (version {1})", module.name, module.localversion));234 Logging.info(tr("loading module ''{0}'' (version {1})", module.name, module.localversion)); 234 235 Module mod = module.load(klass); 235 236 if (moduleList.add(mod)) { … … 252 253 } 253 254 } catch (Exception e) { 254 Main.error(e);255 Logging.error(e); 255 256 } 256 257 if (msg != null && confirmDisableModule(parent, msg, module.name)) { … … 314 315 future.get(); 315 316 } catch (ExecutionException | InterruptedException e) { 316 Main.error(e);317 Logging.error(e); 317 318 return null; 318 319 } … … 438 439 modules = buildListOfModulesToLoad(parent); 439 440 } catch (ExecutionException e) { 440 Main.warn(tr("Warning: failed to download module information list"));441 Logging.warn(tr("Warning: failed to download module information list")); 441 442 e.printStackTrace(); 442 443 // don't abort in case of error, continue with downloading modules below 443 444 } catch (InterruptedException e) { 444 Main.warn(tr("Warning: failed to download module information list"));445 Logging.warn(tr("Warning: failed to download module information list")); 445 446 e.printStackTrace(); 446 447 // don't abort in case of error, continue with downloading modules below … … 563 564 if (module.exists()) { 564 565 if (!module.delete() && dowarn) { 565 Main.warn(tr("Warning: failed to delete outdated module ''{0}''.", module.toString()));566 Main.warn(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName));566 Logging.warn(tr("Warning: failed to delete outdated module ''{0}''.", module.toString())); 567 Logging.warn(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName)); 567 568 continue; 568 569 } 569 570 } 570 571 if (!updatedModule.renameTo(module) && dowarn) { 571 Main.warn(tr("Warning: failed to install module ''{0}'' from temporary download file ''{1}''. Renaming failed.", module.toString(), updatedModule.toString()));572 Main.warn(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName));572 Logging.warn(tr("Warning: failed to install module ''{0}'' from temporary download file ''{1}''. Renaming failed.", module.toString(), updatedModule.toString())); 573 Logging.warn(tr("Warning: failed to install already downloaded module ''{0}''. Skipping installation. JOSM is still going to load the old module version.", moduleName)); 573 574 } 574 575 // CHECKSTYLE.ON: LineLength -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleInformation.java
r32545 r33518 31 31 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 32 32 import org.openstreetmap.josm.tools.LanguageInfo; 33 import org.openstreetmap.josm.tools.Logging; 33 34 34 35 /** … … 151 152 URL url = new URL(s); 152 153 } catch (MalformedURLException e) { 153 Main.error(tr("Invalid URL ''{0}'' in module {1}", s, name));154 Logging.error(tr("Invalid URL ''{0}'' in module {1}", s, name)); 154 155 s = null; 155 156 } … … 175 176 } 176 177 if (icon == null) { 177 Main.error("Unable to load module icon: "+iconPath);178 Logging.error("Unable to load module icon: "+iconPath); 178 179 } 179 180 } … … 252 253 return f.toURI().toURL(); 253 254 } catch (MalformedURLException ex) { 254 Main.warn(ex.getMessage());255 Logging.warn(ex.getMessage()); 255 256 return null; 256 257 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ReadLocalModuleInformationTask.java
r32545 r33518 14 14 import java.util.Map; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 18 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 18 import org.openstreetmap.josm.io.OsmTransferException; 20 19 import org.openstreetmap.josm.tools.ImageProvider; 20 import org.openstreetmap.josm.tools.Logging; 21 21 import org.xml.sax.SAXException; 22 22 … … 94 94 processLocalModuleInformationFile(f); 95 95 } catch (ModuleListParseException e) { 96 Main.warn(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname));96 Logging.warn(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname)); 97 97 e.printStackTrace(); 98 98 } … … 155 155 } 156 156 } catch (ModuleException e) { 157 Main.warn(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname));157 Logging.warn(tr("Warning: Failed to scan file ''{0}'' for module information. Skipping.", fname)); 158 158 e.printStackTrace(); 159 159 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ReadRemoteModuleInformationTask.java
r32545 r33518 25 25 import java.util.List; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.Version; 29 28 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 33 32 import org.openstreetmap.josm.plugins.opendata.OdPlugin; 34 33 import org.openstreetmap.josm.tools.ImageProvider; 34 import org.openstreetmap.josm.tools.Logging; 35 35 import org.xml.sax.SAXException; 36 36 … … 251 251 if (!moduleDir.exists()) { 252 252 if (!moduleDir.mkdirs()) { 253 Main.warn(tr("Warning: failed to create module directory ''{0}''. Cannot cache module list from module site ''{1}''.",253 Logging.warn(tr("Warning: failed to create module directory ''{0}''. Cannot cache module list from module site ''{1}''.", 254 254 moduleDir.toString(), site)); 255 255 } … … 262 262 } catch (IOException e) { 263 263 // just failed to write the cache file. No big deal, but log the exception anyway 264 Main.warn(e);264 Logging.warn(e); 265 265 } 266 266 } … … 278 278 availableModules.addAll(new ModuleListParser().parse(in)); 279 279 } catch (UnsupportedEncodingException e) { 280 Main.error(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString()));280 Logging.error(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString())); 281 281 e.printStackTrace(); 282 282 } catch (ModuleListParseException e) { 283 Main.error(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString()));283 Logging.error(tr("Failed to parse module list document from site ''{0}''. Skipping site. Exception was: {1}", site, e.toString())); 284 284 e.printStackTrace(); 285 285 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/NamesFrUtils.java
r32545 r33518 10 10 import java.util.Map; 11 11 12 import org.apache.commons.lang3.text.WordUtils; 13 import org.openstreetmap.josm.Main; 12 import org.apache.commons.text.WordUtils; 14 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 14 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 16 15 import org.openstreetmap.josm.plugins.opendata.core.datasets.SimpleDataSetHandler; 16 import org.openstreetmap.josm.tools.Logging; 17 17 18 18 public abstract class NamesFrUtils { … … 41 41 } 42 42 } catch (IOException e) { 43 Main.error(e);43 Logging.error(e); 44 44 } 45 45 return result; … … 159 159 return label; 160 160 } else { 161 Main.warn("unknown street label: "+label);161 Logging.warn("unknown street label: "+label); 162 162 return label; 163 163 } -
applications/editors/josm/plugins/opendata/test/unit/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReaderTest.java
r33156 r33518 10 10 import org.junit.Rule; 11 11 import org.junit.Test; 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.osm.DataSet; 14 13 import org.openstreetmap.josm.plugins.opendata.core.io.NonRegFunctionalTests; 15 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 import org.openstreetmap.josm.tools.Logging; 16 16 17 17 /** … … 34 34 for (Path p : NonRegFunctionalTests.listDataFiles("zip")) { 35 35 File zipfile = p.toFile(); 36 Main.info("Testing reading file "+zipfile.getPath());36 Logging.info("Testing reading file "+zipfile.getPath()); 37 37 try (InputStream is = new FileInputStream(zipfile)) { 38 38 for (Entry<File, DataSet> entry : ZipReader.parseDataSets(is, null, null, false).entrySet()) { 39 39 String name = entry.getKey().getName(); 40 Main.info("Checking dataset for entry "+name);40 Logging.info("Checking dataset for entry "+name); 41 41 NonRegFunctionalTests.testGeneric(zipfile.getName()+"/"+name, entry.getValue()); 42 42 }
Note:
See TracChangeset
for help on using the changeset viewer.