From 310f8725761c11d85f690f98f0bb3e49e1d4709a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 5 Jun 2015 15:51:07 +0100 Subject: [PATCH] JAL-1588 error dialog if Chimera project opened on a m/c w/o Chimera --- resources/lang/Messages.properties | 1 + src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java | 2 ++ src/jalview/gui/ChimeraViewFrame.java | 12 +++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 1fbdc37..0cd43c2 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -258,6 +258,7 @@ label.chimera_path = Path to Chimera program label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.
Double-click to browse for file. label.invalid_chimera_path = Chimera path not found or not executable label.chimera_missing = Chimera structure viewer not found.
Please enter the path to Chimera (if installed),
or download and install UCSF Chimera. +label.chimera_failed = Error opening Chimera - is it installed?\nCheck path in Preferences, Structure label.min_colour = Minimum Colour label.max_colour = Maximum Colour label.use_original_colours = Use Original Colours diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java index 80c8df5..b66778c 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java @@ -554,6 +554,8 @@ public class ChimeraManager for (String chimeraPath : chimeraPaths) { File path = new File(chimeraPath); + // enable the next line to simulate Chimera not installed + // File path = new File(chimeraPath + "x"); if (!path.canExecute()) { error += "File '" + path + "' does not exist.\n"; diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 1915936..b933345 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -599,7 +599,17 @@ public class ChimeraViewFrame extends StructureViewerBase jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle("Chimera", true), getBounds().width, getBounds().height); - jmb.launchChimera(); + if (!jmb.launchChimera()) + { + JOptionPane + .showMessageDialog( + Desktop.desktop, + MessageManager.getString("label.chimera_failed"), + MessageManager.getString("label.error_loading_file"), + JOptionPane.ERROR_MESSAGE); + this.dispose(); + return; + } if (this.chimeraSessionFile != null) { -- 1.7.10.2