Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2011-08-05 16:17:32 +0000
committerMartin Fluegge2011-08-05 16:17:32 +0000
commitdb6239bc0805ef6620c1e1e550dad6832a3d199f (patch)
tree5334b80eb825f47b027a433aa2006689739970d7 /plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel
parente19c81c05a03bf3a3fef7972a0f3cf631ebe7b2b (diff)
downloadcdo-db6239bc0805ef6620c1e1e550dad6832a3d199f.tar.gz
cdo-db6239bc0805ef6620c1e1e550dad6832a3d199f.tar.xz
cdo-db6239bc0805ef6620c1e1e550dad6832a3d199f.zip
[352823] [Dawn] EMF runtime compatibility issue and duplicate code in test models
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352823
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/model/DawnCodeGen.genmodel2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/src/org/eclipse/emf/cdo/dawn/codegen/dawngenmodel/util/DawngenmodelSwitch.java38
3 files changed, 33 insertions, 17 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/META-INF/MANIFEST.MF
index 4c8826f020..0f91411cdd 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/META-INF/MANIFEST.MF
@@ -2,15 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.dawn.codegen.dawngenmodel;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.emf.cdo.dawn.codegen.genmodel.DawnGenModelPlugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.6.0,3.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.emf.cdo.dawn.codegen.dawngenmodel;version="1.0.0",
- org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.impl;version="1.0.0",
- org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.util;version="1.0.0",
- org.eclipse.emf.cdo.dawn.codegen.genmodel;version="1.0.0"
+Export-Package: org.eclipse.emf.cdo.dawn.codegen.dawngenmodel;version="2.0.0",
+ org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.impl;version="2.0.0",
+ org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.util;version="2.0.0",
+ org.eclipse.emf.cdo.dawn.codegen.genmodel;version="2.0.0"
Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/model/DawnCodeGen.genmodel b/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/model/DawnCodeGen.genmodel
index 1524f5e284..401c12a442 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/model/DawnCodeGen.genmodel
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/model/DawnCodeGen.genmodel
@@ -4,7 +4,7 @@
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
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
http://www.eclipse.org/legal/epl-v10.html

Contributors:
 Martin Fluegge - initial API and implementation"
modelDirectory="/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/src" modelPluginID="org.eclipse.emf.cdo.dawn.codegen.dawngenmodel"
modelName="DawnCodeGen" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0"
- usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
+ runtimeVersion="2.6" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
<foreignModel>DawnCodeGen.ecore</foreignModel>
<genPackages prefix="Dawngenmodel" basePackage="org.eclipse.emf.cdo.dawn.codegen"
disposableProviderFactory="true" multipleEditorPages="false" ecorePackage="DawnCodeGen.ecore#/">
diff --git a/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/src/org/eclipse/emf/cdo/dawn/codegen/dawngenmodel/util/DawngenmodelSwitch.java b/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/src/org/eclipse/emf/cdo/dawn/codegen/dawngenmodel/util/DawngenmodelSwitch.java
index 8a44fd2aec..4c5d81f77f 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/src/org/eclipse/emf/cdo/dawn/codegen/dawngenmodel/util/DawngenmodelSwitch.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.codegen.dawngenmodel/src/org/eclipse/emf/cdo/dawn/codegen/dawngenmodel/util/DawngenmodelSwitch.java
@@ -14,9 +14,10 @@ import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawnFragmentGenerator;
import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawnGenerator;
import org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawngenmodelPackage;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.util.Switch;
+
+import java.util.List;
/**
* <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the call
@@ -27,7 +28,7 @@ import org.eclipse.emf.ecore.util.Switch;
* @see org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.DawngenmodelPackage
* @generated
*/
-public class DawngenmodelSwitch<T> extends Switch<T>
+public class DawngenmodelSwitch<T>
{
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
@@ -57,16 +58,33 @@ public class DawngenmodelSwitch<T> extends Switch<T>
}
/**
- * Checks whether this is a switch for the given package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @parameter ePackage the package in question.
- * @return whether this is a switch for the given package.
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
- @Override
- protected boolean isSwitchFor(EPackage ePackage)
+ public T doSwitch(EObject theEObject)
{
- return ePackage == modelPackage;
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
}
/**
@@ -76,7 +94,6 @@ public class DawngenmodelSwitch<T> extends Switch<T>
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
- @Override
protected T doSwitch(int classifierID, EObject theEObject)
{
switch (classifierID)
@@ -150,7 +167,6 @@ public class DawngenmodelSwitch<T> extends Switch<T>
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
- @Override
public T defaultCase(EObject object)
{
return null;

Back to the top