Changeset 5121 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2012-03-25T22:47:16+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r5029 r5121 6 6 import static org.openstreetmap.josm.tools.I18n.trn; 7 7 8 import java.awt.Component; 8 9 import java.awt.Font; 9 10 import java.awt.GridBagConstraints; 10 11 import java.awt.GridBagLayout; 11 12 import java.awt.Insets; 12 import java.awt.Window;13 13 import java.awt.event.ActionEvent; 14 14 import java.io.File; … … 175 175 * Also notifies the user about removed deprecated plugins 176 176 * 177 * @param parent The parent Component used to display warning popup 177 178 * @param plugins the collection of plugins 178 179 */ 179 private static void filterDeprecatedPlugins( Windowparent, Collection<String> plugins) {180 private static void filterDeprecatedPlugins(Component parent, Collection<String> plugins) { 180 181 Set<DeprecatedPlugin> removedPlugins = new TreeSet<DeprecatedPlugin>(); 181 182 for (DeprecatedPlugin depr : DEPRECATED_PLUGINS) { … … 226 227 * @param plugins the collection of plugins 227 228 */ 228 private static void filterUnmaintainedPlugins( Windowparent, Collection<String> plugins) {229 private static void filterUnmaintainedPlugins(Component parent, Collection<String> plugins) { 229 230 for (String unmaintained : UNMAINTAINED_PLUGINS) { 230 231 if (!plugins.contains(unmaintained)) { … … 247 248 * if the plugins were last updated a long time ago. 248 249 * 249 * @param parent the parent windowrelative to which the confirmation dialog250 * @param parent the parent component relative to which the confirmation dialog 250 251 * is to be displayed 251 252 * @return true if a plugin update should be run; false, otherwise 252 253 */ 253 public static boolean checkAndConfirmPluginUpdate( Windowparent) {254 public static boolean checkAndConfirmPluginUpdate(Component parent) { 254 255 String message = null; 255 256 String togglePreferenceKey = null; … … 355 356 * Alerts the user if a plugin required by another plugin is missing 356 357 * 358 * @param parent The parent Component used to display error popup 357 359 * @param plugin the plugin 358 360 * @param missingRequiredPlugin the missing required plugin 359 361 */ 360 private static void alertMissingRequiredPlugin( Windowparent, String plugin, Set<String> missingRequiredPlugin) {362 private static void alertMissingRequiredPlugin(Component parent, String plugin, Set<String> missingRequiredPlugin) { 361 363 StringBuilder sb = new StringBuilder(); 362 364 sb.append("<html>"); … … 380 382 } 381 383 382 private static void alertJOSMUpdateRequired( Windowparent, String plugin, int requiredVersion) {384 private static void alertJOSMUpdateRequired(Component parent, String plugin, int requiredVersion) { 383 385 HelpAwareOptionPane.showOptionDialog( 384 386 parent, … … 398 400 * depends on should be missing. 399 401 * 402 * @param parent The parent Component used to display error popup 400 403 * @param plugins the collection of all loaded plugins 401 404 * @param plugin the plugin for which preconditions are checked 402 405 * @return true, if the preconditions are met; false otherwise 403 406 */ 404 public static boolean checkLoadPreconditions( Windowparent, Collection<PluginInformation> plugins, PluginInformation plugin) {407 public static boolean checkLoadPreconditions(Component parent, Collection<PluginInformation> plugins, PluginInformation plugin) { 405 408 406 409 // make sure the plugin is compatible with the current JOSM version … … 411 414 return false; 412 415 } 416 417 return checkRequiredPluginsPreconditions(parent, plugins, plugin); 418 } 419 420 /** 421 * Checks if required plugins preconditions for loading the plugin <code>plugin</code> are met. 422 * No other plugins this plugin depends on should be missing. 423 * 424 * @param parent The parent Component used to display error popup 425 * @param plugins the collection of all loaded plugins 426 * @param plugin the plugin for which preconditions are checked 427 * @return true, if the preconditions are met; false otherwise 428 */ 429 public static boolean checkRequiredPluginsPreconditions(Component parent, Collection<PluginInformation> plugins, PluginInformation plugin) { 413 430 414 431 // make sure the dependencies to other plugins are not broken … … 469 486 * @param pluginClassLoader the plugin class loader 470 487 */ 471 public static void loadPlugin( Windowparent, PluginInformation plugin, ClassLoader pluginClassLoader) {488 public static void loadPlugin(Component parent, PluginInformation plugin, ClassLoader pluginClassLoader) { 472 489 String msg = tr("Could not load plugin {0}. Delete from preferences?", plugin.name); 473 490 try { … … 499 516 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null. 500 517 */ 501 public static void loadPlugins( Windowparent,Collection<PluginInformation> plugins, ProgressMonitor monitor) {518 public static void loadPlugins(Component parent,Collection<PluginInformation> plugins, ProgressMonitor monitor) { 502 519 if (monitor == null) { 503 520 monitor = NullProgressMonitor.INSTANCE; … … 548 565 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null. 549 566 */ 550 public static void loadEarlyPlugins( Windowparent, Collection<PluginInformation> plugins, ProgressMonitor monitor) {567 public static void loadEarlyPlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) { 551 568 List<PluginInformation> earlyPlugins = new ArrayList<PluginInformation>(plugins.size()); 552 569 for (PluginInformation pi: plugins) { … … 565 582 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null. 566 583 */ 567 public static void loadLatePlugins( Windowparent, Collection<PluginInformation> plugins, ProgressMonitor monitor) {584 public static void loadLatePlugins(Component parent, Collection<PluginInformation> plugins, ProgressMonitor monitor) { 568 585 List<PluginInformation> latePlugins = new ArrayList<PluginInformation>(plugins.size()); 569 586 for (PluginInformation pi: plugins) { … … 610 627 } 611 628 612 private static void alertMissingPluginInformation( Windowparent, Collection<String> plugins) {629 private static void alertMissingPluginInformation(Component parent, Collection<String> plugins) { 613 630 StringBuilder sb = new StringBuilder(); 614 631 sb.append("<html>"); … … 642 659 * @return the set of plugins to load (as set of plugin names) 643 660 */ 644 public static List<PluginInformation> buildListOfPluginsToLoad( Windowparent, ProgressMonitor monitor) {661 public static List<PluginInformation> buildListOfPluginsToLoad(Component parent, ProgressMonitor monitor) { 645 662 if (monitor == null) { 646 663 monitor = NullProgressMonitor.INSTANCE; … … 675 692 } 676 693 677 private static void alertFailedPluginUpdate( Windowparent, Collection<PluginInformation> plugins) {694 private static void alertFailedPluginUpdate(Component parent, Collection<PluginInformation> plugins) { 678 695 StringBuffer sb = new StringBuffer(); 679 696 sb.append("<html>"); … … 707 724 * Updates the plugins in <code>plugins</code>. 708 725 * 709 * @param parent the parent windowfor message boxes726 * @param parent the parent component for message boxes 710 727 * @param plugins the collection of plugins to update. Must not be null. 711 728 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null. 712 729 * @throws IllegalArgumentException thrown if plugins is null 713 730 */ 714 public static List<PluginInformation> updatePlugins( Windowparent,731 public static List<PluginInformation> updatePlugins(Component parent, 715 732 List<PluginInformation> plugins, ProgressMonitor monitor) 716 733 throws IllegalArgumentException{ … … 797 814 * @return true, if the plugin shall be disabled; false, otherwise 798 815 */ 799 public static boolean confirmDisablePlugin( Windowparent, String reason, String name) {816 public static boolean confirmDisablePlugin(Component parent, String reason, String name) { 800 817 ButtonSpec [] options = new ButtonSpec[] { 801 818 new ButtonSpec( -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r4737 r5121 5 5 6 6 import java.awt.Image; 7 import java.awt.image.BufferedImage; 7 8 import java.io.File; 8 9 import java.io.FileInputStream; … … 55 56 public List<URL> libraries = new LinkedList<URL>(); 56 57 public final Map<String, String> attr = new TreeMap<String, String>(); 58 59 private static final ImageIcon emptyIcon = new ImageIcon(new BufferedImage(24, 24, BufferedImage.TYPE_INT_ARGB)); 57 60 58 61 /** … … 447 450 public ImageIcon getScaledIcon() { 448 451 if (icon == null) 449 return null;452 return emptyIcon; 450 453 return new ImageIcon(icon.getImage().getScaledInstance(24, 24, Image.SCALE_SMOOTH)); 451 454 }
Note: See TracChangeset
for help on using the changeset viewer.