JAL-1807 explicit imports (jalview.gui)
[jalview.git] / src / jalview / gui / AlignFrame.java
index 68d7397..e656b0f 100644 (file)
@@ -46,6 +46,7 @@ import jalview.commands.RemoveGapColCommand;
 import jalview.commands.RemoveGapsCommand;
 import jalview.commands.SlideSequencesCommand;
 import jalview.commands.TrimRegionCommand;
+import jalview.controller.AlignViewController;
 import jalview.datamodel.AlignedCodonFrame;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
@@ -63,11 +64,13 @@ import jalview.datamodel.SequenceI;
 import jalview.gui.ViewSelectionMenu.ViewSetProvider;
 import jalview.io.AlignmentProperties;
 import jalview.io.AnnotationFile;
+import jalview.io.AppletFormatAdapter;
 import jalview.io.BioJsHTMLOutput;
 import jalview.io.FileLoader;
 import jalview.io.FormatAdapter;
 import jalview.io.HtmlSvgOutput;
 import jalview.io.IdentifyFile;
+import jalview.io.JPredFile;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
 import jalview.io.JnetAnnotationMaker;
@@ -84,6 +87,7 @@ import jalview.schemes.HydrophobicColourScheme;
 import jalview.schemes.NucleotideColourScheme;
 import jalview.schemes.PIDColourScheme;
 import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAHelicesColour;
 import jalview.schemes.RNAHelicesColourChooser;
 import jalview.schemes.ResidueProperties;
 import jalview.schemes.StrandColourScheme;
@@ -94,10 +98,14 @@ import jalview.schemes.UserColourScheme;
 import jalview.schemes.ZappoColourScheme;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.MessageManager;
+import jalview.util.Platform;
 import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.DBRefFetcher;
+import jalview.ws.WSMenuEntryProviderI;
 import jalview.ws.jws1.Discoverer;
 import jalview.ws.jws2.Jws2Discoverer;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.rest.RestClient;
 import jalview.ws.seqfetcher.DbSourceProxy;
 
 import java.awt.BorderLayout;
@@ -146,6 +154,8 @@ import javax.swing.JRadioButtonMenuItem;
 import javax.swing.JScrollPane;
 import javax.swing.SwingUtilities;
 
+import ext.vamsas.ServiceHandle;
+
 /**
  * DOCUMENT ME!
  * 
@@ -341,7 +351,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       progressBar = new ProgressBar(this.statusPanel, this.statusBar);
     }
 
-    avc = new jalview.controller.AlignViewController(this, viewport,
+    avc = new AlignViewController(this, viewport,
             alignPanel);
     if (viewport.getAlignmentConservationAnnotation() == null)
     {
@@ -353,7 +363,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       // modifyPID.setEnabled(false);
     }
 
-    String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT",
+    String sortby = Cache.getDefault("SORT_ALIGNMENT",
             "No sort");
 
     if (sortby.equals("Id"))
@@ -381,7 +391,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       wrapMenuItem_actionPerformed(null);
     }
 
-    if (jalview.bin.Cache.getDefault("SHOW_OVERVIEW", false))
+    if (Cache.getDefault("SHOW_OVERVIEW", false))
     {
       this.overviewMenuItem_actionPerformed(null);
     }
@@ -705,8 +715,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   public void addAlignmentPanel(final AlignmentPanel ap, boolean newPanel)
   {
     ap.alignFrame = this;
-    avc = new jalview.controller.AlignViewController(this, viewport,
-            alignPanel);
+    avc = new AlignViewController(this, viewport, alignPanel);
 
     alignPanels.add(ap);
 
@@ -828,7 +837,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     purinePyrimidineColour.setEnabled(nucleotide);
     showComplementMenuItem.setText(MessageManager
             .getString(nucleotide ? "label.protein" : "label.nucleotide"));
-    setColourSelected(jalview.bin.Cache.getDefault(
+    setColourSelected(Cache.getDefault(
             nucleotide ? Preferences.DEFAULT_COLOUR_NUC
                     : Preferences.DEFAULT_COLOUR_PROT, "None"));
   }
@@ -894,7 +903,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     listenToViewSelections.setSelected(av.followSelection);
     rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure());
     rnahelicesColour
-            .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
+            .setSelected(av.getGlobalColourScheme() instanceof RNAHelicesColour);
     setShowProductsEnabled();
     updateEditMenuBar();
   }
@@ -940,7 +949,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    */
   public String getVersion()
   {
-    return jalview.bin.Cache.getProperty("VERSION");
+    return Cache.getProperty("VERSION");
   }
 
   public FeatureRenderer getFeatureRenderer()
@@ -1043,7 +1052,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   public void save_actionPerformed(ActionEvent e)
   {
     if (fileName == null
-            || (currentFileFormat == null || !jalview.io.FormatAdapter
+            || (currentFileFormat == null || !FormatAdapter
                     .isValidIOFormat(currentFileFormat, true))
             || fileName.startsWith("http"))
     {
@@ -1065,9 +1074,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   public void saveAs_actionPerformed(ActionEvent e)
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
-            jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
-            jalview.io.AppletFormatAdapter.WRITABLE_EXTENSIONS,
-            jalview.io.AppletFormatAdapter.WRITABLE_FNAMES,
+            Cache.getProperty("LAST_DIRECTORY"),
+            AppletFormatAdapter.WRITABLE_EXTENSIONS,
+            AppletFormatAdapter.WRITABLE_FNAMES,
             currentFileFormat, false);
 
     chooser.setFileView(new JalviewFileView());
@@ -1099,10 +1108,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
       fileName = chooser.getSelectedFile().getPath();
 
-      jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",
+      Cache.setProperty("DEFAULT_FILE_FORMAT",
               currentFileFormat);
 
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", fileName);
+      Cache.setProperty("LAST_DIRECTORY", fileName);
       if (currentFileFormat.indexOf(" ") > -1)
       {
         currentFileFormat = currentFileFormat.substring(0,
@@ -1135,7 +1144,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
     else
     {
-      if (!jalview.io.AppletFormatAdapter.isValidFormat(format, true))
+      if (!AppletFormatAdapter.isValidFormat(format, true))
       {
         warningMessage("Cannot save file " + fileName + " using format "
                 + format, "Alignment output format not supported");
@@ -1201,7 +1210,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   private void warningMessage(String warning, String title)
   {
-    if (new jalview.util.Platform().isHeadless())
+    if (Platform.isHeadless())
     {
       System.err.println("Warning: " + title + "\nWarning: " + warning);
 
@@ -1441,7 +1450,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   {
     // Pick the tree file
     JalviewFileChooser chooser = new JalviewFileChooser(
-            jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+            Cache.getProperty("LAST_DIRECTORY"));
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager
             .getString("label.load_jalview_annotations"));
@@ -1453,7 +1462,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     if (value == JalviewFileChooser.APPROVE_OPTION)
     {
       String choice = chooser.getSelectedFile().getPath();
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
+      Cache.setProperty("LAST_DIRECTORY", choice);
       loadJalviewDataFile(choice, null, null, null);
     }
 
@@ -1883,7 +1892,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
     try
     {
-      jalview.gui.Desktop.internalCopy = true;
+      Desktop.internalCopy = true;
       // Its really worth setting the clipboard contents
       // to empty before setting the large StringSelection!!
       Toolkit.getDefaultToolkit().getSystemClipboard()
@@ -3706,9 +3715,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         iSize--;
       }
     }
-    if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
+    if (UserDefinedColours.getUserColourSchemes() != null)
     {
-      java.util.Enumeration userColours = jalview.gui.UserDefinedColours
+      Enumeration userColours = UserDefinedColours
               .getUserColourSchemes().keys();
 
       while (userColours.hasMoreElements())
@@ -3727,7 +3736,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               radioItem.removeActionListener(radioItem.getActionListeners()[0]);
 
               int option = JOptionPane.showInternalConfirmDialog(
-                      jalview.gui.Desktop.desktop,
+                      Desktop.desktop,
                       MessageManager
                               .getString("label.remove_from_default_list"),
                       MessageManager
@@ -3735,8 +3744,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                       JOptionPane.YES_NO_OPTION);
               if (option == JOptionPane.YES_OPTION)
               {
-                jalview.gui.UserDefinedColours
-                        .removeColourFromDefaults(radioItem.getText());
+                UserDefinedColours.removeColourFromDefaults(radioItem
+                        .getText());
                 colourMenu.remove(radioItem);
               }
               else
@@ -4303,7 +4312,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * be submitted for multiple alignment.
    * 
    */
-  public jalview.datamodel.AlignmentView gatherSequencesForAlignment()
+  public AlignmentView gatherSequencesForAlignment()
   {
     // Now, check we have enough sequences
     AlignmentView msa = null;
@@ -4387,7 +4396,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   {
     // Pick the tree file
     JalviewFileChooser chooser = new JalviewFileChooser(
-            jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+            Cache.getProperty("LAST_DIRECTORY"));
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager
             .getString("label.select_newick_like_tree_file"));
@@ -4398,11 +4407,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     if (value == JalviewFileChooser.APPROVE_OPTION)
     {
       String choice = chooser.getSelectedFile().getPath();
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
-      jalview.io.NewickFile fin = null;
+      Cache.setProperty("LAST_DIRECTORY", choice);
+      NewickFile fin = null;
       try
       {
-        fin = new jalview.io.NewickFile(choice, "File");
+        fin = new NewickFile(choice, "File");
         viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree());
       } catch (Exception ex)
       {
@@ -4575,10 +4584,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               // Add any secondary structure prediction services
               for (int i = 0, j = secstrpr.size(); i < j; i++)
               {
-                final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) secstrpr
-                        .get(i);
-                jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
-                        .getServiceClient(sh);
+                final ServiceHandle sh = (ServiceHandle) secstrpr.get(i);
+                WSMenuEntryProviderI impl = Discoverer.getServiceClient(sh);
                 int p = secstrmenu.getItemCount();
                 impl.attachWSMenuEntry(secstrmenu, me);
                 int q = secstrmenu.getItemCount();
@@ -4705,8 +4712,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     // SHmmr test client - still being implemented.
     // DEBUG - alignmentView
 
-    for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient
-            .getRestClients())
+    for (RestClient client : RestClient.getRestClients())
     {
       client.attachWSMenuEntry(
               JvSwingUtils.findOrCreateMenu(webService, client.getAction()),
@@ -4716,7 +4722,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * public void vamsasStore_actionPerformed(ActionEvent e) { JalviewFileChooser
-   * chooser = new JalviewFileChooser(jalview.bin.Cache.
+   * chooser = new JalviewFileChooser(Cache.
    * getProperty("LAST_DIRECTORY"));
    * 
    * chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Export
@@ -4796,7 +4802,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       showProducts.setEnabled(showp);
     } catch (Exception e)
     {
-      jalview.bin.Cache.log
+      Cache.log
               .warn("canTranslate threw an exception - please report to help@jalview.org",
                       e);
       return false;
@@ -4911,14 +4917,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           }
         } catch (Exception e)
         {
-          jalview.bin.Cache.log.error(
+          Cache.log.error(
                   "Exception when finding crossreferences", e);
         } catch (OutOfMemoryError e)
         {
           new OOMWarning("whilst fetching crossreferences", e);
         } catch (Error e)
         {
-          jalview.bin.Cache.log.error("Error when finding crossreferences",
+          Cache.log.error("Error when finding crossreferences",
                   e);
         }
         AlignFrame.this.setProgressBar(MessageManager.formatMessage(
@@ -4939,11 +4945,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     // old way
     try
     {
-      return (jalview.analysis.Dna.canTranslate(selection,
+      return (Dna.canTranslate(selection,
               viewport.getViewAsVisibleContigs(true)));
     } catch (Exception e)
     {
-      jalview.bin.Cache.log
+      Cache.log
               .warn("canTranslate threw an exception - please report to help@jalview.org",
                       e);
       return false;
@@ -4965,7 +4971,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       al = dna.translateCdna();
     } catch (Exception ex)
     {
-      jalview.bin.Cache.log.error(
+      Cache.log.error(
               "Exception during translation. Please report this !", ex);
       final String msg = MessageManager
               .getString("label.error_when_translating_sequences_submit_bug_report");
@@ -5029,7 +5035,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   public boolean parseFeaturesFile(String file, String type)
   {
     return avc.parseFeaturesFile(file, type,
-            jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false));
+            Cache.getDefault("RELAXEDSEQIDMATCHING", false));
     
   }
 
@@ -5136,12 +5142,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           String file = files.get(i).toString();
           String pdbfn = "";
           String protocol = FormatAdapter.checkProtocol(file);
-          if (protocol == jalview.io.FormatAdapter.FILE)
+          if (protocol == FormatAdapter.FILE)
           {
             File fl = new File(file);
             pdbfn = fl.getName();
           }
-          else if (protocol == jalview.io.FormatAdapter.URL)
+          else if (protocol == FormatAdapter.URL)
           {
             URL url = new URL(file);
             pdbfn = url.getFile();
@@ -5280,7 +5286,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       if (protocol == null)
       {
-        protocol = jalview.io.FormatAdapter.checkProtocol(file);
+        protocol = FormatAdapter.checkProtocol(file);
       }
       // if the file isn't identified, or not positively identified as some
       // other filetype (PFAM is default unidentified alignment file type) then
@@ -5346,8 +5352,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           }
           if (format.equalsIgnoreCase("JnetFile"))
           {
-            jalview.io.JPredFile predictions = new jalview.io.JPredFile(
-                    file, protocol);
+            JPredFile predictions = new JPredFile(file, protocol);
             new JnetAnnotationMaker();
             JnetAnnotationMaker.add_annotation(predictions,
                     viewport.getAlignment(), 0, false);
@@ -5364,9 +5369,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
              * if (format.equalsIgnoreCase("PDB")) {
              * 
              * String pdbfn = ""; // try to match up filename with sequence id
-             * try { if (protocol == jalview.io.FormatAdapter.FILE) { File fl =
+             * try { if (protocol == FormatAdapter.FILE) { File fl =
              * new File(file); pdbfn = fl.getName(); } else if (protocol ==
-             * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
+             * FormatAdapter.URL) { URL url = new URL(file); pdbfn =
              * url.getFile(); } } catch (Exception e) { } ; if (assocSeq ==
              * null) { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
              * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) {
@@ -5491,8 +5496,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   @Override
   protected void extractScores_actionPerformed(ActionEvent e)
   {
-    ParseProperties pp = new jalview.analysis.ParseProperties(
-            viewport.getAlignment());
+    ParseProperties pp = new ParseProperties(viewport.getAlignment());
     // TODO: verify regex and introduce GUI dialog for version 2.5
     // if (pp.getScoresFromDescription("col", "score column ",
     // "\\W*([-+]?\\d*\\.?\\d*e?-?\\d*)\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)",
@@ -5602,7 +5606,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           @Override
           public void run()
           {
-            new jalview.ws.DBRefFetcher(alignPanel.av
+            new DBRefFetcher(alignPanel.av
                     .getSequenceSelection(), alignPanel.alignFrame)
                     .fetchDBRefs(false);
           }
@@ -5620,7 +5624,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       {
         final jalview.ws.SequenceFetcher sf = SequenceFetcher
                 .getSequenceFetcherSingleton(me);
-        javax.swing.SwingUtilities.invokeLater(new Runnable()
+        SwingUtilities.invokeLater(new Runnable()
         {
           @Override
           public void run()
@@ -5672,7 +5676,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                       @Override
                       public void run()
                       {
-                        new jalview.ws.DBRefFetcher(alignPanel.av
+                        new DBRefFetcher(alignPanel.av
                                 .getSequenceSelection(),
                                 alignPanel.alignFrame, dassource)
                                 .fetchDBRefs(false);
@@ -5705,7 +5709,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                       @Override
                       public void run()
                       {
-                        new jalview.ws.DBRefFetcher(alignPanel.av
+                        new DBRefFetcher(alignPanel.av
                                 .getSequenceSelection(),
                                 alignPanel.alignFrame, dassource)
                                 .fetchDBRefs(false);
@@ -5748,7 +5752,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                         @Override
                         public void run()
                         {
-                          new jalview.ws.DBRefFetcher(alignPanel.av
+                          new DBRefFetcher(alignPanel.av
                                   .getSequenceSelection(),
                                   alignPanel.alignFrame, dassrc)
                                   .fetchDBRefs(false);