Ignore:
Timestamp:
2014-02-01T02:15:45+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #9406 - Verify for new versions of plugins on crashes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java

    r6666 r6797  
    66
    77import java.awt.BorderLayout;
     8import java.awt.Component;
    89import java.awt.GridBagConstraints;
    910import java.awt.GridBagLayout;
     
    113114        return sb.toString();
    114115    }
     116   
     117    /**
     118     * Notifies user about result of a finished plugin download task.
     119     * @param parent The parent component
     120     * @param task The finished plugin download task
     121     * @since 6797
     122     */
     123    public static void notifyDownloadResults(final Component parent, PluginDownloadTask task) {
     124        final Collection<PluginInformation> downloaded = task.getDownloadedPlugins();
     125        final Collection<PluginInformation> failed = task.getFailedPlugins();
     126        final StringBuilder sb = new StringBuilder();
     127        sb.append("<html>");
     128        sb.append(buildDownloadSummary(task));
     129        if (!downloaded.isEmpty()) {
     130            sb.append(tr("Please restart JOSM to activate the downloaded plugins."));
     131        }
     132        sb.append("</html>");
     133        GuiHelper.runInEDTAndWait(new Runnable() {
     134            @Override
     135            public void run() {
     136                HelpAwareOptionPane.showOptionDialog(
     137                        parent,
     138                        sb.toString(),
     139                        tr("Update plugins"),
     140                        !failed.isEmpty() ? JOptionPane.WARNING_MESSAGE : JOptionPane.INFORMATION_MESSAGE,
     141                                HelpUtil.ht("/Preferences/Plugins")
     142                        );
     143            }
     144        });
     145    }
    115146
    116147    private JosmTextField tfFilter;
     
    327358        }
    328359
    329         protected void notifyDownloadResults(PluginDownloadTask task) {
    330             final Collection<PluginInformation> downloaded = task.getDownloadedPlugins();
    331             final Collection<PluginInformation> failed = task.getFailedPlugins();
    332             final StringBuilder sb = new StringBuilder();
    333             sb.append("<html>");
    334             sb.append(buildDownloadSummary(task));
    335             if (!downloaded.isEmpty()) {
    336                 sb.append(tr("Please restart JOSM to activate the downloaded plugins."));
    337             }
    338             sb.append("</html>");
    339             GuiHelper.runInEDTAndWait(new Runnable() {
    340                 @Override
    341                 public void run() {
    342                     HelpAwareOptionPane.showOptionDialog(
    343                             pnlPluginPreferences,
    344                             sb.toString(),
    345                             tr("Update plugins"),
    346                             !failed.isEmpty() ? JOptionPane.WARNING_MESSAGE : JOptionPane.INFORMATION_MESSAGE,
    347                                     HelpUtil.ht("/Preferences/Plugins")
    348                             );
    349                 }
    350             });
    351         }
    352 
    353360        protected void alertNothingToUpdate() {
    354361            try {
     
    391398                    if (pluginDownloadTask.isCanceled())
    392399                        return;
    393                     notifyDownloadResults(pluginDownloadTask);
     400                    notifyDownloadResults(pnlPluginPreferences, pluginDownloadTask);
    394401                    model.refreshLocalPluginVersion(pluginDownloadTask.getDownloadedPlugins());
    395402                    model.clearPendingPlugins(pluginDownloadTask.getDownloadedPlugins());
Note: See TracChangeset for help on using the changeset viewer.