- Timestamp:
- 2010-12-16T18:20:22+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/preferences/BooleanProperty.java
r3720 r3730 4 4 import org.openstreetmap.josm.Main; 5 5 6 public class BooleanProperty {6 public class BooleanProperty extends AbstractProperty { 7 7 8 private final String key; 9 private final boolean defaultValue; 8 protected final boolean defaultValue; 10 9 11 10 public BooleanProperty(String key, boolean defaultValue) { 12 this.key = key;11 super(key); 13 12 this.defaultValue = defaultValue; 14 13 } … … 22 21 } 23 22 24 public String getKey() {25 return key;26 }27 28 23 public boolean isDefaultValue() { 29 24 return defaultValue; 30 25 } 31 32 26 } -
trunk/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java
r3720 r3730 6 6 import org.openstreetmap.josm.Main; 7 7 8 public class CollectionProperty { 9 private final String key; 10 private final Collection<String> defaultValue; 8 public class CollectionProperty extends AbstractProperty { 9 protected final Collection<String> defaultValue; 11 10 12 11 public CollectionProperty(String key, Collection<String> defaultValue) { 13 this.key = key;12 super(key); 14 13 this.defaultValue = defaultValue; 15 14 } … … 23 22 } 24 23 25 public String getKey() {26 return key;27 }28 29 24 public Collection<String> getDefaultValue() { 30 25 return defaultValue; -
trunk/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java
r3720 r3730 4 4 import org.openstreetmap.josm.Main; 5 5 6 public class IntegerProperty {6 public class IntegerProperty extends AbstractProperty { 7 7 8 private final String key; 9 private final int defaultValue; 8 protected final int defaultValue; 10 9 11 10 public IntegerProperty(String key, int defaultValue) { 12 this.key = key;11 super(key); 13 12 this.defaultValue = defaultValue; 14 13 } … … 38 37 } 39 38 40 public String getKey() {41 return key;42 }43 44 39 public int getDefaultValue() { 45 40 return defaultValue; -
trunk/src/org/openstreetmap/josm/data/preferences/StringProperty.java
r3720 r3730 4 4 import org.openstreetmap.josm.Main; 5 5 6 public class StringProperty {6 public class StringProperty extends AbstractProperty { 7 7 8 private final String key; 9 private final String defaultValue; 8 protected final String defaultValue; 10 9 11 10 public StringProperty(String key, String defaultValue) { 12 this.key = key;11 super(key); 13 12 this.defaultValue = defaultValue; 14 13 } … … 22 21 } 23 22 24 public String getKey() {25 return key;26 }27 28 23 public String getDefaultValue() { 29 24 return defaultValue; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r3723 r3730 29 29 import java.util.Set; 30 30 import java.util.Map.Entry; 31 import java.util.TreeMap;32 31 import java.util.TreeSet; 33 32 import java.util.concurrent.ExecutionException; … … 59 58 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 60 59 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 60 import org.openstreetmap.josm.io.remotecontrol.RemoteControl; 61 61 import org.openstreetmap.josm.tools.CheckParameterUtil; 62 62 import org.openstreetmap.josm.tools.GBC; … … 70 70 public class PluginHandler { 71 71 72 /* deprecated plugins that are removed on start 73 key - plugin name; value - explanation for deprecation (optional, can be null) */ 74 public final static Map<String, String> DEPRECATED_PLUGINS = new TreeMap<String, String>(); 72 /* deprecated plugins that are removed on start */ 73 public final static Collection<DeprecatedPlugin> DEPRECATED_PLUGINS; 75 74 static { 76 75 String IN_CORE = tr("integrated into main program"); 77 for (String[] depr : new String[][] { 78 {"mappaint", IN_CORE}, {"unglueplugin", IN_CORE}, 79 {"lang-de", IN_CORE}, {"lang-en_GB", IN_CORE}, {"lang-fr", IN_CORE}, 80 {"lang-it", IN_CORE}, {"lang-pl", IN_CORE}, {"lang-ro", IN_CORE}, 81 {"lang-ru", IN_CORE}, {"ewmsplugin", IN_CORE}, {"ywms", IN_CORE}, 82 {"tways-0.2", IN_CORE}, 83 {"geotagged", IN_CORE}, 84 {"landsat", tr("replaced by {0} plugin","lakewalker")}, 85 {"namefinder", IN_CORE}, 86 {"waypoints", IN_CORE}, {"slippy_map_chooser", IN_CORE}, 87 {"tcx-support", tr("replaced by {0} plugin","dataimport")}, 88 {"usertools", IN_CORE}, 89 {"AgPifoJ", IN_CORE}, {"utilsplugin", IN_CORE}, {"ghost", IN_CORE}, 90 {"validator", IN_CORE}, {"multipoly", IN_CORE}, 91 {"remotecontrol", IN_CORE}, 92 {"imagery", IN_CORE}, {"slippymap", IN_CORE}, {"wmsplugin", IN_CORE}}) { 93 DEPRECATED_PLUGINS.put(depr[0], depr.length >= 2 ? depr[1] : null); 76 77 class RemotecontrolMigration implements Runnable { 78 public void run() { 79 System.out.println("Migrating remotecontrol plugin..."); 80 if (!RemoteControl.PROP_REMOTECONTROL_ENABLED.isSet()) { 81 System.out.println(" Setting "+RemoteControl.PROP_REMOTECONTROL_ENABLED.getKey()+"=true"); 82 RemoteControl.PROP_REMOTECONTROL_ENABLED.put(true); 83 } 84 System.out.println("...Done."); 85 } 86 } 87 88 DEPRECATED_PLUGINS = Arrays.asList(new DeprecatedPlugin[] { 89 new DeprecatedPlugin("mappaint", IN_CORE), 90 new DeprecatedPlugin("unglueplugin", IN_CORE), 91 new DeprecatedPlugin("lang-de", IN_CORE), 92 new DeprecatedPlugin("lang-en_GB", IN_CORE), 93 new DeprecatedPlugin("lang-fr", IN_CORE), 94 new DeprecatedPlugin("lang-it", IN_CORE), 95 new DeprecatedPlugin("lang-pl", IN_CORE), 96 new DeprecatedPlugin("lang-ro", IN_CORE), 97 new DeprecatedPlugin("lang-ru", IN_CORE), 98 new DeprecatedPlugin("ewmsplugin", IN_CORE), 99 new DeprecatedPlugin("ywms", IN_CORE), 100 new DeprecatedPlugin("tways-0.2", IN_CORE), 101 new DeprecatedPlugin("geotagged", IN_CORE), 102 new DeprecatedPlugin("landsat", tr("replaced by new {0} plugin","lakewalker")), 103 new DeprecatedPlugin("namefinder", IN_CORE), 104 new DeprecatedPlugin("waypoints", IN_CORE), 105 new DeprecatedPlugin("slippy_map_chooser", IN_CORE), 106 new DeprecatedPlugin("tcx-support", tr("replaced by new {0} plugin","dataimport")), 107 new DeprecatedPlugin("usertools", IN_CORE), 108 new DeprecatedPlugin("AgPifoJ", IN_CORE), 109 new DeprecatedPlugin("utilsplugin", IN_CORE), 110 new DeprecatedPlugin("ghost", IN_CORE), 111 new DeprecatedPlugin("validator", IN_CORE), 112 new DeprecatedPlugin("multipoly", IN_CORE), 113 new DeprecatedPlugin("remotecontrol", IN_CORE, new RemotecontrolMigration()), 114 new DeprecatedPlugin("imagery", IN_CORE), 115 new DeprecatedPlugin("slippymap", IN_CORE), 116 new DeprecatedPlugin("wmsplugin", IN_CORE), 117 }); 118 } 119 120 public static class DeprecatedPlugin implements Comparable<DeprecatedPlugin> { 121 public String name; 122 // short explanation, can be null 123 public String reason; 124 // migration, can be null 125 private Runnable migration; 126 127 public DeprecatedPlugin(String name) { 128 this.name = name; 129 } 130 131 public DeprecatedPlugin(String name, String reason) { 132 this.name = name; 133 this.reason = reason; 134 } 135 136 public DeprecatedPlugin(String name, String reason, Runnable migration) { 137 this.name = name; 138 this.reason = reason; 139 this.migration = migration; 140 } 141 142 public void migrate() { 143 if (migration != null) { 144 migration.run(); 145 } 146 } 147 148 public int compareTo(DeprecatedPlugin o) { 149 return name.compareTo(o.name); 94 150 } 95 151 } … … 111 167 */ 112 168 private static void filterDeprecatedPlugins(Window parent, Collection<String> plugins) { 113 Set<String> removedPlugins = new TreeSet<String>(); 114 for (String p : DEPRECATED_PLUGINS.keySet()) { 115 if (plugins.contains(p)) { 116 plugins.remove(p); 117 Main.pref.removeFromCollection("plugins", p); 118 removedPlugins.add(p); 169 Set<DeprecatedPlugin> removedPlugins = new TreeSet<DeprecatedPlugin>(); 170 for (DeprecatedPlugin depr : DEPRECATED_PLUGINS) { 171 if (plugins.contains(depr.name)) { 172 plugins.remove(depr.name); 173 Main.pref.removeFromCollection("plugins", depr.name); 174 removedPlugins.add(depr); 175 depr.migrate(); 119 176 } 120 177 } … … 132 189 )); 133 190 sb.append("<ul>"); 134 for (String name: removedPlugins) { 135 sb.append("<li>").append(name); 136 String explanation = DEPRECATED_PLUGINS.get(name); 137 if (explanation != null) { 138 sb.append(" ("+explanation+")"); 191 for (DeprecatedPlugin depr: removedPlugins) { 192 sb.append("<li>").append(depr.name); 193 if (depr.reason != null) { 194 sb.append(" (").append(depr.reason).append(")"); 139 195 } 140 196 sb.append("</li>"); -
trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java
r3669 r3730 201 201 202 202 protected void filterOldPlugins() { 203 for ( String p : PluginHandler.DEPRECATED_PLUGINS.keySet()) {203 for (PluginHandler.DeprecatedPlugin p : PluginHandler.DEPRECATED_PLUGINS) { 204 204 if (canceled)return; 205 if (availablePlugins.containsKey(p )) {206 availablePlugins.remove(p );205 if (availablePlugins.containsKey(p.name)) { 206 availablePlugins.remove(p.name); 207 207 } 208 208 } -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r3669 r3730 295 295 protected List<PluginInformation> filterDeprecatedPlugins(List<PluginInformation> plugins) { 296 296 List<PluginInformation> ret = new ArrayList<PluginInformation>(plugins.size()); 297 HashSet<String> deprecatedPluginNames = new HashSet<String>(PluginHandler.DEPRECATED_PLUGINS.keySet()); 297 HashSet<String> deprecatedPluginNames = new HashSet<String>(); 298 for (PluginHandler.DeprecatedPlugin p : PluginHandler.DEPRECATED_PLUGINS) { 299 deprecatedPluginNames.add(p.name); 300 } 298 301 for (PluginInformation plugin: plugins) { 299 302 if (deprecatedPluginNames.contains(plugin.name)) {
Note:
See TracChangeset
for help on using the changeset viewer.