Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/Activator.java7
-rw-r--r--plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/WorkspaceModelRegistry.java2
-rw-r--r--plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/XpandBuilder.java5
3 files changed, 13 insertions, 1 deletions
diff --git a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/Activator.java b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/Activator.java
index 379ed49ee..1658275f1 100644
--- a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/Activator.java
+++ b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/Activator.java
@@ -232,6 +232,13 @@ public class Activator extends Plugin {
}
final ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
resourceSetImpl.setURIResourceMap(new EPackageRegistryBasedURIResourceMap(resourceSetImpl.getURIConverter()));
+ // TODO: EcorePlugin.computePlatformURIMap() can return different maps
+ // if some of the project were opened/closed, so it is necessary to
+ // either update it or not keep any shared resourceSet for meta-models.
+ // In case of second solution we can better keep meta-model URIs and
+ // pre-load all necessary meta-models into the newly created ResourceSet
+ // just before Xpand execution (build or evaluation).
+ resourceSetImpl.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap());
if (anInstance != null) {
anInstance.workspaceMetamodelRS = resourceSetImpl;
}
diff --git a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/WorkspaceModelRegistry.java b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/WorkspaceModelRegistry.java
index b69ea877b..7bc1561f8 100644
--- a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/WorkspaceModelRegistry.java
+++ b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/WorkspaceModelRegistry.java
@@ -73,11 +73,11 @@ class WorkspaceModelRegistry implements MetaModelSource {
assert project != null;
this.project = project;
resourceSet = resolutionResourceSet;
- resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap());
}
public WorkspaceModelRegistry(IProject project) {
this(project, new ResourceSetImpl());
+ resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap());
}
public EPackage find(String nsURI) {
diff --git a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/XpandBuilder.java b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/XpandBuilder.java
index 6a6c1c73a..838d2fc69 100644
--- a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/XpandBuilder.java
+++ b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/build/XpandBuilder.java
@@ -59,6 +59,11 @@ public class XpandBuilder extends IncrementalProjectBuilder implements RootManag
myRootManager = Activator.getRootManager(getProject());
myRootManager.addRootChangeListener(this);
modelRegistry = new WorkspaceModelRegistry(getProject(), Activator.getWorkspaceMetamodelsResourceSet());
+ // TODO: unregister modelRegistry from Activator on closing the project
+ // associated with this builder. Keeping modelRegistry registered inside
+ // Activator produce incorrect meta-model resolution - meta-model loaded
+ // from closed project will be returned instead of the one from
+ // PackageRegistry.
Activator.registerModelSource(modelRegistry);
}

Back to the top