From: gmungoc Date: Mon, 28 Nov 2016 17:31:30 +0000 (+0000) Subject: Merge branch 'develop' into trialMerge X-Git-Tag: Release_2_10_3b1~399 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=483e7163b1fb8d4bcb9393014816c944befce328;p=jalview.git Merge branch 'develop' into trialMerge Conflicts: src/jalview/gui/CutAndPasteTransfer.java test/MCview/PDBfileTest.java test/jalview/analysis/AlignmentAnnotationUtilsTest.java test/jalview/analysis/DnaTest.java test/jalview/analysis/FinderTest.java test/jalview/analysis/scoremodels/FeatureScoreModelTest.java test/jalview/controller/AlignViewControllerTest.java test/jalview/datamodel/AlignmentTest.java test/jalview/ext/ensembl/EnsemblSeqProxyTest.java test/jalview/ext/jmol/JmolParserTest.java test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java test/jalview/ext/paradise/TestAnnotate3D.java test/jalview/io/gff/ExonerateHelperTest.java test/jalview/io/gff/GffTests.java test/jalview/structure/Mapping.java test/jalview/structure/StructureSelectionManagerTest.java test/jalview/structures/models/AAStructureBindingModelTest.java test/jalview/util/MappingUtilsTest.java test/jalview/ws/sifts/SiftsClientTest.java --- 483e7163b1fb8d4bcb9393014816c944befce328 diff --cc src/MCview/PDBViewer.java index 8db6fa8,d6b05c4..40edc73 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@@ -24,9 -24,9 +24,10 @@@ import jalview.datamodel.PDBEntry import jalview.datamodel.SequenceI; import jalview.gui.AlignmentPanel; import jalview.gui.Desktop; + import jalview.gui.JvOptionPane; import jalview.gui.OOMWarning; import jalview.gui.UserDefinedColours; +import jalview.io.DataSourceType; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; import jalview.schemes.BuriedColourScheme; diff --cc src/jalview/gui/CutAndPasteTransfer.java index ca79a83,4184eca..df0142c --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@@ -52,9 -49,8 +52,11 @@@ import java.awt.datatransfer.Transferab import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; ++import java.io.FileWriter; ++import java.io.IOException; ++import java.io.PrintWriter; import javax.swing.JMenuItem; - import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; @@@ -148,8 -144,8 +150,8 @@@ public class CutAndPasteTransfer extend { try { -- java.io.PrintWriter out = new java.io.PrintWriter( -- new java.io.FileWriter(chooser.getSelectedFile())); ++ PrintWriter out = new PrintWriter(new FileWriter( ++ chooser.getSelectedFile())); out.print(getText()); out.close(); @@@ -241,19 -230,23 +243,19 @@@ // TODO: identify feature, annotation or tree file and parse appropriately. AlignmentI al = null; - if (FormatAdapter.isValidFormat(format)) + try { - try - { - FormatAdapter fa = new FormatAdapter(alignpanel); - al = fa.readFile(getText(), "Paste", format); - source = fa.getAlignFile(); + FormatAdapter fa = new FormatAdapter(alignpanel); + al = fa.readFile(getText(), DataSourceType.PASTE, format); + source = fa.getAlignFile(); - } catch (java.io.IOException ex) - } catch (java.io.IOException ex) - { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.formatMessage( - "label.couldnt_read_pasted_text", - new String[] { ex.toString() }), MessageManager - .getString("label.error_parsing_text"), - JvOptionPane.WARNING_MESSAGE); - } ++ } catch (IOException ex) + { - JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager ++ JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager + .formatMessage("label.couldnt_read_pasted_text", new String[] + { ex.toString() }), MessageManager + .getString("label.error_parsing_text"), - JOptionPane.WARNING_MESSAGE); ++ JvOptionPane.WARNING_MESSAGE); } if (al != null && al.hasValidSequence()) diff --cc src/jalview/gui/Desktop.java index 2e8644e,6dd7557..77bc7d4 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@@ -1122,19 -1111,11 +1122,19 @@@ public class Desktop extends jalview.jb } else { - String format = new IdentifyFile().identify(url, FormatAdapter.URL); + FileFormatI format = null; + try + { + format = new IdentifyFile().identify(url, DataSourceType.URL); + } catch (FileFormatException e) + { + // TODO revise error handling, distinguish between + // URL not found and response not valid + } - if (format.equals("URL NOT FOUND")) + if (format == null) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, + JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.formatMessage("label.couldnt_locate", new Object[] { url }), MessageManager .getString("label.url_not_found"), diff --cc src/jalview/jbgui/GAlignFrame.java index cbeb93c,d2cb5a2..4de3d3a --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@@ -23,9 -23,9 +23,10 @@@ package jalview.jbgui import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.api.SplitContainerI; import jalview.bin.Cache; + import jalview.gui.JvOptionPane; import jalview.gui.JvSwingUtils; import jalview.gui.Preferences; +import jalview.io.FileFormat; import jalview.schemes.ColourSchemeProperty; import jalview.util.MessageManager; diff --cc test/MCview/PDBfileTest.java index a5bbf8e,551e805..c07c62e --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@@ -33,7 -33,8 +33,8 @@@ import jalview.datamodel.AlignmentI import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import jalview.structure.StructureImportSettings; import java.io.IOException; diff --cc test/jalview/analysis/AlignmentAnnotationUtilsTest.java index 5367d7f,610a60a..f41262c --- a/test/jalview/analysis/AlignmentAnnotationUtilsTest.java +++ b/test/jalview/analysis/AlignmentAnnotationUtilsTest.java @@@ -28,8 -28,8 +28,9 @@@ import jalview.datamodel.AlignmentAnnot import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import java.io.IOException; import java.util.ArrayList; diff --cc test/jalview/analysis/AlignmentUtilsTests.java index 7f7ec31,8a667b3..bada3ca --- a/test/jalview/analysis/AlignmentUtilsTests.java +++ b/test/jalview/analysis/AlignmentUtilsTests.java @@@ -40,10 -40,8 +40,11 @@@ import jalview.datamodel.SearchResultsI import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; +import jalview.io.FileFormatI; import jalview.io.FormatAdapter; import jalview.util.MapList; import jalview.util.MappingUtils; diff --cc test/jalview/analysis/DnaTest.java index ba91d37,4c12905..cd5d3ca --- a/test/jalview/analysis/DnaTest.java +++ b/test/jalview/analysis/DnaTest.java @@@ -32,8 -32,7 +32,9 @@@ import jalview.datamodel.ColumnSelectio import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.gui.AlignViewport; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FormatAdapter; import java.io.IOException; diff --cc test/jalview/analysis/FinderTest.java index 4fdafde,e215b6b..d7a509f --- a/test/jalview/analysis/FinderTest.java +++ b/test/jalview/analysis/FinderTest.java @@@ -30,8 -30,9 +30,9 @@@ import jalview.datamodel.SearchResultMa import jalview.datamodel.SearchResultsI; import jalview.datamodel.Sequence; import jalview.gui.AlignFrame; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import java.util.List; diff --cc test/jalview/analysis/scoremodels/FeatureScoreModelTest.java index 59985f3,1da23ea..66eb5a5 --- a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java +++ b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java @@@ -24,8 -24,9 +24,9 @@@ import jalview.datamodel.AlignmentI import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import java.util.Arrays; diff --cc test/jalview/controller/AlignViewControllerTest.java index f037599,f8ea142..2e89b0e --- a/test/jalview/controller/AlignViewControllerTest.java +++ b/test/jalview/controller/AlignViewControllerTest.java @@@ -32,8 -32,9 +32,9 @@@ import jalview.datamodel.SequenceFeatur import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import java.util.Arrays; import java.util.BitSet; diff --cc test/jalview/datamodel/AlignmentAnnotationTests.java index fb02166,dc86f78..a2c6256 --- a/test/jalview/datamodel/AlignmentAnnotationTests.java +++ b/test/jalview/datamodel/AlignmentAnnotationTests.java @@@ -24,9 -24,10 +24,11 @@@ import static org.testng.AssertJUnit.as import static org.testng.AssertJUnit.assertNull; import jalview.analysis.AlignSeq; + import jalview.gui.JvOptionPane; import jalview.io.AppletFormatAdapter; +import jalview.io.FileFormat; + import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class AlignmentAnnotationTests diff --cc test/jalview/datamodel/AlignmentTest.java index 42cdc8c,4c51229..d2f4b4d --- a/test/jalview/datamodel/AlignmentTest.java +++ b/test/jalview/datamodel/AlignmentTest.java @@@ -28,9 -28,8 +28,10 @@@ import static org.testng.AssertJUnit.as import static org.testng.AssertJUnit.assertTrue; import jalview.datamodel.AlignedCodonFrame.SequenceToSequenceMapping; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; +import jalview.io.FileFormatI; import jalview.io.FormatAdapter; import jalview.util.MapList; diff --cc test/jalview/ext/ensembl/EnsemblSeqProxyTest.java index aee79fe,50fab08..e977233 --- a/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java +++ b/test/jalview/ext/ensembl/EnsemblSeqProxyTest.java @@@ -28,7 -28,8 +28,8 @@@ import static org.testng.internal.junit import jalview.datamodel.Alignment; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import jalview.io.FastaFile; import jalview.io.FileParse; import jalview.io.gff.SequenceOntologyFactory; diff --cc test/jalview/ext/jmol/JmolParserTest.java index 75b27c7,186a94a..131ef41 --- a/test/jalview/ext/jmol/JmolParserTest.java +++ b/test/jalview/ext/jmol/JmolParserTest.java @@@ -29,7 -29,8 +29,8 @@@ import jalview.datamodel.Alignment import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import jalview.io.FileLoader; import jalview.structure.StructureImportSettings; import jalview.structure.StructureImportSettings.StructureParser; diff --cc test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java index 6baa1dd,58ff990..d285b04 --- a/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java +++ b/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java @@@ -21,7 -21,8 +21,8 @@@ package jalview.ext.jmol; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import java.io.File; import java.io.IOException; diff --cc test/jalview/ext/paradise/TestAnnotate3D.java index 3a3b4c2,1b70e8d..85fc039 --- a/test/jalview/ext/paradise/TestAnnotate3D.java +++ b/test/jalview/ext/paradise/TestAnnotate3D.java @@@ -24,9 -24,8 +24,10 @@@ import static org.testng.AssertJUnit.as import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; import jalview.io.FastaFile; +import jalview.io.FileFormat; import jalview.io.FormatAdapter; import java.io.BufferedReader; diff --cc test/jalview/io/FormatAdapterTest.java index 1cabc15,38303d3..7aa5769 --- a/test/jalview/io/FormatAdapterTest.java +++ b/test/jalview/io/FormatAdapterTest.java @@@ -29,8 -30,10 +30,9 @@@ import jalview.gui.JvOptionPane import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; + import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; diff --cc test/jalview/io/IdentifyFileTest.java index 0a3ff94,584313b..3d800d8 --- a/test/jalview/io/IdentifyFileTest.java +++ b/test/jalview/io/IdentifyFileTest.java @@@ -20,25 -20,34 +20,35 @@@ */ package jalview.io; -import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertFalse; +import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; + import jalview.gui.JvOptionPane; + import org.testng.Assert; + import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class IdentifyFileTest { + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + @Test(groups = { "Functional" }, dataProvider = "identifyFiles") - public void testIdentify(String data, String expectedFileType) + public void testIdentify(String data, FileFormatI expectedFileType) + throws FileFormatException { - String protocol = AppletFormatAdapter.FILE; + DataSourceType protocol = DataSourceType.FILE; IdentifyFile ider = new IdentifyFile(); - String actualFiletype = ider.identify(data, protocol); - Assert.assertEquals(actualFiletype, expectedFileType, + FileFormatI actualFiletype = ider.identify(data, protocol); + Assert.assertSame(actualFiletype, expectedFileType, "File identification Failed!"); } diff --cc test/jalview/io/gff/ExonerateHelperTest.java index a0c3577,e770a7b..825af24 --- a/test/jalview/io/gff/ExonerateHelperTest.java +++ b/test/jalview/io/gff/ExonerateHelperTest.java @@@ -35,8 -35,9 +35,9 @@@ import jalview.datamodel.Sequence import jalview.datamodel.SequenceDummy; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import java.io.IOException; import java.util.ArrayList; diff --cc test/jalview/io/gff/GffTests.java index f0381e7,2cd3887..393f2ce --- a/test/jalview/io/gff/GffTests.java +++ b/test/jalview/io/gff/GffTests.java @@@ -33,8 -33,9 +33,9 @@@ import jalview.datamodel.Sequence import jalview.datamodel.SequenceDummy; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import java.util.List; diff --cc test/jalview/structure/Mapping.java index ceb098b,5317a2d..85aea40 --- a/test/jalview/structure/Mapping.java +++ b/test/jalview/structure/Mapping.java @@@ -28,9 -28,9 +28,10 @@@ import jalview.datamodel.Annotation import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; + import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FileLoader; -import jalview.io.FormatAdapter; import jalview.io.StructureFile; import org.testng.Assert; diff --cc test/jalview/structure/StructureSelectionManagerTest.java index d53aede,1ccf6f6..a7e52ff --- a/test/jalview/structure/StructureSelectionManagerTest.java +++ b/test/jalview/structure/StructureSelectionManagerTest.java @@@ -27,7 -27,8 +27,8 @@@ import jalview.datamodel.AlignedCodonFr import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; -import jalview.io.FormatAdapter; +import jalview.io.DataSourceType; import jalview.io.StructureFile; import jalview.util.MapList; diff --cc test/jalview/structures/models/AAStructureBindingModelTest.java index 1dcbd44,84df512..b74a089 --- a/test/jalview/structures/models/AAStructureBindingModelTest.java +++ b/test/jalview/structures/models/AAStructureBindingModelTest.java @@@ -30,7 -30,8 +30,8 @@@ import jalview.datamodel.PDBEntry import jalview.datamodel.PDBEntry.Type; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import jalview.structure.AtomSpec; import jalview.structure.StructureSelectionManager; import jalview.structures.models.AAStructureBindingModel.SuperposeData; diff --cc test/jalview/util/MappingUtilsTest.java index 6780af7,417c2f6..b84e770 --- a/test/jalview/util/MappingUtilsTest.java +++ b/test/jalview/util/MappingUtilsTest.java @@@ -39,9 -39,8 +39,10 @@@ import jalview.datamodel.Sequence import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.AlignViewport; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; +import jalview.io.FileFormatI; import jalview.io.FormatAdapter; import java.awt.Color; diff --cc test/jalview/ws/jabaws/DisorderAnnotExportImport.java index 8ab5763,94a5fe0..3573f50 --- a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java +++ b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java @@@ -26,9 -26,8 +26,10 @@@ import static org.testng.AssertJUnit.as import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; + import jalview.gui.JvOptionPane; import jalview.io.AnnotationFile; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FormatAdapter; import jalview.io.StockholmFileTest; import jalview.ws.jws2.AADisorderClient; diff --cc test/jalview/ws/jabaws/JpredJabaStructExportImport.java index 28fb052,22cdd4c..b8fe0a3 --- a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java +++ b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java @@@ -26,9 -26,8 +26,10 @@@ import static org.testng.AssertJUnit.as import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.gui.Jalview2XML; + import jalview.gui.JvOptionPane; import jalview.io.AnnotationFile; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FormatAdapter; import jalview.io.StockholmFileTest; import jalview.ws.jws2.JPred301Client; diff --cc test/jalview/ws/jabaws/RNAStructExportImport.java index dc8d0e4,418e827..06c803f --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@@ -27,9 -27,9 +27,10 @@@ import jalview.bin.Cache import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.gui.Jalview2XML; + import jalview.gui.JvOptionPane; import jalview.io.AnnotationFile; -import jalview.io.FileLoader; +import jalview.io.DataSourceType; +import jalview.io.FileFormat; import jalview.io.FormatAdapter; import jalview.io.StockholmFileTest; import jalview.ws.jws2.Jws2Discoverer; diff --cc test/jalview/ws/sifts/SiftsClientTest.java index 9f6e306,f71c20d..45c5412 --- a/test/jalview/ws/sifts/SiftsClientTest.java +++ b/test/jalview/ws/sifts/SiftsClientTest.java @@@ -26,7 -26,8 +26,8 @@@ import jalview.datamodel.DBRefEntry import jalview.datamodel.DBRefSource; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; + import jalview.gui.JvOptionPane; -import jalview.io.AppletFormatAdapter; +import jalview.io.DataSourceType; import jalview.structure.StructureMapping; import jalview.xml.binding.sifts.Entry.Entity;