From: jprocter Date: Fri, 20 Aug 2010 11:55:01 +0000 (+0000) Subject: improved debug output when Jmol viewer creation fails X-Git-Tag: Release_2_6~108 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9adeaab28df6873e67ebe42e1ccd3a87cf6507af;p=jalview.git improved debug output when Jmol viewer creation fails --- diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index fb15c82..afbc83c 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -33,7 +33,7 @@ import org.jmol.viewer.JmolConstants; import jalview.schemes.*; -public class AppletJmol extends EmbmenuFrame implements +public class AppletJmol extends EmbmenuFrame implements // StructureListener, KeyListener, ActionListener, ItemListener, SequenceStructureBinding @@ -178,9 +178,22 @@ public class AppletJmol extends EmbmenuFrame implements renderPanel = new RenderPanel(); embedMenuIfNeeded(renderPanel); this.add(renderPanel, BorderLayout.CENTER); - jmb.allocateViewer(renderPanel, - "jalviewJmol", ap.av.applet.getDocumentBase(), ap.av.applet - .getCodeBase(), ""); + try + { + jmb.allocateViewer(renderPanel, "jalviewJmol", + ap.av.applet.getDocumentBase(), ap.av.applet.getCodeBase(), + ""); + } catch (Exception e) + { + System.err + .println("Couldn't create a jmol viewer. Args to allocate viewer were:\nDocumentBase=" + + ap.av.applet.getDocumentBase() + + "\nCodebase=" + + ap.av.applet.getCodeBase()); + e.printStackTrace(); + dispose(); + return; + } jmb.newJmolPopup(true, "Jmol", true); this.addWindowListener(new WindowAdapter() @@ -244,7 +257,8 @@ public class AppletJmol extends EmbmenuFrame implements throw new Exception( "Invalid datasource. Could not obtain Reader."); } - jmb.viewer.openReader(pdbentry.getFile(), pdbentry.getId(), freader); + jmb.viewer.openReader(pdbentry.getFile(), pdbentry.getId(), + freader); } catch (Exception e) { // give up! @@ -259,24 +273,6 @@ public class AppletJmol extends EmbmenuFrame implements jalview.bin.JalviewLite.addFrame(this, jmb.getViewerTitle(), 400, 400); } - /** - * create a new binding between structures in an existing jmol viewer instance - * and an alignpanel with sequences that have existing PDBFile entries. Note, - * this does not open a new Jmol window, or modify the display of the - * structures in the original jmol window. - * - * @param viewer2 - * @param alignPanel - * @param seqs - * - sequences to search for associations - */ - public AppletJmol(JmolViewer viewer2, AlignmentPanel alignPanel, - SequenceI[] seqs) - { - - // TODO Auto-generated constructor stub - } - public void loadInline(String string) { loadedInline = true; @@ -427,13 +423,15 @@ public class AppletJmol extends EmbmenuFrame implements } /** - * tick or untick the seqColour menu entry depending upon if it was selected or not. + * tick or untick the seqColour menu entry depending upon if it was selected + * or not. + * * @param itm */ private void setEnabled(MenuItem itm) { - seqColour.setState(itm==seqColour); - jmb.setColourBySequence(itm==seqColour); + seqColour.setState(itm == seqColour); + jmb.setColourBySequence(itm == seqColour); } public void itemStateChanged(ItemEvent evt) @@ -441,9 +439,7 @@ public class AppletJmol extends EmbmenuFrame implements if (evt.getSource() == seqColour) { setEnabled(seqColour); - jmb - .colourBySequence(ap.av.getShowSequenceFeatures(), - ap.av.alignment); + jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment); } else if (!allChainsSelected) centerViewer(); @@ -555,35 +551,25 @@ public class AppletJmol extends EmbmenuFrame implements } } } -/* - @Override - public Color getColour(int atomIndex, int pdbResNum, String chain, - String pdbId) - { - return jmb.getColour(atomIndex, pdbResNum, chain, pdbId); - } - @Override - public String[] getPdbFile() - { - return jmb.getPdbFile(); - } - - @Override - public void highlightAtom(int atomIndex, int pdbResNum, String chain, - String pdbId) - { - jmb.highlightAtom(atomIndex, pdbResNum, chain, pdbId); - - } - - @Override - public void mouseOverStructure(int atomIndex, String strInfo) - { - jmb.mouseOverStructure(atomIndex, strInfo); - - } -*/ + /* + * @Override public Color getColour(int atomIndex, int pdbResNum, String + * chain, String pdbId) { return jmb.getColour(atomIndex, pdbResNum, chain, + * pdbId); } + * + * @Override public String[] getPdbFile() { return jmb.getPdbFile(); } + * + * @Override public void highlightAtom(int atomIndex, int pdbResNum, String + * chain, String pdbId) { jmb.highlightAtom(atomIndex, pdbResNum, chain, + * pdbId); + * + * } + * + * @Override public void mouseOverStructure(int atomIndex, String strInfo) { + * jmb.mouseOverStructure(atomIndex, strInfo); + * + * } + */ public void setJalviewColourScheme(UserColourScheme ucs) { jmb.setJalviewColourScheme(ucs);