JAL-4083 don't need globalUseScriptWait after all, just a couple of calls to jmolHist...
[jalview.git] / src / jalview / ext / jmol / JalviewJmolBinding.java
index a529fae..9436209 100644 (file)
@@ -83,8 +83,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
 
   public Viewer jmolViewer;
 
-  private boolean globalUseScriptWait = false;
-
   public JalviewJmolBinding(StructureSelectionManager ssm,
           PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
           DataSourceType protocol)
@@ -131,7 +129,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   {
     Console.debug(">>Jmol>> " + script);
     String s;
-    if (globalUseScriptWait || useScriptWait)
+    if (useScriptWait)
     {
       s = jmolViewer.scriptWait(script);
     }
@@ -269,12 +267,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   {
     if (atoms != null)
     {
-      // we set the globalUseScriptWait (and reset to previous value) only if
-      // we're going to use it here
       boolean useScriptWait = atoms.size() > 1;
-      boolean prevUseScriptWait = false;
-      if (useScriptWait)
-        prevUseScriptWait = setGlobalUseScriptWait(useScriptWait);
       if (resetLastRes.length() > 0)
       {
         jmolScript(resetLastRes.toString(), useScriptWait);
@@ -285,8 +278,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
         highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
                 atom.getChain(), atom.getPdbFile(), useScriptWait);
       }
-      if (useScriptWait)
-        setGlobalUseScriptWait(prevUseScriptWait);
     }
   }
 
@@ -300,7 +291,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
       return;
     }
 
-    jmolHistory(false);
+    jmolHistory(false, useScriptWait);
 
     StringBuilder selection = new StringBuilder(32);
     StringBuilder cmd = new StringBuilder(64);
@@ -319,14 +310,20 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
             .append(" and not hetero; spacefill 0;");
 
     jmolScript(cmd.toString(), useScriptWait);
-    jmolHistory(true);
+    jmolHistory(true, useScriptWait);
   }
 
   private boolean debug = true;
 
   private void jmolHistory(boolean enable)
   {
-    jmolScript("History " + ((debug || enable) ? "on" : "off"));
+    jmolHistory(enable, false);
+  }
+
+  private void jmolHistory(boolean enable, boolean useScriptWait)
+  {
+    jmolScript("History " + ((debug || enable) ? "on" : "off"),
+            useScriptWait);
   }
 
   public void loadInline(String string)
@@ -1075,11 +1072,4 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   {
     return "http://wiki.jmol.org"; // BH 2018
   }
-
-  private boolean setGlobalUseScriptWait(boolean b)
-  {
-    boolean prev = globalUseScriptWait;
-    globalUseScriptWait = b;
-    return prev;
-  }
 }