summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpschonbac2008-01-23 17:06:49 (EST)
committerpschonbac2008-01-23 17:06:49 (EST)
commit264ff2283c7ea8762c6e6271af60d95ac9296211 (patch)
tree3673cbcde1c8b779cce4d9b9dac88c2170d9edea
parentbc46bdaca873e204594c75482e25053bebcdfe33 (diff)
downloadorg.eclipse.xpand-264ff2283c7ea8762c6e6271af60d95ac9296211.zip
org.eclipse.xpand-264ff2283c7ea8762c6e6271af60d95ac9296211.tar.gz
org.eclipse.xpand-264ff2283c7ea8762c6e6271af60d95ac9296211.tar.bz2
[Bug 206621] Stack overflow Exception
URL: https://bugs.eclipse.org/bugs/show_bug.cgi?id=206621
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf.ui/src/org/eclipse/xtend/typesystem/emf/ui/EmfToolsPlugin.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/org.eclipse.xtend.typesystem.emf.ui/src/org/eclipse/xtend/typesystem/emf/ui/EmfToolsPlugin.java b/plugins/org.eclipse.xtend.typesystem.emf.ui/src/org/eclipse/xtend/typesystem/emf/ui/EmfToolsPlugin.java
index b03e9c6..bf825f5 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf.ui/src/org/eclipse/xtend/typesystem/emf/ui/EmfToolsPlugin.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf.ui/src/org/eclipse/xtend/typesystem/emf/ui/EmfToolsPlugin.java
@@ -244,13 +244,21 @@ public class EmfToolsPlugin extends AbstractUIPlugin {
/**
* Finds oaw projects that depend on the given project, recursively. Uses a Map to collect projects
* since sometimes the same project is referenced through different IProject objects.
+ * @param project The project whose referenced projects should be retrieved
+ * @param referencingProjects Result map where the assignment of a project to its referencing projects is stored
+ * @param visited All project names that where already visited during this recursion. This is to avoid loops when having
+ * circular dependencies.
*/
- private void collectReferencingExtXptProjects(IProject project, Map<String, IProject> referencingProjects) {
+ private void collectReferencingExtXptProjects(IProject project, Map<String, IProject> referencingProjects, Set<String> visited) {
+ if (visited.contains(project.getName()))
+ return;
+ visited.add(project.getName());
+
for (IProject p : project.getReferencingProjects()) {
if (Activator.getExtXptModelManager().findProject(p) != null) {
referencingProjects.put(p.getName(), p);
}
- collectReferencingExtXptProjects(p, referencingProjects);
+ collectReferencingExtXptProjects(p, referencingProjects, visited);
}
}
@@ -262,6 +270,7 @@ public class EmfToolsPlugin extends AbstractUIPlugin {
*/
private void analyzeAndRebuildProjects(Set<IProject> projects) {
Map<String, IProject> referencingProjects = new HashMap<String, IProject>();
+ Set<String> visited = new HashSet<String>();
for (IProject p : projects) {
ProjectAnalyzer pa = getProjectAnalyzer(p);
if (pa!=null) {
@@ -269,7 +278,7 @@ public class EmfToolsPlugin extends AbstractUIPlugin {
pa.schedule();
}
}
- collectReferencingExtXptProjects(p, referencingProjects);
+ collectReferencingExtXptProjects(p, referencingProjects, visited);
}
// remove those projects that we just analyzed. they will be built in their ProjectAnalyzer.
// so we shouldn't start another builder here.