You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Thilo Goetz <tw...@gmx.de> on 2009/06/10 16:14:08 UTC

SwingWorker class in uimaj-tools

Guys,

seems to me we have some Sun source code in svn:
http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/util/gui/SwingWorker.java?view=log

>From the subversion history, this came in with the
original code grant.  We need to investigate if we
can keep this file, but we certainly can't change
the license in the way we did.  Can anybody shed
some light on this?  It's used only in one place in
our code.  Maybe it could be eliminated.

--Thilo

Re: SwingWorker class in uimaj-tools

Posted by Thilo Goetz <tw...@gmx.de>.
Thilo Goetz wrote:
> Jukka Zitting wrote:
>> Hi,
>>
>> On Wed, Jun 10, 2009 at 4:14 PM, Thilo Goetz<tw...@gmx.de> wrote:
>>> It's used only in one place in our code. Maybe it could be eliminated.
>> Based on a quick look it seems like the whole SwingWorker class is
>> overkill for this usage since the get() method is never called. A
>> normal Thread should do just fine, see the patch below.
> 
> Excellent, thanks Jukka.  Unless someone beats me to it, I
> will verify this fix later this week and commit it (and delete
> the SwingWorker class from SVN).

Fix verified and committed:
https://issues.apache.org/jira/browse/UIMA-1380

> 
> --Thilo
> 
>> BR,
>>
>> Jukka Zitting
>>
>> Index: uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java
>> ===================================================================
>> --- uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java	(Revision
>> 783374)
>> +++ uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java	(Arbeitskopie)
>> @@ -707,11 +707,10 @@
>>        statusLabel.setText("Initializing");
>>        // logDialog.clear();
>>        progressBar.setValue(0);
>> -
>> -      final SwingWorker worker = new SwingWorker() {
>> -        public Object construct() {
>> -          startProcessing();
>> -          return null;
>> +
>> +      Thread worker = new Thread() {
>> +        public void run() {
>> +          startProcessing();
>>          }
>>        };
>>        worker.start();


Re: SwingWorker class in uimaj-tools

Posted by Thilo Goetz <tw...@gmx.de>.
Jukka Zitting wrote:
> Hi,
> 
> On Wed, Jun 10, 2009 at 4:14 PM, Thilo Goetz<tw...@gmx.de> wrote:
>> It's used only in one place in our code. Maybe it could be eliminated.
> 
> Based on a quick look it seems like the whole SwingWorker class is
> overkill for this usage since the get() method is never called. A
> normal Thread should do just fine, see the patch below.

Excellent, thanks Jukka.  Unless someone beats me to it, I
will verify this fix later this week and commit it (and delete
the SwingWorker class from SVN).

--Thilo

> 
> BR,
> 
> Jukka Zitting
> 
> Index: uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java
> ===================================================================
> --- uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java	(Revision
> 783374)
> +++ uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java	(Arbeitskopie)
> @@ -707,11 +707,10 @@
>        statusLabel.setText("Initializing");
>        // logDialog.clear();
>        progressBar.setValue(0);
> -
> -      final SwingWorker worker = new SwingWorker() {
> -        public Object construct() {
> -          startProcessing();
> -          return null;
> +
> +      Thread worker = new Thread() {
> +        public void run() {
> +          startProcessing();
>          }
>        };
>        worker.start();

Re: SwingWorker class in uimaj-tools

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Wed, Jun 10, 2009 at 4:14 PM, Thilo Goetz<tw...@gmx.de> wrote:
> It's used only in one place in our code. Maybe it could be eliminated.

Based on a quick look it seems like the whole SwingWorker class is
overkill for this usage since the get() method is never called. A
normal Thread should do just fine, see the patch below.

BR,

Jukka Zitting

Index: uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java
===================================================================
--- uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java	(Revision
783374)
+++ uimaj-tools/src/main/java/org/apache/uima/tools/cpm/CpmPanel.java	(Arbeitskopie)
@@ -707,11 +707,10 @@
       statusLabel.setText("Initializing");
       // logDialog.clear();
       progressBar.setValue(0);
-
-      final SwingWorker worker = new SwingWorker() {
-        public Object construct() {
-          startProcessing();
-          return null;
+
+      Thread worker = new Thread() {
+        public void run() {
+          startProcessing();
         }
       };
       worker.start();