Changeset 9870 in josm for trunk/src/org
- Timestamp:
- 2016-02-24T02:08:53+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r9616 r9870 130 130 new DeprecatedPlugin("missingRoads", tr("replaced by new {0} plugin", "ImproveOsm")), 131 131 new DeprecatedPlugin("trafficFlowDirection", tr("replaced by new {0} plugin", "ImproveOsm")), 132 new DeprecatedPlugin("kendzi3d-jogl", tr("replaced by new {0} plugin", "jogl")), 132 133 }); 133 134 } … … 145 146 /** Short explanation about deprecation, can be {@code null} */ 146 147 public final String reason; 147 /** Code to run to perform migration, can be {@code null} */148 private final Runnable migration;149 150 /**151 * Constructs a new {@code DeprecatedPlugin}.152 * @param name The plugin name153 */154 public DeprecatedPlugin(String name) {155 this(name, null, null);156 }157 148 158 149 /** … … 162 153 */ 163 154 public DeprecatedPlugin(String name, String reason) { 164 this(name, reason, null);165 }166 167 /**168 * Constructs a new {@code DeprecatedPlugin}.169 * @param name The plugin name170 * @param reason The reason about deprecation171 * @param migration The code to run to perform migration172 */173 public DeprecatedPlugin(String name, String reason, Runnable migration) {174 155 this.name = name; 175 156 this.reason = reason; 176 this.migration = migration; 177 } 178 179 /** 180 * Performs migration. 181 */ 182 public void migrate() { 183 if (migration != null) { 184 migration.run(); 185 } 157 } 158 159 @Override 160 public int hashCode() { 161 final int prime = 31; 162 int result = prime + ((name == null) ? 0 : name.hashCode()); 163 return prime * result + ((reason == null) ? 0 : reason.hashCode()); 164 } 165 166 @Override 167 public boolean equals(Object obj) { 168 if (this == obj) 169 return true; 170 if (obj == null) 171 return false; 172 if (getClass() != obj.getClass()) 173 return false; 174 DeprecatedPlugin other = (DeprecatedPlugin) obj; 175 if (name == null) { 176 if (other.name != null) 177 return false; 178 } else if (!name.equals(other.name)) 179 return false; 180 if (reason == null) { 181 if (other.reason != null) 182 return false; 183 } else if (!reason.equals(other.reason)) 184 return false; 185 return true; 186 186 } 187 187 188 188 @Override 189 189 public int compareTo(DeprecatedPlugin o) { 190 return name.compareTo(o.name); 190 int d = name.compareTo(o.name); 191 if (d == 0) 192 d = reason.compareTo(o.reason); 193 return d; 191 194 } 192 195 } … … 217 220 * List of unmaintained plugins. Not really up-to-date as the vast majority of plugins are not maintained after a few months, sadly... 218 221 */ 219 privatestatic final String[] UNMAINTAINED_PLUGINS = new String[] {222 static final String[] UNMAINTAINED_PLUGINS = new String[] { 220 223 "gpsbabelgui", 221 224 "Intersect_way", … … 282 285 Main.pref.removeFromCollection("plugins", depr.name); 283 286 removedPlugins.add(depr); 284 depr.migrate();285 287 } 286 288 } … … 661 663 if (pluginClassLoader == null) { 662 664 pluginClassLoader = AccessController.doPrivileged(new PrivilegedAction<DynamicURLClassLoader>() { 665 @Override 663 666 public DynamicURLClassLoader run() { 664 667 return new DynamicURLClassLoader(new URL[0], Main.class.getClassLoader()); … … 853 856 plugins.size())) 854 857 .append("</html>"); 855 HelpAwareOptionPane.showOptionDialog( 856 parent, 857 sb.toString(), 858 tr("Warning"), 859 JOptionPane.WARNING_MESSAGE, 860 HelpUtil.ht("/Plugin/Loading#MissingPluginInfos") 861 ); 858 if (!GraphicsEnvironment.isHeadless()) { 859 HelpAwareOptionPane.showOptionDialog( 860 parent, 861 sb.toString(), 862 tr("Warning"), 863 JOptionPane.WARNING_MESSAGE, 864 HelpUtil.ht("/Plugin/Loading#MissingPluginInfos") 865 ); 866 } 862 867 } 863 868 … … 878 883 monitor.beginTask(tr("Determine plugins to load...")); 879 884 Set<String> plugins = new HashSet<>(); 880 plugins.addAll(Main.pref.getCollection("plugins", 885 plugins.addAll(Main.pref.getCollection("plugins", new LinkedList<String>())); 881 886 if (System.getProperty("josm.plugins") != null) { 882 887 plugins.addAll(Arrays.asList(System.getProperty("josm.plugins").split(",")));
Note:
See TracChangeset
for help on using the changeset viewer.