* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+�*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
protected List configurations;
protected Map threads = new HashMap();
- protected List monitorListeners = new ArrayList();
+ protected List configurationListeners = new ArrayList();
private Preferences.IPropertyChangeListener pcl;
protected boolean ignorePreferenceChanges = false;
if (ignorePreferenceChanges)
return;
String property = event.getProperty();
- if (property.equals("configurations")) {
+ if (property.equals(WikiEditorPlugin.PREF_STRING_CONFIGURATIONS)) {
loadConfigurations();
}
}
* @param listener
*/
public void addConfigurationListener(IConfigurationListener listener) {
- monitorListeners.add(listener);
+ configurationListeners.add(listener);
}
/**
* @param listener
*/
public void removeConfigurationListener(IConfigurationListener listener) {
- monitorListeners.remove(listener);
+ configurationListeners.remove(listener);
}
/**
* @param rr
* @param fType
*/
- protected void fireConfigurationEvent(IConfiguration monitor, int type) {
- Object[] obj = monitorListeners.toArray();
+ protected void fireConfigurationEvent(IConfiguration configuration, int type) {
+ Object[] obj = configurationListeners.toArray();
int size = obj.length;
for (int i = 0; i < size; i++) {
IConfigurationListener listener = (IConfigurationListener) obj[i];
if (type == ADD)
- listener.monitorAdded(monitor);
+ listener.configurationAdded(configuration);
else if (type == CHANGE)
- listener.monitorChanged(monitor);
+ listener.configurationChanged(configuration);
else if (type == REMOVE)
- listener.monitorRemoved(monitor);
+ listener.configurationRemoved(configuration);
}
}
configurations = new ArrayList();
Preferences prefs = WikiEditorPlugin.getDefault().getPluginPreferences();
- String xmlString = prefs.getString("configurations");
+ String xmlString = prefs.getString(WikiEditorPlugin.PREF_STRING_CONFIGURATIONS);
if (xmlString != null && xmlString.length() > 0) {
try {
ByteArrayInputStream in = new ByteArrayInputStream(xmlString.getBytes());
if (children != null) {
int size = children.length;
for (int i = 0; i < size; i++) {
- Configuration monitor = new Configuration();
- monitor.load(children[i]);
- configurations.add(monitor);
+ Configuration configuration = new ConfigurationWorkingCopy();
+ configuration.load(children[i]);
+ configurations.add(configuration);
}
}
} catch (Exception e) {
protected void saveConfigurations() {
try {
ignorePreferenceChanges = true;
- XMLMemento memento = XMLMemento.createWriteRoot("configurations");
+ XMLMemento memento = XMLMemento.createWriteRoot(WikiEditorPlugin.PREF_STRING_CONFIGURATIONS);
Iterator iterator = configurations.iterator();
while (iterator.hasNext()) {
String xmlString = memento.saveToString();
Preferences prefs = WikiEditorPlugin.getDefault().getPluginPreferences();
- prefs.setValue("configurations", xmlString);
+ prefs.setValue(WikiEditorPlugin.PREF_STRING_CONFIGURATIONS, xmlString);
WikiEditorPlugin.getDefault().savePluginPreferences();
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Could not save Configurations", e);