label.autoadd_secstr = Add secondary structure annotation to alignment
label.autoadd_temp = Add Temperature Factor annotation to alignment
label.structure_viewer = Default structure viewer
+label.chimera_path = Path to Chimera program
+label.chimera_path_tip = Jalview will try standard locations, plus any path entered here.
+label.invalid_path = File not found or not executable
label.min_colour = Minimum Colour
label.max_colour = Maximum Colour
label.use_original_colours = Use Original Colours
package ext.edu.ucsf.rbvi.strucviz2;
+import jalview.bin.Cache;
+import jalview.gui.Preferences;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
static final String[] defaultResidueKeys =
{ "FunctionalResidues", "ResidueList", "Residues" };
- private final String chimeraPropertyName = "chimera";
-
- private final String chimeraPathPropertyKey = "LastChimeraPath";
-
public enum ModelType
{
PDB_MODEL, MODBASE_MODEL, SMILES
// we do not care about the model anymore
selSpec = selSpec.concat(nodeInfo.toSpec());
if (i < chimSelectionList.size() - 1)
+ {
selSpec.concat("|");
+ }
}
if (selSpec.length() > 0)
{
for (ChimeraStructuralObject cso : chimSelectionList)
{
if (cso != null)
+ {
cso.setSelected(false);
+ }
}
chimSelectionList.clear();
}
}
}
- // if no network settings, check if the last chimera path is saved in the
- // session
- // String lastPath = CytoUtils.getDefaultChimeraPath(registrar,
- // chimeraPropertyName,
- // chimeraPathPropertyKey);
- // if (lastPath != null && !lastPath.equals("")) {
- // pathList.add(lastPath);
- // return pathList;
- // }
+ /*
+ * Jalview addition: check if path set in user preferences.
+ */
+ String userPath = Cache.getDefault(Preferences.CHIMERA_PATH, null);
+ if (userPath != null)
+ {
+ pathList.add(userPath);
+ }
- // if no user settings and no last path, get default system's settings
+ // Add default installation paths
String os = System.getProperty("os.name");
if (os.startsWith("Linux"))
{
* display</li>
* <li>STRUCTURE_DISPLAY choose from JMOL (default) or CHIMERA for 3D structure
* display</li>
+ * <li>CHIMERA_PATH specify full path to Chimera program (if non-standard)</li>
*
* </ul>
* Deprecated settings:
}
return sourceRegistry;
}
+
+ /**
+ * Set the specified value, or remove it if null or empty. Does not save the
+ * properties file.
+ *
+ * @param propName
+ * @param value
+ */
+ public static void setOrRemove(String propName, String value)
+ {
+ if (propName == null)
+ {
+ return;
+ }
+ if (value == null || value.trim().length() < 1)
+ {
+ Cache.applicationProperties.remove(propName);
+ }
+ else
+ {
+ Cache.applicationProperties.setProperty(propName, value);
+ }
+ }
}
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
+import java.io.File;
import java.util.Collection;
import java.util.StringTokenizer;
import java.util.Vector;
public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
+ public static final String CHIMERA_PATH = "CHIMERA_PATH";
+
public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
addTempFactor.setEnabled(structSelected);
structViewer.setSelectedItem(Cache.getDefault(STRUCTURE_DISPLAY,
Viewer.JMOL.name()));
+ chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
+ chimeraPath.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ if (chimeraPath.getText().trim().length() > 0)
+ {
+ File f = new File(chimeraPath.getText());
+ if (!f.canExecute())
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.invalid_path"),
+ MessageManager.getString("label.invalid_name"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ });
/*
* Set Connections tab defaults
Boolean.toString(structFromPdb.isSelected()));
Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY, structViewer
.getSelectedItem().toString());
+ Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
/*
* Save Output settings
/*
* Save Connections settings
*/
- if (defaultBrowser.getText().trim().length() < 1)
- {
- Cache.applicationProperties.remove("DEFAULT_BROWSER");
- }
- else
- {
- Cache.applicationProperties.setProperty("DEFAULT_BROWSER",
- defaultBrowser.getText());
- }
+ Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
jalview.util.BrowserLauncher.resetBrowser();
Cache.applicationProperties.setProperty("USE_PROXY",
Boolean.toString(useProxy.isSelected()));
- if (proxyServerTB.getText().trim().length() < 1)
- {
- Cache.applicationProperties.remove("PROXY_SERVER");
- }
- else
- {
- Cache.applicationProperties.setProperty("PROXY_SERVER",
- proxyServerTB.getText());
- }
+ Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
- if (proxyPortTB.getText().trim().length() < 1)
- {
- Cache.applicationProperties.remove("PROXY_PORT");
- }
- else
- {
- Cache.applicationProperties.setProperty("PROXY_PORT",
- proxyPortTB.getText());
- }
+ Cache.setOrRemove("PROXY_PORT", proxyPortTB.getText());
if (useProxy.isSelected())
{
protected JComboBox<String> structViewer = new JComboBox<String>();
+ protected JTextField chimeraPath = new JTextField();
+
/*
* Colours tab components
*/
structureTab.add(viewerLabel);
structViewer.setFont(verdana11);
- structViewer.setBounds(new Rectangle(150, ypos, 120, height));
+ structViewer.setBounds(new Rectangle(160, ypos, 120, height));
structViewer.addItem(Viewer.JMOL.name());
structViewer.addItem(Viewer.CHIMERA.name());
structureTab.add(structViewer);
+ ypos += lineSpacing;
+ JLabel pathLabel = new JLabel();
+ pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
+ pathLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ pathLabel.setText(MessageManager.getString("label.chimera_path"));
+ pathLabel.setToolTipText(MessageManager
+ .getString("label.chimera_path_tip"));
+ pathLabel.setBounds(new Rectangle(10, ypos, 140, height));
+ structureTab.add(pathLabel);
+
+ chimeraPath.setFont(verdana11);
+ chimeraPath.setText("");
+ chimeraPath.setBounds(new Rectangle(160, ypos, 300, height));
+ structureTab.add(chimeraPath);
+
return structureTab;
}