/** * @param monitor the progress monitor to use for reporting progress to the user. It is the * caller's responsibility to call done() on the given monitor. Accepts null, indicating that * no progress should be reported and that the operation cannot be cancelled. */ protected void doClean(ToBeBuilt toBeBuilt, IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 2); ImmutableList<Delta> deltas = builderState.clean(toBeBuilt.getToBeDeleted(), progress.newChild(1)); if (participant != null) { Set<URI> sourceURIs = new SourceLevelURICache() .getSourcesFrom(toBeBuilt.getToBeDeleted(), resourceServiceProvideRegistry); participant.build( new BuildContext( this, getResourceSetProvider().get(getProject()), deltas, sourceURIs, BuildType.CLEAN), progress.newChild(1)); } else { progress.worked(1); } }
/** * @param monitor the progress monitor to use for reporting progress to the user. It is the * caller's responsibility to call done() on the given monitor. Accepts null, indicating that * no progress should be reported and that the operation cannot be cancelled. */ protected void doBuild(ToBeBuilt toBeBuilt, IProgressMonitor monitor, BuildType type) throws CoreException { buildLogger.log("Building " + getProject().getName()); // return early if there's nothing to do. // we reuse the isEmpty() impl from BuildData assuming that it doesnT access the ResourceSet // which is still null // and would be expensive to create. boolean indexingOnly = type == BuildType.RECOVERY; if (new BuildData(getProject().getName(), null, toBeBuilt, queuedBuildData, indexingOnly) .isEmpty()) return; SubMonitor progress = SubMonitor.convert(monitor, 2); ResourceSet resourceSet = getResourceSetProvider().get(getProject()); resourceSet .getLoadOptions() .put(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE, Boolean.TRUE); BuildData buildData = new BuildData( getProject().getName(), resourceSet, toBeBuilt, queuedBuildData, indexingOnly); ImmutableList<Delta> deltas = builderState.update(buildData, progress.newChild(1)); if (participant != null && !indexingOnly) { SourceLevelURICache sourceLevelURIs = buildData.getSourceLevelURICache(); Set<URI> sources = sourceLevelURIs.getSources(); participant.build( new BuildContext(this, resourceSet, deltas, sources, type), progress.newChild(1)); try { getProject().getWorkspace().checkpoint(false); } catch ( NoClassDefFoundError e) { // guard against broken Eclipse installations / bogus project configuration log.error(e.getMessage(), e); } } else { progress.worked(1); } resourceSet.eSetDeliver(false); resourceSet.getResources().clear(); resourceSet.eAdapters().clear(); }