1) Fixed issue #776.
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / config / ConfigurationManager.java
index 2b23dea..8c75aac 100644 (file)
@@ -4,7 +4,7 @@
  * 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
  **********************************************************************/
@@ -20,21 +20,26 @@ import java.util.Map;
 import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
 
 import org.eclipse.core.runtime.Preferences;
+
 /**
- *
+ * 
  */
 public class ConfigurationManager {
        private static final int ADD = 0;
+
        private static final int CHANGE = 1;
+
        private static final int REMOVE = 2;
 
        // configurations
        protected List configurations;
+
        protected Map threads = new HashMap();
 
        protected List configurationListeners = new ArrayList();
 
        private Preferences.IPropertyChangeListener pcl;
+
        protected boolean ignorePreferenceChanges = false;
 
        protected static ConfigurationManager instance;
@@ -59,11 +64,13 @@ public class ConfigurationManager {
                        }
                };
 
-               PHPHelpPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(pcl);
+               PHPHelpPlugin.getDefault().getPluginPreferences()
+                               .addPropertyChangeListener(pcl);
        }
 
        protected void dispose() {
-               PHPHelpPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(pcl);
+               PHPHelpPlugin.getDefault().getPluginPreferences()
+                               .removePropertyChangeListener(pcl);
        }
 
        public IConfigurationWorkingCopy createConfiguration() {
@@ -98,7 +105,7 @@ public class ConfigurationManager {
 
        /**
         * Add monitor listener.
-        *
+        * 
         * @param listener
         */
        public void addConfigurationListener(IConfigurationListener listener) {
@@ -107,7 +114,7 @@ public class ConfigurationManager {
 
        /**
         * Remove monitor listener.
-        *
+        * 
         * @param listener
         */
        public void removeConfigurationListener(IConfigurationListener listener) {
@@ -116,6 +123,7 @@ public class ConfigurationManager {
 
        /**
         * Fire a monitor event.
+        * 
         * @param rr
         * @param fType
         */
@@ -134,17 +142,16 @@ public class ConfigurationManager {
                }
        }
 
-
-
-
        protected void loadConfigurations() {
 
                configurations = new ArrayList();
                Preferences prefs = PHPHelpPlugin.getDefault().getPluginPreferences();
-               String xmlString = prefs.getString(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
+               String xmlString = prefs
+                               .getString(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
                if (xmlString != null && xmlString.length() > 0) {
                        try {
-                               ByteArrayInputStream in = new ByteArrayInputStream(xmlString.getBytes());
+                               ByteArrayInputStream in = new ByteArrayInputStream(xmlString
+                                               .getBytes());
                                IMemento memento = XMLMemento.loadMemento(in);
 
                                IMemento[] children = memento.getChildren("config");
@@ -164,7 +171,8 @@ public class ConfigurationManager {
        protected void saveConfigurations() {
                try {
                        ignorePreferenceChanges = true;
-                       XMLMemento memento = XMLMemento.createWriteRoot(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
+                       XMLMemento memento = XMLMemento
+                                       .createWriteRoot(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS);
 
                        Iterator iterator = configurations.iterator();
                        while (iterator.hasNext()) {
@@ -174,7 +182,8 @@ public class ConfigurationManager {
                        }
 
                        String xmlString = memento.saveToString();
-                       Preferences prefs = PHPHelpPlugin.getDefault().getPluginPreferences();
+                       Preferences prefs = PHPHelpPlugin.getDefault()
+                                       .getPluginPreferences();
                        prefs.setValue(PHPHelpPlugin.PREF_STRING_CONFIGURATIONS, xmlString);
                        PHPHelpPlugin.getDefault().savePluginPreferences();
                } catch (Exception e) {