Skip to content

Commit

Permalink
use real thread instead of SwingUtilities invokeLater
Browse files Browse the repository at this point in the history
  • Loading branch information
pgdurand committed Feb 2, 2021
1 parent 44e13ef commit eea0bec
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/bzh/plealog/blastviewer/actions/api/BVGenericAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.SwingUtilities;

import com.plealog.genericapp.api.EZEnvironment;
import com.plealog.genericapp.api.log.EZLogger;
Expand Down Expand Up @@ -65,26 +64,27 @@ public void setHitTable(BlastHitTable ht) {
_hitTable = ht;
}

public void actionPerformed(ActionEvent event) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
SROutput sro = _hitTable.getResult();
int iterNum = _hitTable.getSelectedIteration();
int [] selHits = _hitTable.getSelectedHits();
_act.execute(
sro,
iterNum,
selHits);
} catch (Throwable t) {
EZLogger.warn(BVMessages.getString("OpenFileAction.err")
+ t.toString());
} finally {
EZEnvironment.setDefaultCursor();
}
private class ActionRunner extends Thread {
@Override
public void run() {
try {
SROutput sro = _hitTable.getResult();
int iterNum = _hitTable.getSelectedIteration();
int [] selHits = _hitTable.getSelectedHits();
_act.execute(
sro,
iterNum,
selHits);
} catch (Throwable t) {
EZLogger.warn(BVMessages.getString("OpenFileAction.err")
+ t.toString());
} finally {
EZEnvironment.setDefaultCursor();
}
});
}
}
public void actionPerformed(ActionEvent event) {
new ActionRunner().start();
}

}

0 comments on commit eea0bec

Please sign in to comment.