protected void cleanOutput( IBuildContext ctx, OutputConfiguration config, IProgressMonitor monitor) throws CoreException { final IProject project = ctx.getBuiltProject(); IFolder folder = project.getFolder(config.getOutputDirectory()); if (!folder.exists()) return; if (config.isCanClearOutputDirectory()) { for (IResource resource : folder.members()) resource.delete(IResource.KEEP_HISTORY, monitor); } else { if (config.isCleanUpDerivedResources()) { List<IFile> resources = derivedResourceMarkers.findDerivedResources(folder, null); for (IFile iFile : resources) { iFile.delete(IResource.KEEP_HISTORY, monitor); } } } }
/** @since 2.5 */ protected void cleanOutput( IBuildContext ctx, OutputConfiguration config, EclipseResourceFileSystemAccess2 access, IProgressMonitor monitor) throws CoreException { final IProject project = ctx.getBuiltProject(); for (IContainer container : getOutputs(project, config)) { if (!container.exists()) { return; } if (config.isCanClearOutputDirectory()) { for (IResource resource : container.members()) { if (!config.isKeepLocalHistory()) { resource.delete(IResource.NONE, monitor); } else if (access == null) { resource.delete(IResource.KEEP_HISTORY, monitor); } else { delete(resource, config, access, monitor); } } } else if (config.isCleanUpDerivedResources()) { List<IFile> resources = derivedResourceMarkers.findDerivedResources(container, null); for (IFile iFile : resources) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (access != null) { access.deleteFile(iFile, config.getName(), monitor); } else { iFile.delete( config.isKeepLocalHistory() ? IResource.KEEP_HISTORY : IResource.NONE, monitor); } } } } }