From 0defe3aeb990d75fd672e882edbe9e8156b34414 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 2 Feb 2018 14:23:21 +0000 Subject: [PATCH] JAL-2899 asynchronous Jmol colour updates --- src/jalview/ext/jmol/JalviewJmolBinding.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 41bc116..bbb75cf 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -52,6 +52,8 @@ 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; @@ -485,15 +487,22 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel */ @Override protected void colourBySequence( - StructureMappingcommandSet[] colourBySequenceCommands) + final StructureMappingcommandSet[] colourBySequenceCommands) { - for (StructureMappingcommandSet cpdbbyseq : colourBySequenceCommands) + SwingUtilities.invokeLater(new Runnable() { - for (String cbyseq : cpdbbyseq.commands) + @Override + public void run() { - executeWhenReady(cbyseq); + for (StructureMappingcommandSet cpdbbyseq : colourBySequenceCommands) + { + for (String cbyseq : cpdbbyseq.commands) + { + executeWhenReady(cbyseq); + } + } } - } + }); } /** -- 1.7.10.2