コード例 #1
0
 private void delete(
     IResource resource,
     OutputConfiguration config,
     EclipseResourceFileSystemAccess2 access,
     IProgressMonitor monitor)
     throws CoreException {
   if (monitor.isCanceled()) {
     throw new OperationCanceledException();
   }
   if (resource instanceof IContainer) {
     IContainer container = (IContainer) resource;
     for (IResource child : container.members()) {
       delete(child, config, access, monitor);
     }
     container.delete(IResource.KEEP_HISTORY, monitor);
   } else if (resource instanceof IFile) {
     IFile file = (IFile) resource;
     access.deleteFile(file, config.getName(), monitor);
   } else {
     resource.delete(IResource.KEEP_HISTORY, monitor);
   }
 }
コード例 #2
0
 /** @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);
         }
       }
     }
   }
 }