Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2015-03-03 12:35:28 +0000
committerEd Merks2015-03-03 12:35:28 +0000
commite6ccc56e8e064f4b168c81349601fec19c2b0427 (patch)
tree5bf1814d1963182b171f6d1f9812f823860c4caa
parent5ea9a54f2bb01610e6bdac2c9e74485e93a8a271 (diff)
downloadorg.eclipse.emf-e6ccc56e8e064f4b168c81349601fec19c2b0427.tar.gz
org.eclipse.emf-e6ccc56e8e064f4b168c81349601fec19c2b0427.tar.xz
org.eclipse.emf-e6ccc56e8e064f4b168c81349601fec19c2b0427.zip
[461215] Ensure the builder only builds resources local to the project.
-rw-r--r--plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/builder/XcoreBuildParticipant.java36
1 files changed, 22 insertions, 14 deletions
diff --git a/plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/builder/XcoreBuildParticipant.java b/plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/builder/XcoreBuildParticipant.java
index ede965a54..3becbfab1 100644
--- a/plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/builder/XcoreBuildParticipant.java
+++ b/plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/builder/XcoreBuildParticipant.java
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xcore.ui.internal.XcoreActivator;
@@ -110,29 +111,36 @@ public class XcoreBuildParticipant extends BuilderParticipant
@Override
protected void handleChangedContents(Delta delta, IBuildContext context, EclipseResourceFileSystemAccess2 fileSystemAccess) throws CoreException
{
- // Determine which projects existed before we run the generator.
+ // Determine if this resource is logically nested in the project being built.
//
- Resource resource = context.getResourceSet().getResource(delta.getUri(), true);
- GenModel genModel = (GenModel)EcoreUtil.getObjectByType(resource.getContents(), GenModelPackage.Literals.GEN_MODEL);
- IWorkspaceRoot root = context.getBuiltProject().getWorkspace().getRoot();
- if (genModel != null)
+ URI uri = delta.getUri();
+ IProject builtProject = context.getBuiltProject();
+ if (uri.isPlatformResource() && builtProject.getName().equals(uri.segment(1)))
{
- for (String projectName : new String [] { genModel.getEditProjectDirectory(), genModel.getEditorProjectDirectory(), genModel.getTestsProjectDirectory() })
+ // Determine which projects existed before we run the generator.
+ //
+ Resource resource = context.getResourceSet().getResource(uri, true);
+ GenModel genModel = (GenModel)EcoreUtil.getObjectByType(resource.getContents(), GenModelPackage.Literals.GEN_MODEL);
+ if (genModel != null)
{
- if (!Strings.isNullOrEmpty(projectName))
+ IWorkspaceRoot root = builtProject.getWorkspace().getRoot();
+ for (String projectName : new String [] { genModel.getEditProjectDirectory(), genModel.getEditorProjectDirectory(), genModel.getTestsProjectDirectory() })
{
- IProject project = root.getProject(projectName);
- if (!project.exists())
+ if (!Strings.isNullOrEmpty(projectName))
{
- newProjects.add(project);
+ IProject project = root.getProject(projectName);
+ if (!project.exists())
+ {
+ newProjects.add(project);
+ }
}
}
}
- }
- // Do the normal generation.
- //
- super.handleChangedContents(delta, context, fileSystemAccess);
+ // Do the normal generation.
+ //
+ super.handleChangedContents(delta, context, fileSystemAccess);
+ }
}
}

Back to the top