1 33 34 package edu.rice.cs.drjava.config; 35 36 import edu.rice.cs.util.swing.Utilities; 37 38 41 public class Configuration { 42 43 44 protected OptionMap map; 45 46 49 protected Exception _startupException; 50 51 54 public Configuration(OptionMap om) { 55 map = om; 56 _startupException = null; 57 } 58 59 63 public <T> T setSetting(final Option<T> op, final T value) { 64 T ret = map.setOption(op, value); 65 Utilities.invokeLater(new Runnable () { public void run() { op.notifyListeners(Configuration.this, value); } }); 66 return ret; 67 } 68 69 70 public <T> T getSetting(Option<T> op) { return map.getOption(op); } 71 72 76 public <T> void addOptionListener(Option<T> op, OptionListener<T> l) { op.addListener(this,l); } 77 78 79 public <T> void removeOptionListener(Option<T> op, OptionListener<T> l) { op.removeListener(this,l); } 80 81 82 public void resetToDefaults() { OptionMapLoader.DEFAULT.loadInto(map); } 83 84 85 public boolean hadStartupException() { return _startupException != null; } 86 87 88 public Exception getStartupException() { return _startupException; } 89 90 93 public void storeStartupException(Exception e) { _startupException = e; } 94 95 96 public String toString() { return map.toString(); } 97 } 98 | Popular Tags |