Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2009-05-21 12:40:30 -0400
committerashatalin2009-05-21 12:40:30 -0400
commit3f151b41e8faa4b71b5f72289627820f2389823c (patch)
tree590b7888e1fd81523594dd1ca6c9334eeb01321a
parent26139ffb50410acea3476fdeabf7cd2df8d38068 (diff)
downloadorg.eclipse.gmf-tooling-3f151b41e8faa4b71b5f72289627820f2389823c.tar.gz
org.eclipse.gmf-tooling-3f151b41e8faa4b71b5f72289627820f2389823c.tar.xz
org.eclipse.gmf-tooling-3f151b41e8faa4b71b5f72289627820f2389823c.zip
StackOverflowError caused by closing/opening project in WS with the same models as registered in EMF registry corrected.v20090521-1925
-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