aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRené Brandstetter2014-02-11 11:40:21 (EST)
committerGerrit Code Review @ Eclipse.org2014-02-13 12:03:32 (EST)
commit0e28da05588004852d2f57c5b6c1f36106342bd9 (patch)
tree648964896ae5cc6ad0343185579f9afc213686ab
parentb07e1de7fb6b4522463e119c303dac877dfeea20 (diff)
downloadeclipse.platform.ui-0e28da05588004852d2f57c5b6c1f36106342bd9.zip
eclipse.platform.ui-0e28da05588004852d2f57c5b6c1f36106342bd9.tar.gz
eclipse.platform.ui-0e28da05588004852d2f57c5b6c1f36106342bd9.tar.bz2
Bug 427790 - [Model] GenericMApplicationElementFactoryImpl starts all EMF pluginsrefs/changes/28/21828/4
Use of a special ExtensionPoint to find UI related EMF packages instead of using the generic EMF one. Change-Id: I7f1db84067340c065cebab4fa83c8039c33150f0 Signed-off-by: René Brandstetter <Rene.Brandstetter@gmx.net>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/plugin.properties1
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/plugin.xml28
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/schema/org.eclipse.e4.workbench.model.definition.enrichment.exsd105
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java18
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/EModelService.java6
5 files changed, 149 insertions, 9 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/plugin.properties b/bundles/org.eclipse.e4.ui.workbench/plugin.properties
index b78f66d..f8ca7e4 100644
--- a/bundles/org.eclipse.e4.ui.workbench/plugin.properties
+++ b/bundles/org.eclipse.e4.ui.workbench/plugin.properties
@@ -13,3 +13,4 @@ providerName = Eclipse.org
content-type.e4.name = e4 XMI
extension-point.model.name = Model extensions
+extension-point.model.definition.enrichment.name = Model definition extensions
diff --git a/bundles/org.eclipse.e4.ui.workbench/plugin.xml b/bundles/org.eclipse.e4.ui.workbench/plugin.xml
index 20b7a6d..b6f8104 100644
--- a/bundles/org.eclipse.e4.ui.workbench/plugin.xml
+++ b/bundles/org.eclipse.e4.ui.workbench/plugin.xml
@@ -2,6 +2,7 @@
<?eclipse version="3.2"?>
<plugin>
<extension-point id="org.eclipse.e4.workbench.model" name="%extension-point.model.name" schema="schema/org.eclipse.e4.workbench.model.exsd"/>
+ <extension-point id="org.eclipse.e4.workbench.model.definition.enrichment" name="%extension-point.model.definition.enrichment.name" schema="schema/org.eclipse.e4.workbench.model.definition.enrichment.exsd"/>
<extension
point="org.eclipse.core.runtime.adapters">
<factory
@@ -37,4 +38,31 @@
priority="low">
</content-type>
</extension>
+ <extension
+ point="org.eclipse.e4.workbench.model.definition.enrichment">
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/application">
+ </definitionEnrichment>
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/application/commands">
+ </definitionEnrichment>
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/application/ui">
+ </definitionEnrichment>
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu">
+ </definitionEnrichment>
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic">
+ </definitionEnrichment>
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced">
+ </definitionEnrichment>
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic">
+ </definitionEnrichment>
+ <definitionEnrichment
+ ePackageNS="http://www.eclipse.org/ui/2010/UIModel/fragment">
+ </definitionEnrichment>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.e4.ui.workbench/schema/org.eclipse.e4.workbench.model.definition.enrichment.exsd b/bundles/org.eclipse.e4.ui.workbench/schema/org.eclipse.e4.workbench.model.definition.enrichment.exsd
new file mode 100644
index 0000000..86b1f4a
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.workbench/schema/org.eclipse.e4.workbench.model.definition.enrichment.exsd
@@ -0,0 +1,105 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.e4.ui.workbench" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.e4.ui.workbench" id="org.eclipse.e4.workbench.model.definition.enrichment" name="%extension-point.model.definition.enrichment.name"/>
+ </appInfo>
+ <documentation>
+ This extension point provides a mechanism to enrich the UI model with custom UI model elements.
+&lt;p&gt;
+To find and create a custom UI model element via the EModelService#createModelElement(Class) method the elements have to be publisched via this ExtensionPoint.
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="definitionEnrichment"/>
+ </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="definitionEnrichment">
+ <complexType>
+ <attribute name="ePackageNS" type="string" use="required">
+ <annotation>
+ <documentation>
+ A namespace URI to the EPackage which contains custom application model classes.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 4.4
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example to register a model definiton enrichment:
+
+&lt;extension
+ point=&quot;org.eclipse.e4.workbench.model.definition.enrichment&quot;&gt;
+ &lt;definitionEnrichment
+ ePackageNS=&quot;http://www.eclipse.org/ui/2010/UIModel/application/ui&quot;&gt;
+ &lt;/definitionEnrichment&gt;
+&lt;/extension&gt;
+ </documentation>
+ </annotation>
+
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2010, 2012 IBM Corporation and others.&lt;br&gt;
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which accompanies
+this distribution, and is available at &lt;a
+href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java
index d24b2b8..370eebf 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java
@@ -74,7 +74,7 @@ final class GenericMApplicationElementFactoryImpl {
// which is used throughout the running application and so this instance will also life as
// long as the application is running.
extensionRegistry.addListener(emfGeneratedPackages,
- MApplicationElementClassToEClass.EP_GENERATED_PACKAGE);
+ MApplicationElementClassToEClass.EP_MODEL_DEFINITION_ENRICHMENT);
emfGeneratedPackages.initialize(extensionRegistry);
}
@@ -100,8 +100,8 @@ final class GenericMApplicationElementFactoryImpl {
* {@link EClass} for the given {@link Class}.
*
* <p>
- * This Listener must be registered on EMF's {@value #EP_GENERATED_PACKAGE} extension point to
- * build the appropriate mapping between {@link Class} and {@link EClass}.
+ * This Listener must be registered on EMF's {@value #EP_MODEL_DEFINITION_ENRICHMENT} extension
+ * point to build the appropriate mapping between {@link Class} and {@link EClass}.
* </p>
*
* <p>
@@ -112,16 +112,16 @@ final class GenericMApplicationElementFactoryImpl {
private static final class MApplicationElementClassToEClass implements IRegistryEventListener {
/** The extension point name which holds the required information. */
- public static final String EP_GENERATED_PACKAGE = "org.eclipse.emf.ecore.generated_package"; //$NON-NLS-1$
+ public static final String EP_MODEL_DEFINITION_ENRICHMENT = "org.eclipse.e4.workbench.model.definition.enrichment"; //$NON-NLS-1$
/**
* The configuration element inside the extension point which holds the required
* information.
*/
- private static final String CONFIG_ELEMENT_NAME = "package"; //$NON-NLS-1$
+ private static final String CONFIG_ELEMENT_NAME = "definitionEnrichment"; //$NON-NLS-1$
/** Attribute name which holds the EMF EPackage Namespace URI. */
- private static final String CONFIG_ATTR_EPACKAGE_URI = "uri"; //$NON-NLS-1$
+ private static final String CONFIG_ATTR_EPACKAGE_URI = "ePackageNS"; //$NON-NLS-1$
/** Holds the mapping between {@link Class} and {@link EClass}. */
private final ConcurrentMap<Class<? extends MApplicationElement>, EClass> classToEClass = new ConcurrentHashMap<Class<? extends MApplicationElement>, EClass>();
@@ -141,8 +141,8 @@ final class GenericMApplicationElementFactoryImpl {
* ExtensionRegistry.
*
* <p>
- * The method will retrieve all {@link #EP_GENERATED_PACKAGE} extensions form the given
- * Eclipse ExtensionRegistry and initializes the basic mapping.
+ * The method will retrieve all {@link #EP_MODEL_DEFINITION_ENRICHMENT} extensions form the
+ * given Eclipse ExtensionRegistry and initializes the basic mapping.
* </p>
*
* @param extensionRegistry
@@ -154,7 +154,7 @@ final class GenericMApplicationElementFactoryImpl {
}
IExtensionPoint epGeneratedPackage = extensionRegistry
- .getExtensionPoint(EP_GENERATED_PACKAGE);
+ .getExtensionPoint(EP_MODEL_DEFINITION_ENRICHMENT);
if (epGeneratedPackage != null) {
added(epGeneratedPackage.getExtensions());
}
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/EModelService.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/EModelService.java
index 9807780..cefe1bd 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/EModelService.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/EModelService.java
@@ -111,6 +111,12 @@ public interface EModelService {
* Creates instances of model elements. The method supports any type extending
* {@link MApplicationElement}, both in the standard e4 UI model and in an extension models.
*
+ * <p>
+ * <b>Caution:</b> To create model element instances of extension models you need to register
+ * them with the <code>the org.eclipse.e4.workbench.model.definition.enrichment</code>
+ * ExtensionPoint.
+ * </p>
+ *
* @param elementType
* the class to instantiate. Cannot be <code>null</code>
* @return a new instance