Fix Build portfolio generation for old EMF versions
Change-Id: I3fba3b0725573607655328f011eeaef57178f133
Signed-off-by: Matthieu Helleboid <matthieu.helleboid@thalesgroup.com>
diff --git a/portfolio/org.eclipse.egf.portfolio.eclipse.build/src/org/eclipse/egf/portfolio/eclipse/build/buildscm/util/BuildscmSwitch.java b/portfolio/org.eclipse.egf.portfolio.eclipse.build/src/org/eclipse/egf/portfolio/eclipse/build/buildscm/util/BuildscmSwitch.java
index ac52c4e..0faec89 100644
--- a/portfolio/org.eclipse.egf.portfolio.eclipse.build/src/org/eclipse/egf/portfolio/eclipse/build/buildscm/util/BuildscmSwitch.java
+++ b/portfolio/org.eclipse.egf.portfolio.eclipse.build/src/org/eclipse/egf/portfolio/eclipse/build/buildscm/util/BuildscmSwitch.java
@@ -41,7 +41,7 @@
* @see org.eclipse.egf.portfolio.eclipse.build.buildscm.BuildscmPackage
* @generated
*/
-public class BuildscmSwitch<T> extends Switch<T> {
+public class BuildscmSwitch<T> {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -70,16 +70,34 @@
}
/**
- * Checks whether this is a switch for the given package.
+ * 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) {
- return ePackage == modelPackage;
+ public T doSwitch(EObject theEObject) {
+ 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);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
}
/**
@@ -89,7 +107,7 @@
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
- @Override
+
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case BuildscmPackage.SVN: {
@@ -360,7 +378,7 @@
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
- @Override
+
public T defaultCase(EObject object) {
return null;
}