X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJalview2XML.java;h=be562920d0aae16b6307c9b5329d6bfe51f93579;hb=fddf3084802b37e5cee17829e32692a4aac3e60d;hp=2434b0026cbff5521c68a8e3b4c857e8df9e0a34;hpb=c37b687de83b672fb6585db5fcd93189e3582139;p=jalview.git diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 2434b00..be56292 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -3344,9 +3344,8 @@ public class Jalview2XML String sessionState = ss.getViewerState(); String tempStateFile = copyJarEntry(jprovider, sessionState, "varna"); - RnaModel rna = new RnaModel(rnaTitle, ann, seq, null, gapped, - tempStateFile); - appVarna.addModel(rna, rnaTitle); + RnaModel rna = new RnaModel(rnaTitle, ann, seq, null, gapped); + appVarna.addModelSession(rna, rnaTitle, tempStateFile); } appVarna.setInitialSelection(viewer.getSelectedRna()); } @@ -3807,23 +3806,16 @@ public class Jalview2XML newFileLoc.append(";"); } - if (newFileLoc.length() == 0) + if (newFileLoc.length() > 0) { - return; - } - int histbug = newFileLoc.indexOf("history = "); - if (histbug > -1) - { - /* - * change "history = [true|false];" to "history = [1|0];" - */ + int histbug = newFileLoc.indexOf("history = "); histbug += 10; int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";", histbug); String val = (diff == -1) ? null : newFileLoc .substring(histbug, diff); if (val != null && val.length() >= 4) { - if (val.contains("e")) // eh? what can it be? + if (val.contains("e")) { if (val.trim().equals("true")) { @@ -3836,53 +3828,53 @@ public class Jalview2XML newFileLoc.replace(histbug, diff, val); } } - } - final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames - .size()]); - final String[] id = pdbids.toArray(new String[pdbids.size()]); - final SequenceI[][] sq = seqmaps - .toArray(new SequenceI[seqmaps.size()][]); - final String fileloc = newFileLoc.toString(); - final String sviewid = viewerData.getKey(); - final AlignFrame alf = af; - final Rectangle rect = new Rectangle(svattrib.getX(), svattrib.getY(), - svattrib.getWidth(), svattrib.getHeight()); - try - { - javax.swing.SwingUtilities.invokeAndWait(new Runnable() + final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames + .size()]); + final String[] id = pdbids.toArray(new String[pdbids.size()]); + final SequenceI[][] sq = seqmaps + .toArray(new SequenceI[seqmaps.size()][]); + final String fileloc = newFileLoc.toString(); + final String sviewid = viewerData.getKey(); + final AlignFrame alf = af; + final Rectangle rect = new Rectangle(svattrib.getX(), + svattrib.getY(), svattrib.getWidth(), svattrib.getHeight()); + try { - @Override - public void run() + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - JalviewStructureDisplayI sview = null; - try - { - sview = new StructureViewer(alf.alignPanel - .getStructureSelectionManager()).createView( - StructureViewer.ViewerType.JMOL, pdbf, id, sq, - alf.alignPanel, svattrib, fileloc, rect, sviewid); - addNewStructureViewer(sview); - } catch (OutOfMemoryError ex) + @Override + public void run() { - new OOMWarning("restoring structure view for PDB id " + id, - (OutOfMemoryError) ex.getCause()); - if (sview != null && sview.isVisible()) + JalviewStructureDisplayI sview = null; + try + { + sview = new StructureViewer(alf.alignPanel + .getStructureSelectionManager()).createView( + StructureViewer.ViewerType.JMOL, pdbf, id, sq, + alf.alignPanel, svattrib, fileloc, rect, sviewid); + addNewStructureViewer(sview); + } catch (OutOfMemoryError ex) { - sview.closeViewer(false); - sview.setVisible(false); - sview.dispose(); + new OOMWarning("restoring structure view for PDB id " + id, + (OutOfMemoryError) ex.getCause()); + if (sview != null && sview.isVisible()) + { + sview.closeViewer(false); + sview.setVisible(false); + sview.dispose(); + } } } - } - }); - } catch (InvocationTargetException ex) - { - warn("Unexpected error when opening Jmol view.", ex); + }); + } catch (InvocationTargetException ex) + { + warn("Unexpected error when opening Jmol view.", ex); - } catch (InterruptedException e) - { - // e.printStackTrace(); + } catch (InterruptedException e) + { + // e.printStackTrace(); + } } }