[357701] Enhance Dependency Page to allow customized Pages through extension points
diff --git a/plugins/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF
index be68d84..a673736 100644
--- a/plugins/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF
@@ -18,4 +18,5 @@
  org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.jst.common.ui.internal.assembly.wizard;x-internal:=true
+Export-Package: org.eclipse.jst.common.ui.internal;x-internal:=true,
+ org.eclipse.jst.common.ui.internal.assembly.wizard;x-internal:=true
diff --git a/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
index 5cd07dc..9275fc3 100644
--- a/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.modulecore.ui/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
 Bundle-Name: %Bundle-Name.0
 Bundle-Vendor: %provider
 Bundle-SymbolicName: org.eclipse.wst.common.modulecore.ui; singleton:=true
-Bundle-Version: 1.0.101.qualifier
+Bundle-Version: 1.0.102.qualifier
 Bundle-Localization: plugin
 Bundle-Activator: org.eclipse.wst.common.componentcore.ui.ModuleCoreUIPlugin
 Require-Bundle: org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
diff --git a/plugins/org.eclipse.wst.common.modulecore.ui/schema/moduleDependencyPropertyPage.exsd b/plugins/org.eclipse.wst.common.modulecore.ui/schema/moduleDependencyPropertyPage.exsd
index 7562a68..df32f3e 100644
--- a/plugins/org.eclipse.wst.common.modulecore.ui/schema/moduleDependencyPropertyPage.exsd
+++ b/plugins/org.eclipse.wst.common.modulecore.ui/schema/moduleDependencyPropertyPage.exsd
@@ -13,6 +13,7 @@
    <element name="extension">
       <annotation>
          <appinfo>
+            <meta.element />
          </appinfo>
       </annotation>
       <complexType>
@@ -43,6 +44,13 @@
                </appinfo>
             </annotation>
          </attribute>
+         <attribute name="weight" type="string">
+            <annotation>
+               <documentation>
+                  Default weight is 100. Make higher is wanting to override
+               </documentation>
+            </annotation>
+         </attribute>
       </complexType>
    </element>
 
@@ -65,6 +73,13 @@
                </appinfo>
             </annotation>
          </attribute>
+         <attribute name="weight" type="string">
+            <annotation>
+               <documentation>
+                  Default weight is 100. Make higher is wanting to override
+               </documentation>
+            </annotation>
+         </attribute>
       </complexType>
    </element>
 
diff --git a/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/DependencyPageExtensionManager.java b/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/DependencyPageExtensionManager.java
index c05df3d..01dd452 100644
--- a/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/DependencyPageExtensionManager.java
+++ b/plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/DependencyPageExtensionManager.java
@@ -40,6 +40,7 @@
 import org.eclipse.wst.common.project.facet.core.IFacetedProject;
 
 public class DependencyPageExtensionManager {
+	private static final String DEFAULT_WEIGHT = "100"; //$NON-NLS-1$
 	private static DependencyPageExtensionManager manager = null;
 	public static DependencyPageExtensionManager getManager() {
 		if( manager == null )
@@ -48,22 +49,37 @@
 	}
 	
 	private HashMap<String, IDependencyPageProvider> providers = null;
+	private HashMap<String, String> providerWeight;
 	
 	public IDependencyPageProvider getProvider(IFacetedProject project) {
 		if( providers == null )
 			loadProviders();
-		Iterator<IDependencyPageProvider> i = providers.values().iterator();
-		IDependencyPageProvider temp;
-		while(i.hasNext()) {
-			temp = i.next();
-			if( temp.canHandle(project))
-				return temp;
+		IDependencyPageProvider foundProvider = null;
+		int highestWeight = 0;
+		for (Iterator iterator = providers.keySet().iterator(); iterator.hasNext();) {
+			String id = (String) iterator.next();
+			IDependencyPageProvider temp = providers.get(id);
+			if( temp.canHandle(project)) {
+				int weight = Integer.valueOf(providerWeight.get(id)).intValue();
+				if (foundProvider == null) {
+					foundProvider = temp;
+					highestWeight = weight;
+				}
+				else {
+					if (highestWeight < weight) {
+						foundProvider = temp;
+						highestWeight = weight;
+					}
+				}
+			}
 		}
-		return null;
+		return foundProvider;
 	}
 	
 	private void loadProviders() {
 		HashMap<String, IDependencyPageProvider> temp = new HashMap<String, IDependencyPageProvider>();
+		HashMap<String, String> tempProviderWeight = new HashMap<String, String>();
+		String weight;
 		IExtensionRegistry registry = Platform.getExtensionRegistry();
 		IConfigurationElement[] cf = registry.getConfigurationElementsFor(
 				ModuleCoreUIPlugin.PLUGIN_ID, "moduleDependencyPropertyPage"); //$NON-NLS-1$
@@ -71,12 +87,15 @@
 			try {
 				temp.put(cf[i].getAttribute("id"),  //$NON-NLS-1$
 					(IDependencyPageProvider)cf[i].createExecutableExtension("class"));  //$NON-NLS-1$
+				weight = cf[i].getAttribute("weight"); //$NON-NLS-1$
+				tempProviderWeight.put(cf[i].getAttribute("id"),(weight == null) ? DEFAULT_WEIGHT : weight); //$NON-NLS-1$
 			} catch( CoreException ce ) 
 			{
 				ModuleCoreUIPlugin.log( ce );
 			}
 		}
 		providers = temp;
+		providerWeight = tempProviderWeight;
 	}
 	
 	public WizardFragment[] loadAllReferenceWizardFragments() {