JAL-2871 Added check whether configuration has been loaded in
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 6 Dec 2017 16:03:34 +0000 (16:03 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 6 Dec 2017 16:03:34 +0000 (16:03 +0000)
resources/lang/Messages.properties
src/jalview/ext/archaeopteryx/AptxInit.java

index 02375a4..b0d4b68 100644 (file)
@@ -395,6 +395,7 @@ label.sequences_selection_not_aligned = Sequences in selection are not aligned
 label.problem_reading_tree_file =  Problem reading tree file
 label.tabs_detected_archaeopteryx = Warning, multiple trees detected in a single tree viewer instance. This will cause problems!
 label.possible_problem_with_tree_file = Possible problem with tree file
+label.aptx_config_not_found = Warning: tree viewer configuration file not found, continue anyway? (this WILL cause the viewer to look different)
 label.tree_url_example = Please enter a complete URL, for example \"http://www.jalview.org/examples/ferredoxin.nw\"
 label.from_database = From Database...
 label.load_tree_url = Tree from URL
index da9e348..b9a2266 100644 (file)
@@ -46,9 +46,9 @@ import org.forester.util.ForesterUtil;
  */
 public final class AptxInit
 {
-
   private final static Configuration APTX_CONFIG = new Configuration(
-          "_aptx_jalview_configuration_file", false, false, false);
+          "_aptx_jalview_configuration_file",
+            false, false, false);
 
   private final static boolean VALIDATE_PHYLOXML_XSD = APTX_CONFIG
           .isValidatePhyloXmlAgainstSchema();
@@ -470,6 +470,23 @@ public final class AptxInit
           final Phylogeny aptxTree,
           final AlignmentViewport jalviewAlignport, String treeTitle)
   {
+    if (APTX_CONFIG == null || APTX_CONFIG.isCouldReadConfigFile() == false)
+    {
+      int keepGoing = JvOptionPane.showConfirmDialog(Desktop.desktop,
+              MessageManager.getString("label.aptx_config_not_found"),
+              MessageManager.formatMessage("label.couldnt_locate",
+                      new String[]
+                      { "_aptx_jalview_configuration_file" }),
+              JvOptionPane.YES_NO_CANCEL_OPTION);
+
+      if (keepGoing == JvOptionPane.CANCEL_OPTION
+              || keepGoing == JvOptionPane.CLOSED_OPTION
+              || keepGoing == JvOptionPane.NO_OPTION)
+      {
+        return null;
+      }
+
+    }
     MainFrame aptxApp = Archaeopteryx.createApplication(aptxTree,
             APTX_CONFIG, treeTitle);
 
@@ -528,5 +545,8 @@ public final class AptxInit
     return activeAptx;
   }
 
+  private static void disableRedundantGuiMenus()
+  {
 
+  }
 }