Merge: 497958b 68dcaa7
[jalview.git] / src / jalview / gui / Desktop.java
index faffd89..b8f629a 100644 (file)
@@ -26,6 +26,7 @@ import jalview.io.FormatAdapter;
 import jalview.io.IdentifyFile;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
+import jalview.structure.StructureSelectionManager;
 import jalview.util.ImageMaker;
 import jalview.util.MessageManager;
 import jalview.ws.params.ParamManager;
@@ -286,7 +287,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     instance = this;
     doVamsasClientCheck();
     doGroovyCheck();
-
+    doConfigureStructurePrefs();
     setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
@@ -322,8 +323,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
     jconsole = new Console(this, showjconsole);
     // add essential build information
-    jconsole.setHeader("Jalview Desktop "
+    jconsole.setHeader("Jalview Version: "
             + jalview.bin.Cache.getProperty("VERSION") + "\n"
+            + "Jalview Installation: "
+            + jalview.bin.Cache.getDefault("INSTALLATION", "unknown")
+            + "\n"
             + "Build Date: "
             + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n"
             + "Java version: " + System.getProperty("java.version") + "\n"
@@ -416,6 +420,27 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             });
   }
 
+  public void doConfigureStructurePrefs()
+  {
+    // configure services
+    StructureSelectionManager ssm = StructureSelectionManager
+            .getStructureSelectionManager(this);
+    if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true))
+    {
+      ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault(
+              Preferences.ADD_TEMPFACT_ANN, true));
+    ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
+    ssm.setSecStructServices(jalview.bin.Cache.getDefault(Preferences.USE_RNAVIEW,
+            true));
+    }
+    else
+    {
+      ssm.setAddTempFacAnnot(false);
+      ssm.setProcessSecondaryStructure(false);
+      ssm.setSecStructServices(false);
+    }
+  }
+
   public void checkForNews()
   {
     final Desktop me = this;
@@ -606,38 +631,85 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * Adds and opens the given frame to the desktop
    * 
    * @param frame
-   *          DOCUMENT ME!
+   *          Frame to show
    * @param title
-   *          DOCUMENT ME!
+   *          Visible Title
    * @param w
-   *          DOCUMENT ME!
+   *          width
    * @param h
-   *          DOCUMENT ME!
+   *          height
    */
   public static synchronized void addInternalFrame(
           final JInternalFrame frame, String title, int w, int h)
   {
-    addInternalFrame(frame, title, w, h, true);
+    addInternalFrame(frame, title, true, w, h, true);
   }
 
+
   /**
-   * DOCUMENT ME!
+   * Add an internal frame to the Jalview desktop
    * 
    * @param frame
-   *          DOCUMENT ME!
+   *          Frame to show
    * @param title
-   *          DOCUMENT ME!
+   *          Visible Title
+   * @param makeVisible
+   *          When true, display frame immediately, otherwise, caller must call
+   *          setVisible themselves.
    * @param w
-   *          DOCUMENT ME!
+   *          width
    * @param h
-   *          DOCUMENT ME!
+   *          height
+   */
+  public static synchronized void addInternalFrame(
+          final JInternalFrame frame, String title, boolean makeVisible,
+          int w, int h)
+  {
+    addInternalFrame(frame, title, makeVisible, w, h, true);
+  }
+
+  /**
+   * Add an internal frame to the Jalview desktop and make it visible
+   * 
+   * @param frame
+   *          Frame to show
+   * @param title
+   *          Visible Title
+   * @param w
+   *          width
+   * @param h
+   *          height
    * @param resizable
-   *          DOCUMENT ME!
+   *          Allow resize
    */
   public static synchronized void addInternalFrame(
           final JInternalFrame frame, String title, int w, int h,
           boolean resizable)
   {
+    addInternalFrame(frame, title, true, w, h, resizable);
+  }
+
+  /**
+   * Add an internal frame to the Jalview desktop
+   * 
+   * @param frame
+   *          Frame to show
+   * @param title
+   *          Visible Title
+   * @param makeVisible
+   *          When true, display frame immediately, otherwise, caller must call
+   *          setVisible themselves.
+   * @param w
+   *          width
+   * @param h
+   *          height
+   * @param resizable
+   *          Allow resize
+   */
+  public static synchronized void addInternalFrame(
+          final JInternalFrame frame, String title, boolean makeVisible,
+          int w, int h, boolean resizable)
+  {
 
     // TODO: allow callers to determine X and Y position of frame (eg. via
     // bounds object).
@@ -662,7 +734,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
     openFrameCount++;
 
-    frame.setVisible(true);
+    frame.setVisible(makeVisible);
     frame.setClosable(true);
     frame.setResizable(resizable);
     frame.setMaximizable(resizable);
@@ -1039,7 +1111,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
     cap.setForInput(viewport);
-    Desktop.addInternalFrame(cap, MessageManager.getString("label.cut_paste_alignmen_file"), 600, 500);
+    Desktop.addInternalFrame(cap,
+            MessageManager.getString("label.cut_paste_alignmen_file"),
+            true, 600, 500);
   }
 
   /*
@@ -2580,7 +2654,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
                                                 + ermsg
                                                 + "</td></tr></table>"
                                                 + "<p>It may be that you have invalid JABA URLs<br/>in your web service preferences,"
-                                                + " or mis-configured HTTP proxy settings.</p>"
+                                                + "<br>or as a command-line argument, or mis-configured HTTP proxy settings.</p>"
                                                 + "<p>Check the <em>Connections</em> and <em>Web services</em> tab<br/>of the"
                                                 + " Tools->Preferences dialog box to change them.</p></html>"),
                                 "Web Service Configuration Problem",