From 3f25214f0a8d25899d472a024e3b49d84fefc3a4 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Thu, 30 Jul 2015 11:32:27 +0100 Subject: [PATCH] JAL-1443 modified exception notifications --- resources/lang/Messages.properties | 5 +---- src/jalview/datamodel/Alignment.java | 2 +- src/jalview/gui/CutAndPasteTransfer.java | 26 +++++++++++--------------- src/jalview/gui/StructureChooser.java | 1 - src/jalview/io/FileLoader.java | 11 +++++++---- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 822d574..f5e07be 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1246,7 +1246,4 @@ info.enter_search_text_to_enable = Enter Search Text to Enable info.search_in_annotation_label = Search in {0} Label info.search_in_annotation_description = Search in {0} Description info.change_threshold_mode_to_enable = Change Threshold Mode to Enable -label.null_or_unidentifiable_data = Null or unidentifiable data content pasted! -label.unidentifiable_data = Unidentifiable Data -label.null_or_invalid_alignment = Null or invalid alignment data! -label.unable_to_create_alignment = Unable to create alignment +label.couldnt_read_data = Couldn't read data \ No newline at end of file diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 15df67b..5d1fc60 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1741,7 +1741,7 @@ public class Alignment implements AlignmentI boolean hasValidSeq = false; for (SequenceI seq : getSequences()) { - if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*")) + if ((seq.getEnd() - seq.getStart()) > 0) { hasValidSeq = true; break; diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index e08bfcd..cd5c792 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -28,6 +28,7 @@ import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; import jalview.io.FileParse; import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; @@ -206,14 +207,13 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE")) { System.err.println(MessageManager - .getString("label.null_or_unidentifiable_data")); + .getString("label.couldnt_read_data")); if (!Jalview.isHeadlessMode()) { - JOptionPane.showMessageDialog(null, - MessageManager - .getString("label.null_or_unidentifiable_data"), - MessageManager.getString("label.unidentifiable_data"), - JOptionPane.ERROR_MESSAGE); + javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop, + AppletFormatAdapter.SUPPORTED_FORMATS, + MessageManager.getString("label.couldnt_read_data"), + JOptionPane.WARNING_MESSAGE); } return; } @@ -295,17 +295,13 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer else { System.err.println(MessageManager - .getString("label.null_or_invalid_alignment")); + .getString("label.couldnt_read_data")); if (!Jalview.isHeadlessMode()) { - JOptionPane - .showMessageDialog( - null, - MessageManager - .getString("label.null_or_invalid_alignment"), - MessageManager - .getString("label.unable_to_create_alignment"), - JOptionPane.ERROR_MESSAGE); + javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop, + AppletFormatAdapter.SUPPORTED_FORMATS, + MessageManager.getString("label.couldnt_read_data"), + JOptionPane.WARNING_MESSAGE); } } } diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index 7c09266..3540cfc 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -309,7 +309,6 @@ public class StructureChooser extends GStructureChooser { seqRefs.add(getDBRefId(dbRef)); } - // seqRefs.add(getDBRefId(dbRef)); ++count; if (count > 10) { diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 73c10df..0705422 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -268,10 +268,13 @@ public class FileLoader implements Runnable + "\" has null or unidentifiable data content!"); if (!Jalview.isHeadlessMode()) { - JOptionPane.showMessageDialog(null, "The input file \"" + file - + "\" has null or unidentifiable data content!", - "Empty data file", - JOptionPane.ERROR_MESSAGE); + javax.swing.JOptionPane.showInternalMessageDialog( + Desktop.desktop, + MessageManager.getString("label.couldnt_read_data") + + " in " + file + "\n" + + AppletFormatAdapter.SUPPORTED_FORMATS, + MessageManager.getString("label.couldnt_read_data"), + JOptionPane.WARNING_MESSAGE); } return; } -- 1.7.10.2