Merge branch 'develop' into trialMerge
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 28 Nov 2016 17:31:30 +0000 (17:31 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 28 Nov 2016 17:31:30 +0000 (17:31 +0000)
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

67 files changed:
1  2 
src/MCview/PDBViewer.java
src/jalview/gui/AlignExportSettings.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/AssociatePdbFileWithSeq.java
src/jalview/gui/ChimeraViewFrame.java
src/jalview/gui/CutAndPasteTransfer.java
src/jalview/gui/Desktop.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/Jalview2XML.java
src/jalview/gui/Jalview2XML_V1.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/Preferences.java
src/jalview/gui/SequenceFetcher.java
src/jalview/gui/StructureChooser.java
src/jalview/gui/StructureViewerBase.java
src/jalview/gui/UserDefinedColours.java
src/jalview/gui/WsParamSetManager.java
src/jalview/io/FileLoader.java
src/jalview/io/JalviewFileChooser.java
src/jalview/jbgui/GAlignFrame.java
test/MCview/PDBfileTest.java
test/jalview/analysis/AlignmentAnnotationUtilsTest.java
test/jalview/analysis/AlignmentUtilsTests.java
test/jalview/analysis/DnaAlignmentGenerator.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/AlignmentAnnotationTests.java
test/jalview/datamodel/AlignmentTest.java
test/jalview/ext/ensembl/EnsemblSeqProxyTest.java
test/jalview/ext/jmol/JmolParserTest.java
test/jalview/ext/jmol/JmolViewerTest.java
test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java
test/jalview/ext/paradise/TestAnnotate3D.java
test/jalview/ext/rbvi/chimera/JalviewChimeraView.java
test/jalview/gui/AlignViewportTest.java
test/jalview/gui/AnnotationChooserTest.java
test/jalview/gui/PopupMenuTest.java
test/jalview/io/AnnotatedPDBFileInputTest.java
test/jalview/io/AnnotationFileIOTest.java
test/jalview/io/CrossRef2xmlTests.java
test/jalview/io/FeaturesFileTest.java
test/jalview/io/FileIOTester.java
test/jalview/io/FormatAdapterTest.java
test/jalview/io/IdentifyFileTest.java
test/jalview/io/JSONFileTest.java
test/jalview/io/Jalview2xmlTests.java
test/jalview/io/JalviewExportPropertiesTests.java
test/jalview/io/NewickFileTests.java
test/jalview/io/PfamFormatInputTest.java
test/jalview/io/PhylipFileTests.java
test/jalview/io/RNAMLfileTest.java
test/jalview/io/StockholmFileTest.java
test/jalview/io/TCoffeeScoreFileTest.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/jabaws/DisorderAnnotExportImport.java
test/jalview/ws/jabaws/JpredJabaStructExportImport.java
test/jalview/ws/jabaws/RNAStructExportImport.java
test/jalview/ws/rest/ShmmrRSBSService.java
test/jalview/ws/sifts/SiftsClientTest.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;
Simple merge
Simple merge
Simple merge
@@@ -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();
      // 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())
@@@ -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"),
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -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;
  
@@@ -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;
@@@ -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;
@@@ -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;
@@@ -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;
@@@ -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;
  
@@@ -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;
  
@@@ -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;
@@@ -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
@@@ -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;
  
@@@ -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;
@@@ -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;
@@@ -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;
@@@ -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;
Simple merge
Simple merge
Simple merge
@@@ -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;
  
   */
  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!");
    }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -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;
@@@ -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;
  
@@@ -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;
@@@ -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;
  
@@@ -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;
@@@ -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;
@@@ -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;
@@@ -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;
@@@ -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;
@@@ -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;