Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2015-05-04 12:47:46 +0000
committerEd Merks2015-05-04 12:47:46 +0000
commit39de9b99c284d6cec641a7bdc46b25d65eb8c27e (patch)
tree459a8818687460166995ea838844a359a789bc50
parente8a2d376f9e0bbd1510e46eb6fe02bcc66e48dac (diff)
downloadorg.eclipse.emf-39de9b99c284d6cec641a7bdc46b25d65eb8c27e.tar.gz
org.eclipse.emf-39de9b99c284d6cec641a7bdc46b25d65eb8c27e.tar.xz
org.eclipse.emf-39de9b99c284d6cec641a7bdc46b25d65eb8c27e.zip
[466305] Import of GenClassifier from *.genmodel doesn't resolve to
import of the corresponding JvmType
-rw-r--r--plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/impl/GenBaseImpl.java11
-rw-r--r--plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportsConfiguration.java15
2 files changed, 25 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/impl/GenBaseImpl.java b/plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/impl/GenBaseImpl.java
index d643bd282..38f309bf1 100644
--- a/plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/impl/GenBaseImpl.java
+++ b/plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/impl/GenBaseImpl.java
@@ -3472,7 +3472,16 @@ public abstract class GenBaseImpl extends EObjectImpl implements GenBase
}
if (!isErased)
{
- result.append(getTypeArguments(context, eGenericType.getETypeArguments(), isImported));
+ String typeArguments = getTypeArguments(context, eGenericType.getETypeArguments(), isImported);
+ int index = result.indexOf("[]");
+ if (index != -1)
+ {
+ result.insert(index, typeArguments);
+ }
+ else
+ {
+ result.append(typeArguments);
+ }
}
}
else
diff --git a/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportsConfiguration.java b/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportsConfiguration.java
index 242953a6b..0b5f7b261 100644
--- a/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportsConfiguration.java
+++ b/plugins/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportsConfiguration.java
@@ -14,6 +14,9 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.xcore.XImportDirective;
import org.eclipse.emf.ecore.xcore.XPackage;
import org.eclipse.xtext.common.types.JvmDeclaredType;
+import org.eclipse.xtext.common.types.JvmType;
+import org.eclipse.xtext.common.types.access.IJvmTypeProvider;
+import org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.util.IResourceScopeCache;
import org.eclipse.xtext.util.Strings;
@@ -36,6 +39,9 @@ public class XcoreImportsConfiguration extends DefaultImportsConfiguration
@Inject
private IResourceScopeCache cache;
+ @Inject
+ private AbstractTypeScopeProvider typeScopeProvider;
+
@Override
public XImportSection getImportSection(final XtextResource resource)
{
@@ -50,6 +56,7 @@ public class XcoreImportsConfiguration extends DefaultImportsConfiguration
XImportSection importSection = XtypeFactory.eINSTANCE.createXImportSection();
EList<XImportDeclaration> importDeclarations = importSection.getImportDeclarations();
+ IJvmTypeProvider typeProvider = typeScopeProvider.getTypeProvider(resource.getResourceSet());
XPackage xPackage = (XPackage) resource.getContents().get(0);
EList<XImportDirective> importDirectives = xPackage.getImportDirectives();
for (XImportDirective importDirective : importDirectives)
@@ -72,6 +79,14 @@ public class XcoreImportsConfiguration extends DefaultImportsConfiguration
{
importedType = (JvmDeclaredType) primaryJvmElement;
}
+ else
+ {
+ JvmType jvmType = typeProvider.findTypeByName(importedNamespace, false);
+ if (jvmType instanceof JvmDeclaredType)
+ {
+ importedType = (JvmDeclaredType)jvmType;
+ }
+ }
}
}

Back to the top