summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Efftinge2011-09-26 11:44:37 (EDT)
committer Ed Merks2011-09-26 11:44:37 (EDT)
commit58c803fdb9683b2e4d6b44110803a9154a522086 (patch)
treea963e5fd93180ef46e405ffc5d5466b465a4c866
parent4f275813c4918776975ddcc1c372ddede65db6ca (diff)
downloadorg.eclipse.emf-58c803fdb9683b2e4d6b44110803a9154a522086.zip
org.eclipse.emf-58c803fdb9683b2e4d6b44110803a9154a522086.tar.gz
org.eclipse.emf-58c803fdb9683b2e4d6b44110803a9154a522086.tar.bz2
Some fixes for problems introduced with last restructuring
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java10
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreAppendable.java1
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java6
-rw-r--r--org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportedNamespaceAwareScopeProvider.java14
4 files changed, 27 insertions, 4 deletions
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java
index 4163e62..e2951ed 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/XcoreRuntimeModule.java
@@ -16,13 +16,13 @@ import org.eclipse.emf.ecore.xcore.validation.XcoreDiagnosticConverter;
import org.eclipse.emf.ecore.xcore.validation.XcoreDiagnostician;
import org.eclipse.xtext.conversion.IValueConverterService;
import org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter;
+import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.parser.antlr.IReferableElementsUnloader;
import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
import org.eclipse.xtext.resource.IDerivedStateComputer;
-import org.eclipse.xtext.resource.IResourceDescription;
-import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.IResourceDescription.Manager;
+import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.serializer.ISerializer;
@@ -118,4 +118,10 @@ public class XcoreRuntimeModule extends org.eclipse.emf.ecore.xcore.AbstractXcor
{
return org.eclipse.emf.ecore.xcore.resource.LateInferrer.class;
}
+
+ @Override
+ public Class<? extends IGenerator> bindIGenerator()
+ {
+ return org.eclipse.emf.ecore.xcore.generator.XcoreGenerator.class;
+ }
}
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreAppendable.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreAppendable.java
index d4035c8..ed9bd31 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreAppendable.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/generator/XcoreAppendable.java
@@ -1,7 +1,6 @@
package org.eclipse.emf.ecore.xcore.generator;
import org.eclipse.xtext.xbase.compiler.IAppendable;
-import org.eclipse.xtext.xbase.compiler.ImportManager;
import org.eclipse.xtext.xbase.compiler.StringBuilderBasedAppendable;
public class XcoreAppendable extends StringBuilderBasedAppendable
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java
index e498652..ce01344 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/resource/LateInferrer.java
@@ -1,6 +1,7 @@
package org.eclipse.emf.ecore.xcore.resource;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.common.util.EList;
@@ -19,6 +20,8 @@ import org.eclipse.xtext.resource.IDerivedStateComputer;
import com.google.inject.Inject;
import com.google.inject.Provider;
+import static com.google.common.collect.Lists.*;
+
public class LateInferrer implements IDerivedStateComputer
{
@Inject
@@ -58,17 +61,20 @@ public class LateInferrer implements IDerivedStateComputer
int size = contents.size();
if (size > 1)
{
+ List<EObject> toBeRemoved = newArrayList();
for (Iterator<EObject> i = contents.iterator(); i.hasNext();)
{
EObject eObject = i.next();
if (eObject instanceof EPackage || eObject instanceof GenModel || eObject instanceof JvmGenericType)
{
unloader.unloadRoot(eObject);
+ toBeRemoved.add(eObject);
} else if (eObject instanceof XPackage)
{
mapper.unsetMapping((XPackage) eObject);
}
}
+ contents.removeAll(toBeRemoved);
}
}
diff --git a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportedNamespaceAwareScopeProvider.java b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportedNamespaceAwareScopeProvider.java
index 38231e2..ef35d1e 100644
--- a/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportedNamespaceAwareScopeProvider.java
+++ b/org.eclipse.emf.ecore.xcore/src/org/eclipse/emf/ecore/xcore/scoping/XcoreImportedNamespaceAwareScopeProvider.java
@@ -26,6 +26,8 @@ import org.eclipse.xtext.naming.IQualifiedNameConverter;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.AbstractEObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.resource.IResourceDescription;
+import org.eclipse.xtext.resource.ISelectable;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractScope;
import org.eclipse.xtext.scoping.impl.ImportNormalizer;
@@ -48,7 +50,10 @@ public class XcoreImportedNamespaceAwareScopeProvider extends ImportedNamespaceA
private IQualifiedNameConverter nameConverter;
@Inject
- Provider<EcoreXcoreBuilder> ecoreXcoreBuilderProvider;
+ private Provider<EcoreXcoreBuilder> ecoreXcoreBuilderProvider;
+
+ @Inject
+ private IResourceDescription.Manager manager;
@Override
protected List<ImportNormalizer> internalGetImportedNamespaceResolvers(EObject context, boolean ignoreCase)
@@ -205,4 +210,11 @@ public class XcoreImportedNamespaceAwareScopeProvider extends ImportedNamespaceA
}
}
+
+ @Override
+ protected ISelectable internalGetAllDescriptions(Resource resource)
+ {
+ IResourceDescription description = manager.getResourceDescription(resource);
+ return description;
+ }
}