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());
}
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"))
{
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();
+ }
}
}