X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fjmol%2FJalviewJmolBinding.java;h=4698e4d5e42d87f54bf3d713a1bcb60eca802c2f;hb=8946f41687f4c822ac8d15ee8551f23f156735c4;hp=babebc57629ead24a032c864f37e707b01539364;hpb=76584a3ac3f6db6af4c3ace0d765827f83a3eb5b;p=jalview.git diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index babebc5..4698e4d 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -44,7 +44,6 @@ import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.io.File; import java.net.URL; -import java.security.AccessControlException; import java.util.ArrayList; import java.util.BitSet; import java.util.Hashtable; @@ -167,7 +166,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // remove listeners for all structures in viewer getSsm().removeStructureViewerListener(this, this.getStructureFiles()); if (viewer != null) + { viewer.dispose(); + } lastCommand = null; viewer = null; releaseUIResources(); @@ -480,6 +481,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } Thread colourby = null; + /** * Sends a set of colour commands to the structure viewer * @@ -494,7 +496,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel colourby.interrupt(); colourby = null; } - colourby = new Thread(new Runnable() + Thread colourby = new Thread(new Runnable() { @Override public void run() @@ -509,6 +511,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel } }); colourby.start(); + this.colourby = colourby; } /** @@ -615,74 +618,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel */ private int _modelFileNameMap[]; - // //////////////////////////////// - // /StructureListener - // @Override - public synchronized String[] getPdbFilex() - { - if (viewer == null) - { - return new String[0]; - } - if (modelFileNames == null) - { - List mset = new ArrayList<>(); - _modelFileNameMap = new int[viewer.ms.mc]; - String m = viewer.ms.getModelFileName(0); - if (m != null) - { - String filePath = m; - try - { - filePath = new File(m).getAbsolutePath(); - } catch (AccessControlException x) - { - // usually not allowed to do this in applet - System.err.println( - "jmolBinding: Using local file string from Jmol: " + m); - } - if (filePath.indexOf("/file:") != -1) - { - // applet path with docroot - discard as format won't match pdbfile - filePath = m; - } - mset.add(filePath); - _modelFileNameMap[0] = 0; // filename index for first model is always 0. - } - int j = 1; - for (int i = 1; i < viewer.ms.mc; i++) - { - m = viewer.ms.getModelFileName(i); - String filePath = m; - if (m != null) - { - try - { - filePath = new File(m).getAbsolutePath(); - } catch (AccessControlException x) - { - // usually not allowed to do this in applet, so keep raw handle - // System.err.println("jmolBinding: Using local file string from - // Jmol: "+m); - } - } - - /* - * add this model unless it is read from a structure file we have - * already seen (example: 2MJW is an NMR structure with 10 models) - */ - if (!mset.contains(filePath)) - { - mset.add(filePath); - _modelFileNameMap[j] = i; // record the model index for the filename - j++; - } - } - modelFileNames = mset.toArray(new String[mset.size()]); - } - return modelFileNames; - } - @Override public synchronized String[] getStructureFiles() { @@ -877,7 +812,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel try { // recover PDB filename for the model hovered over. - int mnumber = new Integer(mdlId).intValue() - 1; + int mnumber = Integer.valueOf(mdlId).intValue() - 1; if (_modelFileNameMap != null) { int _mp = _modelFileNameMap.length - 1; @@ -1154,8 +1089,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // 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; @@ -1255,7 +1189,10 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel return chainNames; } - protected abstract IProgressIndicator getIProgressIndicator(); + protected IProgressIndicator getIProgressIndicator() + { + return null; + } public void notifyNewPickingModeMeasurement(int iatom, String strMeasure) { @@ -1327,7 +1264,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public void showHelp() { - showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp"); + showUrl("http://wiki.jmol.org" + // BH 2018 "http://jmol.sourceforge.net/docs/JmolUserGuide/" + , "jmolHelp"); } /** @@ -1351,7 +1290,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel */ public abstract void showConsole(boolean show); - public static Viewer getJmolData(JmolParser jmolParser) { return (Viewer) JmolViewer.allocateViewer(null, null, null, null, null, @@ -1399,9 +1337,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel String commandOptions, final Container consolePanel, String buttonsToShow) { - + System.err.println("Allocating Jmol Viewer: " + commandOptions); - + if (commandOptions == null) { commandOptions = ""; @@ -1413,10 +1351,13 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel viewer.setJmolStatusListener(this); // extends JmolCallbackListener - try { + try + { console = createJmolConsole(consolePanel, buttonsToShow); - } catch (Throwable e) { - System.err.println("Could not create Jmol application console. " + e.getMessage()); + } catch (Throwable e) + { + System.err.println("Could not create Jmol application console. " + + e.getMessage()); e.printStackTrace(); } if (consolePanel != null) @@ -1430,8 +1371,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel protected abstract JmolAppConsoleInterface createJmolConsole( Container consolePanel, String buttonsToShow); - // BH 2018 -- Jmol console is not working due to problems with styled documents. - + // BH 2018 -- Jmol console is not working due to problems with styled + // documents. protected org.jmol.api.JmolAppConsoleInterface console = null; @@ -1439,20 +1380,20 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel public void setBackgroundColour(java.awt.Color col) { jmolHistory(false); - jmolScript("background [" + col.getRed() + "," - + col.getGreen() + "," + col.getBlue() + "];"); + jmolScript("background [" + col.getRed() + "," + col.getGreen() + "," + + col.getBlue() + "];"); jmolHistory(true); } private String jmolScript(String script) { - + System.err.println(">>Jmol>> " + script); - + String s = viewer.scriptWait(script); - + System.err.println("<