JAL-1551 formatting
authorJim Procter <jprocter@issues.jalview.org>
Wed, 11 Jul 2018 12:27:39 +0000 (13:27 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 11 Jul 2018 12:27:39 +0000 (13:27 +0100)
src/jalview/gui/AlignFrame.java

index af00998..6911d86 100644 (file)
@@ -336,14 +336,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     Desktop.getDesktop().propertyChange(evt);
   }
 
-  
   /**
-   *  BH 2018
-   *   
+   * BH 2018
+   * 
    * @return true if we have any features
    */
   @Override
-  protected boolean haveAlignmentFeatures() { 
+  protected boolean haveAlignmentFeatures()
+  {
     AlignmentI alignment = getViewport().getAlignment();
 
     for (int i = 0; i < alignment.getHeight(); i++)
@@ -351,12 +351,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       SequenceI seq = alignment.getSequenceAt(i);
       for (String group : seq.getFeatures().getFeatureGroups(true))
       {
-        if (group != null)return true;
+        if (group != null)
+          return true;
       }
     }
-    return  false; 
+    return false;
   }
-  
+
   /**
    * initalise the alignframe from the underlying viewport data and the
    * configurations
@@ -418,7 +419,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
        * 
        */
       {
-      addServiceListeners();
+        addServiceListeners();
       }
       setGUINucleotide();
     }
@@ -536,14 +537,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     setFileFormat(format);
     reload.setEnabled(true);
   }
-  
+
   /**
    * JavaScript will have this, maybe others. More dependable than a file name
    * and maintains a reference to the actual bytes loaded.
    * 
    * @param file
    */
-  public void setFileObject(File file) {
+  public void setFileObject(File file)
+  {
     this.fileObject = file;
   }
 
@@ -1077,7 +1079,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
         FileLoader loader = new FileLoader();
         DataSourceType protocol = fileName.startsWith("http:")
-                ? DataSourceType.URL : DataSourceType.FILE;
+                ? DataSourceType.URL
+                : DataSourceType.FILE;
         loader.LoadFile(viewport, fileName, protocol, currentFileFormat);
       }
       else
@@ -1092,13 +1095,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         {
 
           DataSourceType protocol = (fileName.startsWith("http:")
-                  ? DataSourceType.URL : DataSourceType.FILE);
+                  ? DataSourceType.URL
+                  : DataSourceType.FILE);
           newframe = loader.LoadFileWaitTillLoaded(fileName, protocol,
                   currentFileFormat);
         }
         else
         {
-          newframe = loader.LoadFileWaitTillLoaded(fileObject, DataSourceType.FILE, currentFileFormat);
+          newframe = loader.LoadFileWaitTillLoaded(fileObject,
+                  DataSourceType.FILE, currentFileFormat);
         }
 
         newframe.setBounds(bounds);
@@ -1175,7 +1180,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       @Override
       public void run()
-        {
+      {
         currentFileFormat = chooser.getSelectedFormat();
         while (currentFileFormat == null)
         {
@@ -1457,17 +1462,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     chooser.setToolTipText(
             MessageManager.getString("label.load_jalview_annotations"));
     chooser.response(new RunResponse(JalviewFileChooser.APPROVE_OPTION)
-        {
+    {
 
-          @Override
-          public void run()
-          {
-            String choice = chooser.getSelectedFile().getPath();
-            jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
-            loadJalviewDataFile(chooser.getSelectedFile(), null, null, null);
-          }
+      @Override
+      public void run()
+      {
+        String choice = chooser.getSelectedFile().getPath();
+        jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
+        loadJalviewDataFile(chooser.getSelectedFile(), null, null, null);
+      }
 
-        });
+    });
 
     chooser.openDialog(this);
   }
@@ -3927,40 +3932,38 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     chooser.setToolTipText(
             MessageManager.getString("label.load_tree_file"));
 
-    chooser.response(
-            new jalview.util.dialogrunner.RunResponse(JalviewFileChooser.APPROVE_OPTION)
-            {
-              @Override
-              public void run()
-              {
-                String filePath = chooser.getSelectedFile().getPath();
-                Cache.setProperty("LAST_DIRECTORY", filePath);
-                NewickFile fin = null;
-                try
-                {
-                  fin = new NewickFile(new FileParse(
-                          chooser.getSelectedFile(), DataSourceType.FILE));
-                  viewport.setCurrentTree(
-                          showNewickTree(fin, filePath).getTree());
-                } catch (Exception ex)
-                {
-                  JvOptionPane.showMessageDialog(Desktop.desktop,
-                          ex.getMessage(),
-                          MessageManager.getString(
-                                  "label.problem_reading_tree_file"),
-                          JvOptionPane.WARNING_MESSAGE);
-                  ex.printStackTrace();
-                }
-                if (fin != null && fin.hasWarningMessage())
-                {
-                  JvOptionPane.showMessageDialog(Desktop.desktop,
-                          fin.getWarningMessage(),
-                          MessageManager.getString(
-                                  "label.possible_problem_with_tree_file"),
-                          JvOptionPane.WARNING_MESSAGE);
-                }
-              }
-            }).openDialog(this);
+    chooser.response(new jalview.util.dialogrunner.RunResponse(
+            JalviewFileChooser.APPROVE_OPTION)
+    {
+      @Override
+      public void run()
+      {
+        String filePath = chooser.getSelectedFile().getPath();
+        Cache.setProperty("LAST_DIRECTORY", filePath);
+        NewickFile fin = null;
+        try
+        {
+          fin = new NewickFile(new FileParse(chooser.getSelectedFile(),
+                  DataSourceType.FILE));
+          viewport.setCurrentTree(showNewickTree(fin, filePath).getTree());
+        } catch (Exception ex)
+        {
+          JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(),
+                  MessageManager
+                          .getString("label.problem_reading_tree_file"),
+                  JvOptionPane.WARNING_MESSAGE);
+          ex.printStackTrace();
+        }
+        if (fin != null && fin.hasWarningMessage())
+        {
+          JvOptionPane.showMessageDialog(Desktop.desktop,
+                  fin.getWarningMessage(),
+                  MessageManager.getString(
+                          "label.possible_problem_with_tree_file"),
+                  JvOptionPane.WARNING_MESSAGE);
+        }
+      }
+    }).openDialog(this);
   }
 
   public TreePanel showNewickTree(NewickFile nf, String treeTitle)
@@ -4387,7 +4390,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    */
   public boolean parseFeaturesFile(Object file, DataSourceType sourceType)
   {
-    // BH 2018 
+    // BH 2018
     return avc.parseFeaturesFile(file, sourceType,
             Cache.getDefault("RELAXEDSEQIDMATCHING", false));
 
@@ -4434,8 +4437,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     // Java's Transferable for native dnd
     evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
     Transferable t = evt.getTransferable();
-    
-    
+
     final AlignFrame thisaf = this;
     final List<Object> files = new ArrayList<>();
     List<DataSourceType> protocols = new ArrayList<>();
@@ -4468,14 +4470,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
             ArrayList<Object> filesnotmatched = new ArrayList<>();
             for (int i = 0; i < files.size(); i++)
             {
-              // BH 2018 
+              // BH 2018
               Object file = files.get(i);
               String fileName = file.toString();
               String pdbfn = "";
-              DataSourceType protocol = (file instanceof File ? DataSourceType.FILE : FormatAdapter.checkProtocol(fileName));
+              DataSourceType protocol = (file instanceof File
+                      ? DataSourceType.FILE
+                      : FormatAdapter.checkProtocol(fileName));
               if (protocol == DataSourceType.FILE)
               {
-                File fl = (file instanceof File ? (File) file : new File(fileName));
+                File fl = (file instanceof File ? (File) file
+                        : new File(fileName));
                 pdbfn = fl.getName();
               }
               else if (protocol == DataSourceType.URL)
@@ -4524,7 +4529,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
             int assocfiles = 0;
             if (filesmatched.size() > 0)
             {
-              boolean autoAssociate = Cache.getDefault("AUTOASSOCIATE_PDBANDSEQS", false);
+              boolean autoAssociate = Cache
+                      .getDefault("AUTOASSOCIATE_PDBANDSEQS", false);
               if (!autoAssociate)
               {
                 String msg = MessageManager.formatMessage(