From ce9b498aa2db9eb442ad44b9fa22621f89e7eeeb Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 30 Nov 2015 09:31:51 +0000 Subject: [PATCH] JAL-1980 check for null alignment; JAL-1551 @Override's added --- src/jalview/gui/CutAndPasteTransfer.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index ff3e0f2..8665320 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -72,6 +72,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { textarea.requestFocus(); @@ -124,6 +125,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer textarea.append(text); } + @Override public void save_actionPerformed(ActionEvent e) { JalviewFileChooser chooser = new JalviewFileChooser( @@ -160,6 +162,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer * @param e * DOCUMENT ME! */ + @Override public void copyItem_actionPerformed(ActionEvent e) { textarea.getSelectedText(); @@ -173,6 +176,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer * @param e * DOCUMENT ME! */ + @Override public void pasteMenu_actionPerformed(ActionEvent e) { Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); @@ -198,6 +202,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer * @param e * DOCUMENT ME! */ + @Override public void ok_actionPerformed(ActionEvent e) { String text = getText(); @@ -247,7 +252,11 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer { String title = MessageManager.formatMessage( "label.input_cut_paste_params", new String[] { format }); - if (viewport != null) + /* + * if the view panel was closed its alignment is nulled + * and this is an orphaned cut and paste window + */ + if (viewport != null && viewport.getAlignment() != null) { ((AlignViewport) viewport).addAlignment(al, title); } @@ -319,6 +328,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer * @param e * DOCUMENT ME! */ + @Override public void cancel_actionPerformed(ActionEvent e) { try @@ -329,6 +339,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer } } + @Override public void textarea_mousePressed(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) @@ -339,6 +350,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer MessageManager.getString("action.copy")); item.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { copyItem_actionPerformed(e); @@ -348,6 +360,7 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer item = new JMenuItem(MessageManager.getString("action.paste")); item.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { pasteMenu_actionPerformed(e); -- 1.7.10.2