use of org.eclipse.xtext.builder.impl.ToBeBuilt in project dsl-devkit by dsldevkit.
the class RebuildingXtextBuilder method incrementalBuild.
@Override
protected void incrementalBuild(final IResourceDelta delta, final IProgressMonitor monitor) throws CoreException {
final SubMonitor progress = SubMonitor.convert(monitor, Messages.XtextBuilder_CollectingResources, 2);
progress.subTask(Messages.XtextBuilder_CollectingResources);
final ToBeBuilt toBeBuilt = new ToBeBuilt();
IResourceDeltaVisitor visitor = new IResourceDeltaVisitor() {
@Override
public boolean visit(final IResourceDelta delta) throws CoreException {
if (progress.isCanceled()) {
throw new OperationCanceledException();
}
if (delta.getResource() instanceof IProject) {
return delta.getResource() == getProject();
}
if (delta.getResource() instanceof IStorage) {
if (delta.getKind() == IResourceDelta.REMOVED) {
return getToBeBuiltComputer().removeStorage(null, toBeBuilt, (IStorage) delta.getResource());
} else if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.CHANGED) {
return getToBeBuiltComputer().updateStorage(null, toBeBuilt, (IStorage) delta.getResource());
}
}
return true;
}
};
delta.accept(visitor);
if (progress.isCanceled()) {
throw new OperationCanceledException();
}
progress.worked(1);
doBuild(toBeBuilt, progress.newChild(1), BuildType.INCREMENTAL);
}
use of org.eclipse.xtext.builder.impl.ToBeBuilt in project dsl-devkit by dsldevkit.
the class RebuildingXtextBuilder method clean.
@Override
protected void clean(final IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, 2);
try {
ToBeBuilt toBeBuilt = getToBeBuiltComputer().removeProject(getProject(), progress.newChild(1));
doClean(toBeBuilt, progress.newChild(1));
} finally {
if (monitor != null) {
monitor.done();
}
}
}
use of org.eclipse.xtext.builder.impl.ToBeBuilt in project dsl-devkit by dsldevkit.
the class RebuildingXtextBuilder method fullBuild.
@Override
protected void fullBuild(final IProgressMonitor monitor, final boolean isRecoveryBuild) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, 2);
IProject project = getProject();
ToBeBuilt toBeBuilt = isRecoveryBuild ? getToBeBuiltComputer().updateProjectNewResourcesOnly(project, progress.newChild(1)) : getToBeBuiltComputer().updateProject(project, progress.newChild(1));
doBuild(toBeBuilt, progress.newChild(1), isRecoveryBuild ? BuildType.RECOVERY : BuildType.FULL);
}
use of org.eclipse.xtext.builder.impl.ToBeBuilt in project xtext-eclipse by eclipse.
the class Bug349445Test method testUpdate.
@Test
public void testUpdate() {
testMe.update(new BuildData(null, null, new ToBeBuilt(), new QueuedBuildData(null)), null);
assertEquals(1, loadCalled);
}
use of org.eclipse.xtext.builder.impl.ToBeBuilt in project xtext-eclipse by eclipse.
the class PersistableResourceDescriptionsTest method update.
private Map<URI, IResourceDescription.Delta> update(Set<URI> toBeUpdated, Set<URI> toBeDeleted) {
ResourceSet resourceSet = createResourceSet();
try {
ToBeBuilt toBeBuilt = new ToBeBuilt();
if (toBeDeleted != null)
toBeBuilt.getToBeDeleted().addAll(toBeDeleted);
if (toBeUpdated != null)
toBeBuilt.getToBeUpdated().addAll(toBeUpdated);
BuildData buildData = new BuildData("", resourceSet, toBeBuilt, builderInjector.getInstance(QueuedBuildData.class));
ImmutableList<Delta> update = builderState.update(buildData, new NullProgressMonitor());
return Maps.uniqueIndex(update, new Function<IResourceDescription.Delta, URI>() {
@Override
public URI apply(IResourceDescription.Delta from) {
return from.getUri();
}
});
} finally {
resourceSet.getResources().clear();
}
}
Aggregations