From: jprocter Date: Wed, 18 Aug 2010 16:50:34 +0000 (+0000) Subject: JAL-612 - catch hidden OOM related to filling in cut and paste text boxes X-Git-Tag: Release_2_6~113 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1b85d0acd9a09b646ac2dd6f1ea6db5db6f3731d;p=jalview.git JAL-612 - catch hidden OOM related to filling in cut and paste text boxes --- diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index 50a501d..35e2308 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -564,8 +564,14 @@ public class PDBViewer extends JInternalFrame implements Runnable public void mapping_actionPerformed(ActionEvent e) { jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer(); - Desktop.addInternalFrame(cap, "PDB - Sequence Mapping", 550, 600); - cap.setText(pdbcanvas.mappingDetails.toString()); + try { + cap.setText(pdbcanvas.mappingDetails.toString()); + Desktop.addInternalFrame(cap, "PDB - Sequence Mapping", 550, 600); + } catch (OutOfMemoryError oom) + { + new OOMWarning("Opening sequence to structure mapping report",oom); + cap.dispose(); + } } public void allchains_itemStateChanged(ItemEvent e) diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 3ac30ae..b0d30a2 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1005,11 +1005,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, CutAndPasteTransfer cap = new CutAndPasteTransfer(); cap.setForInput(null); + + try { + cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), + viewport.alignment, omitHidden, viewport.colSel)); Desktop.addInternalFrame(cap, "Alignment output - " + e.getActionCommand(), 600, 500); + } catch (OutOfMemoryError oom) + { + new OOMWarning("Outputting alignment as "+e.getActionCommand(),oom); + cap.dispose(); + } - cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), - viewport.alignment, omitHidden, viewport.colSel)); } /** diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index 118aab8..857eabc 100755 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -88,8 +88,8 @@ public class AnnotationExporter extends JPanel public void toFile_actionPerformed(ActionEvent e) { - JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache - .getProperty("LAST_DIRECTORY")); + JalviewFileChooser chooser = new JalviewFileChooser( + jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(features ? "Save Features to File" @@ -177,10 +177,18 @@ public class AnnotationExporter extends JPanel } CutAndPasteTransfer cap = new CutAndPasteTransfer(); - cap.setText(text); - Desktop.addInternalFrame(cap, (features ? "Features for - " - : "Annotations for - ") - + ap.alignFrame.getTitle(), 600, 500); + try + { + cap.setText(text); + Desktop.addInternalFrame(cap, (features ? "Features for - " + : "Annotations for - ") + ap.alignFrame.getTitle(), 600, 500); + } catch (OutOfMemoryError oom) + { + new OOMWarning("generating " + + (features ? "Features for - " : "Annotations for - ") + + ap.alignFrame.getTitle(), oom); + cap.dispose(); + } close_actionPerformed(null); } diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 45fc0df..cc63ee4 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -364,12 +364,19 @@ public class TreePanel extends GTreePanel buffer.append("PID"); } - Desktop.addInternalFrame(cap, buffer.toString(), 500, 100); jalview.io.NewickFile fout = new jalview.io.NewickFile(tree .getTopNode()); - cap.setText(fout.print(tree.isHasBootstrap(), tree.isHasDistances(), + try { + cap.setText(fout.print(tree.isHasBootstrap(), tree.isHasDistances(), tree.isHasRootDistance())); + Desktop.addInternalFrame(cap, buffer.toString(), 500, 100); + } catch (OutOfMemoryError oom) + { + new OOMWarning("generating newick tree file",oom); + cap.dispose(); + } + } /**