From e2a5f8d1d01156048d04a0dd53777f78de9b86eb Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 1 May 2018 09:21:39 +0100 Subject: [PATCH] JAL-2899 colouring moved from SwingWorker to a background thread --- src/jalview/ext/jmol/JalviewJmolBinding.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index bbb75cf..2a85a9f 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -52,8 +52,6 @@ import java.util.List; import java.util.Map; import java.util.Vector; -import javax.swing.SwingUtilities; - import org.jmol.adapter.smarter.SmarterJmolAdapter; import org.jmol.api.JmolAppConsoleInterface; import org.jmol.api.JmolSelectionListener; @@ -480,6 +478,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel lastCommand = command; } + Thread colourby = null; /** * Sends a set of colour commands to the structure viewer * @@ -489,7 +488,12 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel protected void colourBySequence( final StructureMappingcommandSet[] colourBySequenceCommands) { - SwingUtilities.invokeLater(new Runnable() + if (colourby != null) + { + colourby.interrupt(); + colourby = null; + } + colourby = new Thread(new Runnable() { @Override public void run() @@ -503,6 +507,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } } }); + colourby.start(); } /** -- 1.7.10.2