X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCache.java;h=e0edae889d5fda04929e41aac50ccf0b6e712678;hb=180faccf15c5358f8e456a98d63ccf4d50aef376;hp=b054bc32bd0f276e8464fc45815a7631fb2b9965;hpb=1ecf6419aba86993b3c223bf5ec0fa79427baf85;p=jalview.git diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index b054bc3..e0edae8 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1,15 +1,71 @@ -/******************** - * 2004 Jalview Reengineered - * Barton Group - * Dundee University - * - * AM Waterhouse - *******************/ - - -package jalview.bin; - -public class Cache -{ - public static String LAST_DIRECTORY = "."; -} +/******************** + * 2004 Jalview Reengineered + * Barton Group + * Dundee University + * + * AM Waterhouse + *******************/ + + +package jalview.bin; +import java.util.*; +import java.io.*; + +public class Cache +{ + public static Properties applicationProperties; + // Current properties include: + // + // LAST_DIRECTORY , use this to cache record of where the user looked to find a file + // UNIPROT_CACHE + // USER_DEFINED_COLOUR - file describing last user set colours + // FONT_NAME + // FONT_STYLE + // FONT_SIZE + + + public static void loadProperties() + { + applicationProperties = new Properties(); + + try + { + FileInputStream in = new FileInputStream(System.getProperty("user.home") + + "/.jalview_properties"); + applicationProperties = new Properties(); + applicationProperties.load(in); + in.close(); + } + catch (Exception ex) + { } + } + + public static String getProperty(String key) + { + return applicationProperties.getProperty(key); + } + + public static String setProperty(String key, String obj) + { + try + { + FileOutputStream out = new FileOutputStream(System.getProperty( + "user.home") + "/.jalview_properties"); + + applicationProperties.setProperty(key, obj); + + applicationProperties.store(out, "---JalviewX Properties File---"); + out.close(); + } + catch (Exception ex) + {} + + return obj; + + } + + + + + +}