jh: add extension point for CC
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml b/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml
index 13cc994..4bd5f63 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/plugin.xml
@@ -35,6 +35,7 @@
<extension-point id="CustomizedLocker" name="Customized Locker" schema="schema/CustomizedLocker.exsd"/>
<extension-point id="methodRichText" name="Method Rich Text Extension" schema="schema/methodRichText.exsd"/>
<extension-point id="methodRichTextEditor" name="Method Rich Text Editor Extension" schema="schema/methodRichTextEditor.exsd"/>
+ <extension-point id="CustomCategoryEditorPageProvider" name="Custom Category Editor Page Provider" schema="schema/CustomCategoryEditorPageProvider.exsd"/>
<extension point="org.eclipse.ui.perspectives">
<perspective
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/schema/CustomCategoryEditorPageProvider.exsd b/1.5/plugins/org.eclipse.epf.authoring.ui/schema/CustomCategoryEditorPageProvider.exsd
new file mode 100644
index 0000000..7fde0b7
--- /dev/null
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/schema/CustomCategoryEditorPageProvider.exsd
@@ -0,0 +1,128 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.epf.authoring.ui">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.epf.authoring.ui" id="EditorPageProvider" name="Editor Page Provider"/>
+ </appInfo>
+ <documentation>
+ This extension point enables a plug-in to register one or more pages in authoring editor. Though this page will only be added for method element type "custom category".
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="editorPage"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="editorPage">
+ <complexType>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.epf.authoring.ui.forms.IExtensionFormPage"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ <pre>
+ <extension
+ point="org.eclipse.epf.authoring.ui.CustomCategoryEditorPageProvider">
+ <editorPage
+ id="org.eclipse.epf.authoring.ui.CustomCategoryEstimationPage"
+ name="Estimation"
+ class="org.eclipse.epf.authoring.ui.forms.CustomCategoryEstimationPage">
+ </editorPage>
+ </extension>
+</pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java
index d6c134f..810defc 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/MethodElementEditor.java
@@ -1093,20 +1093,30 @@
if (elementObj instanceof Task) {
// check for extenstion point and add the page if there
- List<?> pageProviders = MethodEditorPageProvider.getInstance()
- .getPageProviders();
+ List<IExtensionFormPage> pageProviders = MethodEditorPageProvider.getInstance()
+ .getTaskPageProviders();
if (pageProviders != null && pageProviders.size() > 0) {
- try {
- for (int i = 0; i < pageProviders.size(); i++) {
- Object page = pageProviders.get(i);
- if (page instanceof IExtensionFormPage) {
- IExtensionFormPage formPage = (IExtensionFormPage) page;
- formPage.setEditor(this);
- }
+ for (IExtensionFormPage formPage : pageProviders) {
+ try {
+ formPage.setEditor(this);
+ } catch (Exception e) {
+ AuthoringUIPlugin.getDefault().getLogger().logError(e);
}
- } catch (Exception e) {
- AuthoringUIPlugin.getDefault().getLogger().logError(e);
+ }
+ }
+ } else if (elementObj instanceof CustomCategory) {
+ // check for extenstion point and add the page if there
+ List<IExtensionFormPage> pageProviders = MethodEditorPageProvider.getInstance()
+ .getCustomCategoryPageProviders();
+
+ if (pageProviders != null && pageProviders.size() > 0) {
+ for (IExtensionFormPage formPage : pageProviders) {
+ try {
+ formPage.setEditor(this);
+ } catch (Exception e) {
+ AuthoringUIPlugin.getDefault().getLogger().logError(e);
+ }
}
}
}
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/EditorPageElement.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/EditorPageElement.java
index bf21f53..b38afdf 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/EditorPageElement.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/EditorPageElement.java
@@ -3,6 +3,7 @@
//------------------------------------------------------------------------------
package org.eclipse.epf.authoring.ui.providers;
+import org.eclipse.epf.authoring.ui.forms.IExtensionFormPage;
import org.osgi.framework.Bundle;
@@ -69,10 +70,10 @@
*
* @return The page contributor class.
*/
- public Object getContributorClass() throws Exception {
+ public IExtensionFormPage getContributorClass() throws Exception {
Class clazz = bundle.loadClass(contributorClass);
- return clazz.newInstance();
+ return (IExtensionFormPage)clazz.newInstance();
}
}
\ No newline at end of file
diff --git a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/MethodEditorPageProvider.java b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/MethodEditorPageProvider.java
index 6cb732d..8f1bbf2 100644
--- a/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/MethodEditorPageProvider.java
+++ b/1.5/plugins/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/providers/MethodEditorPageProvider.java
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.epf.authoring.ui.AuthoringUIPlugin;
+import org.eclipse.epf.authoring.ui.forms.IExtensionFormPage;
import org.osgi.framework.Bundle;
/**
@@ -36,11 +37,17 @@
public static final String PAGE_PROVIDERS_EXTENSION_NAMESPACE = "org.eclipse.epf.authoring.ui"; //$NON-NLS-1$
/**
- * The extension name.
+ * The extension name for task pages
*/
- public static final String PAGE_PROVIDERS_EXTENSION_NAME = "TaskEditorPageProvider"; //$NON-NLS-1$
+ public static final String TASK_PAGE_PROVIDERS_EXTENSION_NAME = "TaskEditorPageProvider"; //$NON-NLS-1$
/**
+ * The extension name for custom category pages
+ */
+ public static final String CUSTOMCATEGORY_PAGE_PROVIDERS_EXTENSION_NAME = "CustomCategoryEditorPageProvider"; //$NON-NLS-1$
+
+
+ /**
* The extension Attributes
*/
public static final String PAGE_PROVIDER_EXTENSION_ATTR_ID = "id"; //$NON-NLS-1$
@@ -51,7 +58,8 @@
// Contains the editor page providers loaded via the
// "org.eclipse.epf.authoring.ui.MethodEditorPageProvider" extension point.
- private ArrayList pageProviders = new ArrayList();
+ private List<EditorPageElement> taskPageProviders = new ArrayList<EditorPageElement>();
+ private List<EditorPageElement> customCategoryPageProviders = new ArrayList<EditorPageElement>();
// The shared instance.
private static MethodEditorPageProvider instance = null;
@@ -75,16 +83,16 @@
}
/**
- * Returns all the page providers
+ * Returns all the task page providers
*
- * @return all the page providers.
+ * @return all the task page providers.
*/
- public List getPageProviders() {
- List pages = new ArrayList();
- for (int i = 0; i < pageProviders.size(); i++) {
- EditorPageElement pageElement = (EditorPageElement) pageProviders
+ public List<IExtensionFormPage> getTaskPageProviders() {
+ List<IExtensionFormPage> pages = new ArrayList<IExtensionFormPage>();
+ for (int i = 0; i < taskPageProviders.size(); i++) {
+ EditorPageElement pageElement = (EditorPageElement) taskPageProviders
.get(i);
- Object contributorClass = null;
+ IExtensionFormPage contributorClass = null;
try {
contributorClass = pageElement.getContributorClass();
} catch (Exception e) {
@@ -95,14 +103,40 @@
}
/**
+ * Returns all the custom category page providers
+ *
+ * @return all the customcategory page providers.
+ */
+ public List<IExtensionFormPage> getCustomCategoryPageProviders() {
+ List<IExtensionFormPage> pages = new ArrayList<IExtensionFormPage>();
+ for (int i = 0; i < customCategoryPageProviders.size(); i++) {
+ EditorPageElement pageElement = (EditorPageElement) customCategoryPageProviders
+ .get(i);
+ IExtensionFormPage contributorClass = null;
+ try {
+ contributorClass = pageElement.getContributorClass();
+ } catch (Exception e) {
+ }
+ pages.add(contributorClass);
+ }
+ return pages;
+ }
+
+
+ /**
* Loads the configuration providers specified via the
* "com.ibm.process.pageProviders" extension point.
*/
public void loadProviders() {
+ loadProvider(TASK_PAGE_PROVIDERS_EXTENSION_NAME, taskPageProviders);
+ loadProvider(CUSTOMCATEGORY_PAGE_PROVIDERS_EXTENSION_NAME, customCategoryPageProviders);
+ }
+
+ private void loadProvider(String extName, List<EditorPageElement> list) {
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(
PAGE_PROVIDERS_EXTENSION_NAMESPACE,
- PAGE_PROVIDERS_EXTENSION_NAME);
+ extName);
if (extensionPoint != null) {
IExtension[] extensions = extensionPoint.getExtensions();
for (int i = 0; i < extensions.length; i++) {
@@ -123,7 +157,7 @@
EditorPageElement pageElement = new EditorPageElement(
bundle, id, name, contributorClass);
- pageProviders.add(pageElement);
+ list.add(pageElement);
} catch (Exception e) {
AuthoringUIPlugin.getDefault().getLogger().logError(
@@ -132,5 +166,6 @@
}
}
}
+
}
}