de.cau.cs.kieler.sim.kiem.config.managers
Class AbstractManager

java.lang.Object
  extended by de.cau.cs.kieler.sim.kiem.config.managers.AbstractManager
Direct Known Subclasses:
ConfigurationManager, ContributionManager, EditorManager, PropertyUsageManager, ScheduleManager

public abstract class AbstractManager
extends Object

Abstract super class for all manager classes in this package.

It provides methods for other classes to register as listeners to any manager. The implementing subclasses can dispatch events and inform listeners of events occurring.

It also provides a means for the subclasses to load and save Strings in the Eclipse Preference Store.

Rating proposed yellow
(2010-01-27)

Constructor Summary
AbstractManager()
          Creates a new AbstractManager.
 
Method Summary
 void addEventListener(IKiemConfigEventListener listener)
          Adds a new listener to this manager.
abstract  void load()
          Load the saved data from the plugin's preference store.
protected  String load(String key, String defaultValue)
          Load a value from the Eclipse Preference Store.
protected  void notifyListeners(KiemConfigEvent event)
          Notify all listeners of an event in the manager.
protected  void remove(String key)
          Remove everything saved under this node.
 void removeEventListener(IKiemConfigEventListener listener)
          Remove a listener from the list of listeners.
abstract  void save()
          Saves the data inside the manager into the plugin's preference store.
protected  void save(String key, String value)
          Save a key,value pair to the Eclipse Preference Store.
static void saveAll()
          Save all managers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractManager

public AbstractManager()
Creates a new AbstractManager.

Method Detail

saveAll

public static void saveAll()
Save all managers.


addEventListener

public void addEventListener(IKiemConfigEventListener listener)
Adds a new listener to this manager.

Parameters:
listener - the new listener.

removeEventListener

public void removeEventListener(IKiemConfigEventListener listener)
Remove a listener from the list of listeners.

Parameters:
listener - the listener to be removed.

notifyListeners

protected void notifyListeners(KiemConfigEvent event)
Notify all listeners of an event in the manager.

Parameters:
event - the event

load

protected String load(String key,
                      String defaultValue)
Load a value from the Eclipse Preference Store.

Parameters:
key - the key of the value to load
defaultValue - the default value for the property
Returns:
the value loaded value if any

remove

protected void remove(String key)
Remove everything saved under this node.

Parameters:
key - the key to remove

save

protected void save(String key,
                    String value)
Save a key,value pair to the Eclipse Preference Store.

Parameters:
key - the key under which to save
value - the value to save

load

public abstract void load()
Load the saved data from the plugin's preference store. Usually not necessary as data is loaded on demand.


save

public abstract void save()
Saves the data inside the manager into the plugin's preference store.