[559209] Add plugin registration for root OCL EPackage
diff --git a/plugins/org.eclipse.ocl/META-INF/MANIFEST.MF b/plugins/org.eclipse.ocl/META-INF/MANIFEST.MF
index 5f1b28e..2b121ad 100644
--- a/plugins/org.eclipse.ocl/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.ocl/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ocl;singleton:=true
-Bundle-Version: 3.10.400.qualifier
+Bundle-Version: 3.15.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.ocl/plugin.xml b/plugins/org.eclipse.ocl/plugin.xml
index 441965f..06e8595 100644
--- a/plugins/org.eclipse.ocl/plugin.xml
+++ b/plugins/org.eclipse.ocl/plugin.xml
@@ -25,6 +25,13 @@
<extension point="org.eclipse.emf.ecore.generated_package">
<package
+ uri = "http://www.eclipse.org/ocl/1.1.0/OCL"
+ class = "org.eclipse.ocl.expressions.impl.ExpressionsPackageImpl$OCLPackageImpl"
+ genModel = "model/OCL.genmodel" />
+ </extension>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
uri = "http://www.eclipse.org/ocl/1.1.0/OCL/Expressions"
class = "org.eclipse.ocl.expressions.ExpressionsPackage"
genModel = "model/OCL.genmodel" />
diff --git a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java
index 58b291e..2dea7ef 100644
--- a/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java
+++ b/plugins/org.eclipse.ocl/src/org/eclipse/ocl/expressions/impl/ExpressionsPackageImpl.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
- *
+ *
* Contributors:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
@@ -330,33 +330,43 @@
private EEnum collectionKindEEnum = null;
/**
- * Root package of the OCL Ecore model, which we have to "fake out"
- * because EMF will not generate it.
+ * Root package of the OCL Ecore model, which we have to "fake out" because EMF will not generate it.
+ *
+ * - not actually true. EMF will generate the root package if it has a DummyClass.
+ *
+ * But the legacy is that we have true nested EPackages each with their own EResource and a faked root
+ * that nests but does not contain its nested EPackages. Consequently serialized URIs use the nested rather than
+ * root Resource.
+ *
+ * The Bug 559209 fix exposes OCLPackageImpl and its eINSTANCE as public API so that a regular EPackage.Registry
+ * extension point registers the root EPackage in a timely fashion.
+ *
+ * @since 3.11
*/
- public static final EPackage OCL_ROOT_PACKAGE;
+ public static class OCLPackageImpl extends EPackageImpl {
- static {
- class OCLPackageImpl
- extends EPackageImpl {
+ public static final OCLPackageImpl eINSTANCE = new OCLPackageImpl();
- @Override
- protected Resource createResource(String uri) {
- return super.createResource(uri);
- }
+ private OCLPackageImpl() {
+ setName("ocl"); //$NON-NLS-1$
+ setNsPrefix("ocl"); //$NON-NLS-1$
+ setNsURI(Environment.OCL_NAMESPACE_URI);
+ createResource(getNsURI());
+ EPackage.Registry.INSTANCE.put(getNsURI(), this);
}
- OCLPackageImpl oclPackage = new OCLPackageImpl();
- oclPackage.setName("ocl"); //$NON-NLS-1$
- oclPackage.setNsPrefix("ocl"); //$NON-NLS-1$
- oclPackage.setNsURI(Environment.OCL_NAMESPACE_URI);
- oclPackage.createResource(oclPackage.getNsURI());
-
- OCL_ROOT_PACKAGE = oclPackage;
- EPackage.Registry.INSTANCE.put(OCL_ROOT_PACKAGE.getNsURI(),
- OCL_ROOT_PACKAGE);
+ @Override
+ protected Resource createResource(String uri) {
+ return super.createResource(uri);
+ }
}
/**
+ * The legacy reference to the root EPackage.
+ */
+ public static final EPackage OCL_ROOT_PACKAGE = OCLPackageImpl.eINSTANCE;
+
+ /**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
diff --git a/tests/org.eclipse.ocl.ecore.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.ocl.ecore.tests/META-INF/MANIFEST.MF
index dd336f1..d92d59f 100644
--- a/tests/org.eclipse.ocl.ecore.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ocl.ecore.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ocl.ecore.tests;singleton:=true
-Bundle-Version: 3.10.400.qualifier
+Bundle-Version: 3.15.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/tests/org.eclipse.ocl.ecore.tests/pom.xml b/tests/org.eclipse.ocl.ecore.tests/pom.xml
index 9beefc5..b95b140 100644
--- a/tests/org.eclipse.ocl.ecore.tests/pom.xml
+++ b/tests/org.eclipse.ocl.ecore.tests/pom.xml
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.ocl</groupId>
<artifactId>org.eclipse.ocl.ecore.tests</artifactId>
- <version>3.10.400-SNAPSHOT</version>
+ <version>3.15.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>org.eclipse.ocl</groupId>