Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsanchez2011-09-14 21:43:34 +0000
committerrsanchez2011-09-14 21:43:34 +0000
commit857bc90fd4c4ac94c8954fab1f7810b7e8309fab (patch)
treee0cfee18d10e94ee055884fa9b1b9e03d7d01299
parent9e925e0bb6afd4d13563481f292e5a53fdde221c (diff)
downloadwebtools.common-857bc90fd4c4ac94c8954fab1f7810b7e8309fab.tar.gz
webtools.common-857bc90fd4c4ac94c8954fab1f7810b7e8309fab.tar.xz
webtools.common-857bc90fd4c4ac94c8954fab1f7810b7e8309fab.zip
[356835] Enhance Dependency Page to allow customized Pages through extension points
-rw-r--r--plugins/org.eclipse.jst.common.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.wst.common.modulecore.ui/schema/moduleDependencyPropertyPage.exsd15
-rw-r--r--plugins/org.eclipse.wst.common.modulecore.ui/src/org/eclipse/wst/common/componentcore/ui/internal/propertypage/DependencyPageExtensionManager.java33
3 files changed, 43 insertions, 8 deletions
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 9beb77923..a33b5fef4 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 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
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,
+ org.eclipse.jst.common.ui.internal.assembly.wizard
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 7562a68b0..df32f3e3e 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 c05df3d05..01dd45217 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.componentcore.ui.propertypage.IDependencyPageProvi
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 @@ public class DependencyPageExtensionManager {
}
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 @@ public class DependencyPageExtensionManager {
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() {

Back to the top