Permalink
Browse files

EDT violation

git-svn-id: http://josm.openstreetmap.de/svn/trunk@5468 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information...
jttt
jttt committed Aug 21, 2012
1 parent 811ee64 commit 734bc28a087a7d0da5516949f9fe52ea23f180e7
Showing with 33 additions and 25 deletions.
  1. +33 −25 src/org/openstreetmap/josm/gui/preferences/PluginPreference.java
@@ -58,7 +58,7 @@ public PreferenceSetting createPreferenceSetting() {
return new PluginPreference();
}
}
-
+
private PluginPreference() {
super("plugin", tr("Plugins"), tr("Configure available plugins."));
}
@@ -73,7 +73,7 @@ public static String buildDownloadSummary(PluginDownloadTask task) {
"The following {0} plugins have been downloaded <strong>successfully</strong>:",
downloaded.size(),
downloaded.size()
- ));
+ ));
sb.append("<ul>");
for(PluginInformation pi: downloaded) {
sb.append("<li>").append(pi.name).append(" (").append(pi.version).append(")").append("</li>");
@@ -86,7 +86,7 @@ public static String buildDownloadSummary(PluginDownloadTask task) {
"Downloading the following {0} plugins has <strong>failed</strong>:",
failed.size(),
failed.size()
- ));
+ ));
sb.append("<ul>");
for(PluginInformation pi: failed) {
sb.append("<li>").append(pi.name).append("</li>");
@@ -155,7 +155,7 @@ public void componentHidden(ComponentEvent e) {
spPluginPreferences.setBorder(null);
}
}
- );
+ );
pnl.add(spPluginPreferences, BorderLayout.CENTER);
pnl.add(buildActionPanel(), BorderLayout.SOUTH);
@@ -193,13 +193,13 @@ private void configureSites() {
ImageProvider.get("ok"),
tr("Accept the new plugin sites and close the dialog"),
null /* no special help topic */
- ),
- new ButtonSpec(
- tr("Cancel"),
- ImageProvider.get("cancel"),
- tr("Close the dialog"),
- null /* no special help topic */
- )
+ ),
+ new ButtonSpec(
+ tr("Cancel"),
+ ImageProvider.get("cancel"),
+ tr("Close the dialog"),
+ null /* no special help topic */
+ )
};
PluginConfigurationSitesPanel pnl = new PluginConfigurationSitesPanel();
@@ -212,7 +212,7 @@ private void configureSites() {
options,
options[0],
null /* no help topic */
- );
+ );
if (answer != 0 /* OK */)
return;
List<String> sites = pnl.getUpdateSites();
@@ -322,17 +322,25 @@ protected void notifyDownloadResults(PluginDownloadTask task) {
tr("Update plugins"),
!failed.isEmpty() ? JOptionPane.WARNING_MESSAGE : JOptionPane.INFORMATION_MESSAGE,
HelpUtil.ht("/Preferences/Plugins")
- );
+ );
}
protected void alertNothingToUpdate() {
- HelpAwareOptionPane.showOptionDialog(
- pnlPluginPreferences,
- tr("All installed plugins are up to date. JOSM does not have to download newer versions."),
- tr("Plugins up to date"),
- JOptionPane.INFORMATION_MESSAGE,
- null // FIXME: provide help context
- );
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ HelpAwareOptionPane.showOptionDialog(
+ pnlPluginPreferences,
+ tr("All installed plugins are up to date. JOSM does not have to download newer versions."),
+ tr("Plugins up to date"),
+ JOptionPane.INFORMATION_MESSAGE,
+ null // FIXME: provide help context
+ );
+ };
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
public void actionPerformed(ActionEvent e) {
@@ -342,7 +350,7 @@ public void actionPerformed(ActionEvent e) {
pnlPluginPreferences,
toUpdate,
tr("Update plugins")
- );
+ );
// the async task for downloading plugin information
final ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(Main.pref.getPluginSites());
@@ -455,7 +463,7 @@ public void actionPerformed(ActionEvent e) {
tr("Add JOSM Plugin description URL."),
tr("Enter URL"),
JOptionPane.QUESTION_MESSAGE
- );
+ );
if (s != null) {
model.addElement(s);
}
@@ -469,7 +477,7 @@ public void actionPerformed(ActionEvent e) {
tr("Please select an entry."),
tr("Warning"),
JOptionPane.WARNING_MESSAGE
- );
+ );
return;
}
String s = (String)JOptionPane.showInputDialog(
@@ -480,7 +488,7 @@ public void actionPerformed(ActionEvent e) {
null,
null,
list.getSelectedValue()
- );
+ );
if (s != null) {
model.setElementAt(s, list.getSelectedIndex());
}
@@ -494,7 +502,7 @@ public void actionPerformed(ActionEvent event) {
tr("Please select an entry."),
tr("Warning"),
JOptionPane.WARNING_MESSAGE
- );
+ );
return;
}
model.removeElement(list.getSelectedValue());

0 comments on commit 734bc28

Please sign in to comment.