JAL-1645 source formatting and organise imports
[jalview.git] / src / jalview / gui / Desktop.java
index 2a360cc..270805a 100644 (file)
@@ -1106,8 +1106,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       {
         JOptionPane.showInternalMessageDialog(Desktop.desktop,
                 MessageManager.formatMessage("label.couldnt_locate",
-                        new Object[]
-                        { url }), MessageManager
+                        new Object[] { url }), MessageManager
                         .getString("label.url_not_found"),
                 JOptionPane.WARNING_MESSAGE);
 
@@ -1495,9 +1494,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   public void saveState_actionPerformed(ActionEvent e)
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
-            jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
-            { "jvp" }, new String[]
-            { "Jalview Project" }, "Jalview Project");
+            jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+            new String[] { "jvp" }, new String[] { "Jalview Project" },
+            "Jalview Project");
 
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager.getString("label.save_state"));
@@ -1516,8 +1515,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         {
           // TODO: refactor to Jalview desktop session controller action.
           setProgressBar(MessageManager.formatMessage(
-                  "label.saving_jalview_project", new Object[]
-                  { choice.getName() }), choice.hashCode());
+                  "label.saving_jalview_project",
+                  new Object[] { choice.getName() }), choice.hashCode());
           jalview.bin.Cache.setProperty("LAST_DIRECTORY",
                   choice.getParent());
           // TODO catch and handle errors for savestate
@@ -1536,8 +1535,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
                     ex);
             JOptionPane.showMessageDialog(me, MessageManager.formatMessage(
                     "label.error_whilst_saving_current_state_to",
-                    new Object[]
-                    { choice.getName() }), MessageManager
+                    new Object[] { choice.getName() }), MessageManager
                     .getString("label.couldnt_save_project"),
                     JOptionPane.WARNING_MESSAGE);
           }
@@ -1567,10 +1565,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   public void loadState_actionPerformed(ActionEvent e)
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
-            jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
-            { "jvp", "jar" }, new String[]
-            { "Jalview Project", "Jalview Project (old)" },
-            "Jalview Project");
+            jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] {
+                "jvp", "jar" }, new String[] { "Jalview Project",
+                "Jalview Project (old)" }, "Jalview Project");
     chooser.setFileView(new JalviewFileView());
     chooser.setDialogTitle(MessageManager.getString("label.restore_state"));
 
@@ -1587,9 +1584,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       {
         public void run()
         {
-          setProgressBar(MessageManager.formatMessage(
-                  "label.loading_jalview_project", new Object[]
-                  { choice }), choice.hashCode());
+          setProgressBar(
+                  MessageManager.formatMessage(
+                          "label.loading_jalview_project",
+                          new Object[] { choice }), choice.hashCode());
           try
           {
             new Jalview2XML().loadJalviewAlign(choice);
@@ -1603,8 +1601,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             JOptionPane.showMessageDialog(Desktop.desktop, MessageManager
                     .formatMessage(
                             "label.error_whilst_loading_project_from",
-                            new Object[]
-                            { choice }), MessageManager
+                            new Object[] { choice }), MessageManager
                     .getString("label.couldnt_load_project"),
                     JOptionPane.WARNING_MESSAGE);
           }
@@ -1629,8 +1626,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     if (fileLoadingCount == 0)
     {
       fileLoadingPanels.add(addProgressPanel(MessageManager.formatMessage(
-              "label.loading_file", new Object[]
-              { fileName })));
+              "label.loading_file", new Object[] { fileName })));
     }
     fileLoadingCount++;
   }
@@ -1724,7 +1720,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     {
       for (AlignmentPanel ap : af.alignPanels)
       {
-        if (alignmentId==null || alignmentId.equals(ap.av.getSequenceSetId()))
+        if (alignmentId == null
+                || alignmentId.equals(ap.av.getSequenceSetId()))
         {
           aps.add(ap);
         }
@@ -1755,7 +1752,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
       for (AlignFrame afr : frames)
       {
-        if (sequenceSetId==null || afr.getViewport().getSequenceSetId().equals(sequenceSetId))
+        if (sequenceSetId == null
+                || afr.getViewport().getSequenceSetId()
+                        .equals(sequenceSetId))
         {
           if (afr.alignPanels != null)
           {
@@ -1894,8 +1893,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
                           Desktop.desktop,
                           MessageManager.formatMessage(
                                   "label.couldnt_import_as_vamsas_session",
-                                  new Object[]
-                                  { fle }),
+                                  new Object[] { fle }),
                           MessageManager
                                   .getString("label.vamsas_document_import_failed"),
                           JOptionPane.ERROR_MESSAGE);
@@ -1972,16 +1970,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
 
     setProgressBar(MessageManager.formatMessage(
-            "status.importing_vamsas_session_from", new Object[]
-            { file.getName() }), file.hashCode());
+            "status.importing_vamsas_session_from",
+            new Object[] { file.getName() }), file.hashCode());
     try
     {
       v_client = new jalview.gui.VamsasApplication(this, file, null);
     } catch (Exception ex)
     {
       setProgressBar(MessageManager.formatMessage(
-              "status.importing_vamsas_session_from", new Object[]
-              { file.getName() }), file.hashCode());
+              "status.importing_vamsas_session_from",
+              new Object[] { file.getName() }), file.hashCode());
       jalview.bin.Cache.log.error(
               "New vamsas session from existing session file failed:", ex);
       return false;
@@ -1989,8 +1987,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     setupVamsasConnectedGui();
     v_client.initial_update(); // TODO: thread ?
     setProgressBar(MessageManager.formatMessage(
-            "status.importing_vamsas_session_from", new Object[]
-            { file.getName() }), file.hashCode());
+            "status.importing_vamsas_session_from",
+            new Object[] { file.getName() }), file.hashCode());
     return v_client.inSession();
   }
 
@@ -2097,8 +2095,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           JMenuItem sessit = new JMenuItem();
           sessit.setText(sess[i]);
           sessit.setToolTipText(MessageManager.formatMessage(
-                  "label.connect_to_session", new Object[]
-                  { sess[i] }));
+                  "label.connect_to_session", new Object[] { sess[i] }));
           final Desktop dsktp = this;
           final String mysesid = sess[i];
           sessit.addActionListener(new ActionListener()
@@ -2151,8 +2148,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       JalviewFileChooser chooser = new JalviewFileChooser(
               jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
               { "vdj" }, // TODO: VAMSAS DOCUMENT EXTENSION is VDJ
-              new String[]
-              { "Vamsas Document" }, "Vamsas Document");
+              new String[] { "Vamsas Document" }, "Vamsas Document");
 
       chooser.setFileView(new JalviewFileView());
       chooser.setDialogTitle(MessageManager
@@ -2164,8 +2160,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       {
         java.io.File choice = chooser.getSelectedFile();
         JPanel progpanel = addProgressPanel(MessageManager.formatMessage(
-                "label.saving_vamsas_doc", new Object[]
-                { choice.getName() }));
+                "label.saving_vamsas_doc",
+                new Object[] { choice.getName() }));
         jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
         String warnmsg = null;
         String warnttl = null;
@@ -2331,9 +2327,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         {
           g.drawString(MessageManager.formatMessage(
                   "label.memory_stats",
-                  new Object[]
-                  { df.format(totalFreeMemory), df.format(maxMemory),
-                      df.format(percentUsage) }), 10,
+                  new Object[] { df.format(totalFreeMemory),
+                      df.format(maxMemory), df.format(percentUsage) }), 10,
                   getHeight() - fm.getHeight());
         }
       }
@@ -2463,12 +2458,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
               "groovy.ui.Console");
       Constructor<?> gccons = gcClass.getConstructor();
       java.lang.reflect.Method setvar = gcClass.getMethod("setVariable",
-              new Class[]
-              { String.class, Object.class });
+              new Class[] { String.class, Object.class });
       java.lang.reflect.Method run = gcClass.getMethod("run");
       Object gc = gccons.newInstance();
-      setvar.invoke(gc, new Object[]
-      { "Jalview", this });
+      setvar.invoke(gc, new Object[] { "Jalview", this });
       run.invoke(gc);
     } catch (Exception ex)
     {
@@ -2546,9 +2539,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         {
           handler.cancelActivity(id);
           us.setProgressBar(MessageManager.formatMessage(
-                  "label.cancelled_params", new Object[]
-                  { ((JLabel) progressPanel.getComponent(0)).getText() }),
-                  id);
+                  "label.cancelled_params",
+                  new Object[] { ((JLabel) progressPanel.getComponent(0))
+                          .getText() }), id);
         }
       });
       progressPanel.add(cancel, BorderLayout.EAST);
@@ -2570,8 +2563,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   }
 
   /**
-   * This will return the first AlignFrame holding the given viewport instance. It
-   * will break if there are more than one AlignFrames viewing a particular av.
+   * This will return the first AlignFrame holding the given viewport instance.
+   * It will break if there are more than one AlignFrames viewing a particular
+   * av.
    * 
    * @param viewport
    * @return alignFrame for viewport
@@ -2580,8 +2574,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
     if (desktop != null)
     {
-      AlignmentPanel[] aps = getAlignmentPanels(viewport
-              .getSequenceSetId());
+      AlignmentPanel[] aps = getAlignmentPanels(viewport.getSequenceSetId());
       for (int panel = 0; aps != null && panel < aps.length; panel++)
       {
         if (aps[panel] != null && aps[panel].av == viewport)
@@ -2790,8 +2783,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           if (progress != null)
           {
             progress.setProgressBar(MessageManager.formatMessage(
-                    "status.opening_params", new Object[]
-                    { url }), this.hashCode());
+                    "status.opening_params", new Object[] { url }), this
+                    .hashCode());
           }
           jalview.util.BrowserLauncher.openURL(url);
         } catch (Exception ex)
@@ -3020,7 +3013,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     myBottomFrame.viewport.setGatherViewsHere(true);
     String topViewId = myTopFrame.viewport.getSequenceSetId();
     String bottomViewId = myBottomFrame.viewport.getSequenceSetId();
-  
+
     JInternalFrame[] frames = desktop.getAllFrames();
     for (JInternalFrame frame : frames)
     {
@@ -3048,7 +3041,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             myBottomFrame.addAlignmentPanel(bottomPanel, false);
           }
         }
-  
+
         if (gatherThis)
         {
           topFrame.getAlignPanels().clear();
@@ -3075,5 +3068,4 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     Desktop.currentAlignFrame = currentAlignFrame;
   }
 
-
 }