*/
package jalview.bin;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.datamodel.PDBEntry;
-import jalview.gui.UserDefinedColours;
+import jalview.gui.Preferences;
import jalview.schemes.ColourSchemeLoader;
import jalview.schemes.ColourSchemes;
import jalview.schemes.UserColourScheme;
* @author $author$
* @version $Revision$
*/
-public class Cache
+public class Cache implements ApplicationSingletonI
{
private Cache()
*/
private static Cache getInstance()
{
- Instance i = Instance.getInstance();
- return (i.cache == null ? i.cache = new Cache() : i.cache);
+ return (Cache) ApplicationSingletonProvider.getInstance(Cache.class);
}
/**
};
/** Default file is ~/.jalview_properties */
- // BH 2019.05.07 note: Instances of Jalview will share this file.
- static String propertiesFile;
+ private String propertiesFile;
/**
* flag to possibly allow properties to be written to a property file
setProperty("VERSION", codeVersion);
// LOAD USERDEFINED COLOURS
- initUserColourSchemes(getProperty("USER_DEFINED_COLOURS"));
+ initUserColourSchemes(getProperty(Preferences.USER_DEFINED_COLOURS));
}
private void deleteBuildProperties()
*/
public static String getProperty(String key)
{
- return getInstance().getPropertyImpl(key);
- }
-
- private String getPropertyImpl(String key)
- {
- String prop = applicationProperties.getProperty(key);
- if (prop == null && Platform.isJS())
- {
- prop = applicationProperties.getProperty(Platform.getUniqueAppletID()
- + "_" + JS_PROPERTY_PREFIX + key);
- }
- return prop;
+ return getInstance().applicationProperties.getProperty(key);
}
/**
{
if (coloursFound.toString().length() > 1)
{
- setProperty(UserDefinedColours.USER_DEFINED_COLOURS,
+ setProperty(Preferences.USER_DEFINED_COLOURS,
coloursFound.toString());
}
else
{
getInstance().applicationProperties
- .remove(UserDefinedColours.USER_DEFINED_COLOURS);
+ .remove(Preferences.USER_DEFINED_COLOURS);
}
}
}