*/
package jalview.gui;
-
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import jalview.util.FileUtils;
import ext.edu.ucsf.rbvi.strucviz2.StructureManager;
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.bin.Cache;
+import jalview.bin.Console;
+import jalview.bin.MemorySetting;
import jalview.ext.pymol.PymolManager;
import jalview.gui.Help.HelpId;
import jalview.gui.StructureViewer.ViewerType;
* @author $author$
* @version $Revision$
*/
-
public class Preferences extends GPreferences implements ApplicationSingletonI
{
// suggested list delimiter character
public static final String PAD_GAPS = "PAD_GAPS";
public static final String PDB_DOWNLOAD_FORMAT = "PDB_DOWNLOAD_FORMAT";
-
public static final String PYMOL_PATH = "PYMOL_PATH";
public static final String QUESTIONNAIRE = "QUESTIONNAIRE";
private String previousProxyType;
private static Preferences INSTANCE = null; // add "final"
+
/**
* Holds name and link separated with | character. Sequence ID must be
* $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
this.setMessage(message);
this.frame.show();
}
+
/**
* Creates a new Preferences object.
*/
addSecondaryStructure.setEnabled(structSelected);
addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, true));
addTempFactor.setEnabled(structSelected);
+
/*
* set choice of structure viewer, and path if saved as a preference;
* default to Jmol (first choice) if an unexpected value is found
}
} catch (IllegalArgumentException e)
{
- Cache.log.error("Unknown structure viewer type: " + viewerType
+ Console.error("Unknown structure viewer type: " + viewerType
+ ", defaulting to Jmol");
type = ViewerType.JMOL;
}
if (validateViewerPath())
{
String path = structureViewerPath.getText();
- try {
- ViewerType type = ViewerType.valueOf(viewerType);
- switch (type)
+ try
+ {
+ ViewerType type = ViewerType.valueOf(viewerType);
+ switch (type)
+ {
+ case JMOL:
+ break;
+ case CHIMERA:
+ Cache.setProperty(CHIMERA_PATH, path);
+ break;
+ case CHIMERAX:
+ Cache.setProperty(CHIMERAX_PATH, path);
+ break;
+ case PYMOL:
+ Cache.setProperty(PYMOL_PATH, path);
+ break;
+ }
+ } catch (IllegalArgumentException x)
{
- case JMOL:
- break;
- case CHIMERA:
- Cache.setProperty(CHIMERA_PATH, path);
- break;
- case CHIMERAX:
- Cache.setProperty(CHIMERAX_PATH, path);
- break;
- case PYMOL:
- Cache.setProperty(PYMOL_PATH, path);
- break;
+ Console.error("Failed to set path - unknown viewer type", x);
}
- } catch (IllegalArgumentException x)
- {
- Cache.log.error("Failed to set path - unknown viewer type",x);
- }
}
}
});
proxyType.setSelected(customProxy.getModel(), true);
break;
default:
- Cache.log.warn(
+ Console.warn(
"Incorrect PROXY_TYPE - should be 'none' (clear proxy properties), 'false' (system settings), 'true' (custom settings): "
+ proxyTypeString);
}
annotations_actionPerformed(null); // update the display of the annotation
// settings
+
/*
comboBox.addItem(promptEachTimeOpt);
comboBox.addItem(lineArtOpt);
comboBox.addItem(textOpt);
+
/*
* JalviewJS doesn't support Lineart so force it to Text
* Set proxy settings first (to be before web services refresh)
*/
saveProxySettings();
+
/*
* Save Visual settings
*/
Cache.setPropertyNoSave(BackupFiles.ENABLED,
Boolean.toString(enableBackupFiles.isSelected()));
int preset = getComboIntStringKey(backupfilesPresetsCombo);
- Cache.applicationProperties.setProperty(BackupFiles.NS + "_PRESET", Integer.toString(preset));
+ Cache.setPropertyNoSave(BackupFiles.NS + "_PRESET", Integer.toString(preset));
if (preset == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
{
BackupFilesPresetEntry customBFPE = getBackupfilesCurrentEntry();
BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, customBFPE);
- Cache.applicationProperties
- .setProperty(BackupFilesPresetEntry.CUSTOMCONFIG,
+ Cache.setPropertyNoSave(BackupFilesPresetEntry.CUSTOMCONFIG,
customBFPE.toString());
}
Cache.setPropertyNoSave(
BackupFilesPresetEntry.SAVEDCONFIG, savedBFPE.toString());
+ /*
+ * Save Memory Settings
+ */
+ Cache.setPropertyNoSave(
+ MemorySetting.CUSTOMISED_SETTINGS,
+ Boolean.toString(customiseMemorySetting.isSelected()));
+ Cache.setPropertyNoSave(MemorySetting.MEMORY_JVMMEMPC,
+ Integer.toString(jvmMemoryPercentSlider.getValue()));
+ Cache.setPropertyNoSave(MemorySetting.MEMORY_JVMMEMMAX,
+ jvmMemoryMaxTextField.getText());
+
+ /*
+ * save and close Preferences
+ */
Cache.saveProperties();
Desktop.getInstance().doConfigureStructurePrefs();
try
{
}
}
+
public void saveProxySettings()
{
String newProxyType = customProxy.isSelected() ? Cache.PROXYTYPE_CUSTOM
|| !newProxyType.equals(previousProxyType))
{
// force a re-lookup of ws if proxytype is custom or has changed
- wsPrefs.update++;
+ wsPrefs.refreshWs_actionPerformed(null);
}
previousProxyType = newProxyType;
}
if (index == -1)
{
// button no longer enabled if row is not selected
- Cache.log.debug("Edit with no row selected in linkUrlTable");
+ Console.debug("Edit with no row selected in linkUrlTable");
return;
}
if (index == -1)
{
// button no longer enabled if row is not selected
- Cache.log.debug("Delete with no row selected in linkUrlTable");
+ Console.debug("Delete with no row selected in linkUrlTable");
return;
}
else
break;
}
}
+
if (!found)
{
String[] options = { "OK", "Help" };
MessageManager.getString("label.viewer_missing")),
"", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
null, options, options[0]);
+
if (showHelp == JvOptionPane.NO_OPTION)
{
this.selectTab(Preferences.TabRef.STRUCTURE_TAB, null);