summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Efftinge2011-08-04 06:28:54 (EDT)
committerEd Merks2011-08-04 06:28:54 (EDT)
commit159891111f2599e9cb7a0d692a4596d091efe94d (patch)
tree6d249d0f218cae33769a0483e9fc287c6fc1b9b5
parent7a7d71c32ef6ea53a8b45e131d982f5104355cce (diff)
downloadorg.eclipse.emf-159891111f2599e9cb7a0d692a4596d091efe94d.zip
org.eclipse.emf-159891111f2599e9cb7a0d692a4596d091efe94d.tar.gz
org.eclipse.emf-159891111f2599e9cb7a0d692a4596d091efe94d.tar.bz2
made XcoreJvmInferrer use dependency injection
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java5
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreJvmInferrer.java16
2 files changed, 16 insertions, 5 deletions
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java
index 21f9451..280c30d 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/XcoreResource.java
@@ -37,6 +37,9 @@ public class XcoreResource extends XbaseResource {
@Inject
private IReferableElementsUnloader.GenericUnloader unloader;
+
+ @Inject
+ private XcoreJvmInferrer jvmInferrer;
protected boolean fullyInitialized = false;
@@ -96,7 +99,7 @@ public class XcoreResource extends XbaseResource {
}
}
xcoreEcoreBuilder.link();
- super.getContents().addAll(new XcoreJvmInferrer().getDeclaredTypes(model));
+ super.getContents().addAll(jvmInferrer.getDeclaredTypes(model));
}
}
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreJvmInferrer.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreJvmInferrer.java
index 875707b..d1eca3c 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreJvmInferrer.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/util/XcoreJvmInferrer.java
@@ -7,19 +7,23 @@ import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier;
import org.eclipse.emf.codegen.ecore.genmodel.GenEnum;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.xcore.XPackage;
import org.eclipse.xtext.common.types.JvmDeclaredType;
import org.eclipse.xtext.common.types.JvmGenericType;
+import org.eclipse.xtext.common.types.JvmTypeReference;
import org.eclipse.xtext.common.types.JvmVisibility;
import org.eclipse.xtext.common.types.TypesFactory;
+import org.eclipse.xtext.common.types.util.TypeReferences;
+
+import com.google.inject.Inject;
public class XcoreJvmInferrer
{
+ @Inject
+ private TypeReferences typeReferences;
+
public List<? extends JvmDeclaredType> getDeclaredTypes(XPackage xPackage)
{
GenPackage genPackage = (GenPackage)XcoreEcoreBuilder.getGen(XcoreEcoreBuilder.get(xPackage));
@@ -61,6 +65,10 @@ public class XcoreJvmInferrer
jvmGenericType.setSimpleName(genClass.getName());
jvmGenericType.setPackageName(genClass.getGenPackage().getInterfacePackageName());
jvmGenericType.setVisibility(JvmVisibility.PUBLIC);
+
+ JvmTypeReference eObjectImpl = typeReferences.getTypeForName(EObjectImpl.class, genClass);
+ jvmGenericType.getSuperTypes().add(eObjectImpl);
+
result.add(jvmGenericType);
return result;
}