[Schmitzm-commits] r1776 - trunk/schmitzm-core/src/main/java/de/schmitzm/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 11 16:55:39 CET 2011


Author: mojays
Date: 2011-11-11 16:55:38 +0100 (Fri, 11 Nov 2011)
New Revision: 1776

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java
Log:
SwingWorker: Ignore InterruptedException/ThreadDeath; show error message on EDT

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java	2011-11-10 16:21:15 UTC (rev 1775)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingWorker.java	2011-11-11 15:55:38 UTC (rev 1776)
@@ -31,6 +31,8 @@
 
 import java.awt.Frame;
 
+import javax.swing.SwingUtilities;
+
 import de.schmitzm.lang.WorkingThread;
 
 /**
@@ -260,8 +262,17 @@
      * eine Fehlermeldung angezeigt.<br>
      * Kann gefahrlos von Unterklassen ueberschrieben werden.
      */
-    public void performError(Throwable err) {
-      ExceptionDialog.show(worker.dialog,err);//,SwingResource.DEFAULT.getString("Error"),err.getMessage());
+    public void performError(final Throwable err) {
+      // Abbrechen Button ignorieren
+      if ( err instanceof InterruptedException ||
+           err instanceof ThreadDeath )
+        return;
+      SwingUtilities.invokeLater( new Runnable() {
+        @Override
+        public void run() {
+          ExceptionDialog.show(worker.dialog,err);//,SwingResource.DEFAULT.getString("Error"),err.getMessage());
+        }
+      });
     };
 
     /**



More information about the Schmitzm-commits mailing list