Changeset 33790 in osm for applications/editors/josm/plugins/opendata
- Timestamp:
- 2017-11-06T00:57:42+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/build.xml
r33617 r33790 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 2870"/>3 <property name="plugin.main.version" value="13007"/> 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
r33617 r33790 197 197 198 198 private File getSubDirectory(String name) { 199 File dir = new File(getPluginDir ()+File.separator+name);199 File dir = new File(getPluginDirs().getUserDataDirectory(false), name); 200 200 if (!dir.exists()) { 201 201 dir.mkdirs(); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreference.java
r33518 r33790 225 225 LinkedList<String> l = new LinkedList<>(model.getSelectedModuleNames()); 226 226 Collections.sort(l); 227 Main.pref.put Collection(OdConstants.PREF_MODULES, l);227 Main.pref.putList(OdConstants.PREF_MODULES, l); 228 228 return true; 229 229 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/ModulePreferencesModel.java
r32904 r33790 28 28 private final Set<String> currentActiveModules; 29 29 30 protected Collection<String> getModules(Collection<String> def) {31 return Main.pref.get Collection(OdConstants.PREF_MODULES, def);30 protected List<String> getModules(List<String> def) { 31 return Main.pref.getList(OdConstants.PREF_MODULES, def); 32 32 } 33 33 34 34 public ModulePreferencesModel() { 35 currentActiveModules = new HashSet<>(); 36 currentActiveModules.addAll(getModules(currentActiveModules)); 35 currentActiveModules = new HashSet<>(getModules(Collections.emptyList())); 37 36 } 38 37 … … 61 60 sort(); 62 61 filterDisplayedModules(filterExpression); 63 Set<String> activeModules = new HashSet<>(); 64 activeModules.addAll(getModules(activeModules)); 62 Set<String> activeModules = new HashSet<>(getModules(Collections.emptyList())); 65 63 for (ModuleInformation pi: availableModules) { 66 64 if (selectedModulesMap.get(pi) == null) { … … 95 93 sort(); 96 94 filterDisplayedModules(filterExpression); 97 Set<String> activeModules = new HashSet<>(); 98 activeModules.addAll(getModules(activeModules)); 95 Set<String> activeModules = new HashSet<>(getModules(Collections.emptyList())); 99 96 for (ModuleInformation pi: availableModules) { 100 97 if (selectedModulesMap.get(pi) == null) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/gui/OdPreferenceSetting.java
r33518 r33790 59 59 */ 60 60 public static final Collection<String> getModuleSites() { 61 return Main.pref.get Collection(OdConstants.PREF_MODULES_SITES, Arrays.asList(OdConstants.DEFAULT_MODULE_SITES));61 return Main.pref.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.put Collection(OdConstants.PREF_MODULES_SITES, sites);70 Main.pref.putList(OdConstants.PREF_MODULES_SITES, sites); 71 71 } 72 72 … … 137 137 Main.pref.put(OdConstants.PREF_OAPI, oapi.getText()); 138 138 Main.pref.put(OdConstants.PREF_XAPI, xapi.getText()); 139 Main.pref.put (OdConstants.PREF_RAWDATA, rawData.isSelected());139 Main.pref.putBoolean(OdConstants.PREF_RAWDATA, rawData.isSelected()); 140 140 141 141 // create a task for downloading modules if the user has activated, yet not downloaded, -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/modules/ModuleHandler.java
r33617 r33790 35 35 36 36 import org.openstreetmap.josm.Main; 37 import org.openstreetmap.josm.data.PreferencesUtils; 37 38 import org.openstreetmap.josm.data.preferences.sources.SourceProvider; 38 39 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 101 102 long tim = System.currentTimeMillis(); 102 103 long last = Main.pref.getLong("opendata.modulemanager.lastupdate", 0); 103 Integer maxTime = Main.pref.getInt eger("opendata.modulemanager.time-based-update.interval", 60);104 Integer maxTime = Main.pref.getInt("opendata.modulemanager.time-based-update.interval", 60); 104 105 long d = (tim - last) / (24 * 60 * 60 * 1000L); 105 106 if ((last <= 0) || (maxTime <= 0)) { … … 256 257 } 257 258 if (msg != null && confirmDisableModule(parent, msg, module.name)) { 258 Main.pref.removeFromCollection(OdConstants.PREF_MODULES, module.name);259 PreferencesUtils.removeFromList(Main.pref, OdConstants.PREF_MODULES, module.name); 259 260 } 260 261 } … … 362 363 public static List<ModuleInformation> buildListOfModulesToLoad(Component parent) { 363 364 Set<String> modules = new HashSet<>(); 364 modules.addAll(Main.pref.get Collection(OdConstants.PREF_MODULES, new LinkedList<String>()));365 modules.addAll(Main.pref.getList(OdConstants.PREF_MODULES, new LinkedList<String>())); 365 366 if (System.getProperty("josm."+OdConstants.PREF_MODULES) != null) { 366 367 modules.addAll(Arrays.asList(System.getProperty("josm."+OdConstants.PREF_MODULES).split(",")));
Note:
See TracChangeset
for help on using the changeset viewer.