*/
package jalview.ext.jmol;
-import jalview.api.AlignmentViewPanel;
-import jalview.api.FeatureRenderer;
-import jalview.api.FeatureSettingsModelI;
-import jalview.api.SequenceRenderer;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.HiddenColumns;
-import jalview.datamodel.PDBEntry;
-import jalview.datamodel.SequenceI;
-import jalview.gui.AppJmol;
-import jalview.gui.IProgressIndicator;
-import jalview.io.DataSourceType;
-import jalview.io.StructureFile;
-import jalview.schemes.ColourSchemeI;
-import jalview.schemes.ResidueProperties;
-import jalview.structure.AtomSpec;
-import jalview.structure.StructureMappingcommandSet;
-import jalview.structure.StructureSelectionManager;
-import jalview.structures.models.AAStructureBindingModel;
-import jalview.util.MessageManager;
-import jalview.ws.dbsources.Pdb;
-
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ComponentEvent;
import java.util.StringTokenizer;
import java.util.Vector;
+import javax.swing.SwingUtilities;
+
import org.jmol.adapter.smarter.SmarterJmolAdapter;
import org.jmol.api.JmolAppConsoleInterface;
import org.jmol.api.JmolSelectionListener;
import org.jmol.script.T;
import org.jmol.viewer.Viewer;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.FeatureRenderer;
+import jalview.api.FeatureSettingsModelI;
+import jalview.api.SequenceRenderer;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AppJmol;
+import jalview.gui.IProgressIndicator;
+import jalview.io.DataSourceType;
+import jalview.io.StructureFile;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureMappingcommandSet;
+import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
+import jalview.util.MessageManager;
+import jalview.ws.dbsources.Pdb;
+
public abstract class JalviewJmolBinding extends AAStructureBindingModel
implements JmolStatusListener, JmolSelectionListener,
ComponentListener
}
Thread colourby = null;
+
/**
* Sends a set of colour commands to the structure viewer
*
@Override
public void notifyCallback(CBK type, Object[] data)
{
+ /*
+ * ensure processed in AWT thread to avoid risk of deadlocks
+ */
+ SwingUtilities.invokeLater(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ processCallback(type, data);
+ }
+ });
+ }
+
+ /**
+ * Processes one callback notification from Jmol
+ *
+ * @param type
+ * @param data
+ */
+ protected void processCallback(CBK type, Object[] data)
+ {
try
{
switch (type)
// see JAL-623 - need method of matching pasted data up
{
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
- pdbfile, DataSourceType.PASTE,
- getIProgressIndicator());
+ pdbfile, DataSourceType.PASTE, getIProgressIndicator());
getPdbEntry(modelnum).setFile("INLINE" + pdb.getId());
matches = true;
foundEntry = true;