From ccbd3e0bfd34533d8e98b7ef9a6cb48d9684b3da Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Wed, 6 Dec 2017 16:03:34 +0000 Subject: [PATCH] JAL-2871 Added check whether configuration has been loaded in --- resources/lang/Messages.properties | 1 + src/jalview/ext/archaeopteryx/AptxInit.java | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 02375a4..b0d4b68 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -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 diff --git a/src/jalview/ext/archaeopteryx/AptxInit.java b/src/jalview/ext/archaeopteryx/AptxInit.java index da9e348..b9a2266 100644 --- a/src/jalview/ext/archaeopteryx/AptxInit.java +++ b/src/jalview/ext/archaeopteryx/AptxInit.java @@ -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() + { + } } -- 1.7.10.2