bug 324927 handle changes of existing plug-in projects within the
ConfigurationRegistry

Signed-off-by: Florian Thienel <florian@thienel.org>
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigPlugin.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigPlugin.java
index 4d759c0..b6912e5 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigPlugin.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigPlugin.java
@@ -27,9 +27,9 @@
 
 	private String bundleSymbolicName;
 	
-	protected ConfigPlugin(String bundleSymbolicName) {
+	public ConfigPlugin(String bundleSymbolicName) {
+		super(bundleSymbolicName);
 		this.bundleSymbolicName = bundleSymbolicName;
-		setUniqueIdentifer(bundleSymbolicName);
 		load();
 	}
 
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java
index b5c9826..a428b3e 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigSource.java
@@ -49,6 +49,10 @@
 				return factory;
 		return null;
 	}
+	
+	public ConfigSource(final String id) {
+		this.id = id;
+	}
 
 	/**
 	 * Adds the given item to the configuration.
@@ -200,16 +204,6 @@
 	}
 
 	/**
-	 * Sets the unique identifier of this configuration.
-	 * 
-	 * @param id
-	 *            New identifier for this configuration.
-	 */
-	protected void setUniqueIdentifer(final String id) {
-		this.id = id;
-	}
-	
-	/**
 	 * Returns all ConfigItems of the given type for which isValid returns true.
 	 * 
 	 * @param extensionPointId
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java
index 8e39866..72ceaca 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/ConfigurationRegistryImpl.java
@@ -57,7 +57,7 @@
 	private final ConfigurationLoader loader;
 	private volatile boolean loaded = false;
 
-	public ConfigurationRegistryImpl(ConfigurationLoader loader) {
+	public ConfigurationRegistryImpl(final ConfigurationLoader loader) {
 		this.loader = loader;
 		ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener);
 	}
@@ -113,6 +113,12 @@
 		}
 	}
 
+	private PluginProject addNewPluginProject(final IProject project) {
+		final PluginProject result = new PluginProject(project);
+		addConfigSource(result);
+		return result;
+	}
+
 	private void addConfigSource(final ConfigSource configSource) {
 		waitUntilLoaded();
 		lock();
@@ -297,6 +303,15 @@
 			}
 		return null;
 	}
+	
+	private void reloadPluginProject(final PluginProject pluginProject) {
+		try {
+			pluginProject.load();
+		} catch (final CoreException e) {
+			VexPlugin.getInstance().getLog().log(e.getStatus());
+		}
+		fireConfigChanged(new ConfigEvent(this));
+	}
 
 	// ======================================================== PRIVATE
 
@@ -323,22 +338,16 @@
 							// we know this project and it has been closed
 							removeConfigSource(pluginProject);
 							fireConfigChanged(new ConfigEvent(this));
-						} else if (PluginProject.isOpenPluginProject(project) && pluginProject == null) {
-							// this is a plug-in project we do not know yet
-							final PluginProject newPluginProject = new PluginProject(project);
-							try {
-								newPluginProject.load();
-								addConfigSource(newPluginProject);
-								fireConfigChanged(new ConfigEvent(this));
-							} catch (CoreException e) {
-								VexPlugin.getInstance().getLog().log(e.getStatus());
+						} else if (PluginProject.isOpenPluginProject(project))
+							if (pluginProject == null) {
+								reloadPluginProject(addNewPluginProject(project));
+							} else {
+								reloadPluginProject(pluginProject);
 							}
-						} else {
-							// nothing to do
-						}
 					}
 			}
 		}
+
 	};
 
 }
diff --git a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/PluginProject.java b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/PluginProject.java
index 4a69858..83f57f4 100644
--- a/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/PluginProject.java
+++ b/sourceediting/plugins/org.eclipse.wst.xml.vex.ui/src/org/eclipse/wst/xml/vex/ui/internal/config/PluginProject.java
@@ -51,15 +51,9 @@
 
 	private final IProject project;
 
-	/**
-	 * Class constructor.
-	 * 
-	 * @param config
-	 *            VexConfiguration associated with this project.
-	 */
-	protected PluginProject(final IProject project) {
+	public PluginProject(final IProject project) {
+		super(project.getName());
 		this.project = project;
-		setUniqueIdentifer(project.getName());
 	}
 
 	@Override