コード例 #1
0
 protected boolean findSourceFiles(IResourceDelta delta) throws CoreException {
   ArrayList visited =
       this.makeOutputFolderConsistent ? new ArrayList(this.sourceLocations.length) : null;
   for (int i = 0, l = this.sourceLocations.length; i < l; i++) {
     ClasspathMultiDirectory md = this.sourceLocations[i];
     if (this.makeOutputFolderConsistent
         && md.hasIndependentOutputFolder
         && !visited.contains(md.binaryFolder)) {
       // even a project which acts as its own source folder can have an independent/nested output
       // folder
       visited.add(md.binaryFolder);
       IResourceDelta binaryDelta = delta.findMember(md.binaryFolder.getProjectRelativePath());
       if (binaryDelta != null) {
         int segmentCount = binaryDelta.getFullPath().segmentCount();
         IResourceDelta[] children = binaryDelta.getAffectedChildren();
         for (int j = 0, m = children.length; j < m; j++)
           if (!checkForClassFileChanges(children[j], md, segmentCount)) return false;
       }
     }
     if (md.sourceFolder.equals(this.javaBuilder.currentProject)) {
       // skip nested source & output folders when the project is a source folder
       int segmentCount = delta.getFullPath().segmentCount();
       IResourceDelta[] children = delta.getAffectedChildren();
       for (int j = 0, m = children.length; j < m; j++)
         if (!isExcludedFromProject(children[j].getFullPath()))
           if (!findSourceFiles(children[j], md, segmentCount)) return false;
     } else {
       IResourceDelta sourceDelta = delta.findMember(md.sourceFolder.getProjectRelativePath());
       if (sourceDelta != null) {
         if (sourceDelta.getKind() == IResourceDelta.REMOVED) {
           if (JavaBuilder.DEBUG)
             System.out.println(
                 "ABORTING incremental build... found removed source folder"); //$NON-NLS-1$
           return false; // removed source folder should not make it here, but handle anyways
           // (ADDED is supported)
         }
         int segmentCount = sourceDelta.getFullPath().segmentCount();
         IResourceDelta[] children = sourceDelta.getAffectedChildren();
         try {
           for (int j = 0, m = children.length; j < m; j++)
             if (!findSourceFiles(children[j], md, segmentCount)) return false;
         } catch (CoreException e) {
           // catch the case that a package has been renamed and collides on disk with an
           // as-yet-to-be-deleted package
           if (e.getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
             if (JavaBuilder.DEBUG)
               System.out.println(
                   "ABORTING incremental build... found renamed package"); //$NON-NLS-1$
             return false;
           }
           throw e; // rethrow
         }
       }
     }
     this.notifier.checkCancel();
   }
   return true;
 }
コード例 #2
0
 protected boolean findAffectedSourceFiles(
     IResourceDelta delta, ClasspathLocation[] classFoldersAndJars, IProject prereqProject) {
   for (int i = 0, l = classFoldersAndJars.length; i < l; i++) {
     ClasspathLocation bLocation = classFoldersAndJars[i];
     // either a .class file folder or a zip/jar file
     if (bLocation != null) { // skip unchanged output folder
       IPath p = bLocation.getProjectRelativePath();
       if (p != null) {
         IResourceDelta binaryDelta = delta.findMember(p);
         if (binaryDelta != null) {
           if (bLocation instanceof ClasspathJar) {
             if (JavaBuilder.DEBUG)
               System.out.println(
                   "ABORTING incremental build... found delta to jar/zip file"); //$NON-NLS-1$
             return false; // do full build since jar file was changed (added/removed were caught
             // as classpath change)
           }
           if (binaryDelta.getKind() == IResourceDelta.ADDED
               || binaryDelta.getKind() == IResourceDelta.REMOVED) {
             if (JavaBuilder.DEBUG)
               System.out.println(
                   "ABORTING incremental build... found added/removed binary folder"); //$NON-NLS-1$
             return false; // added/removed binary folder should not make it here (classpath
             // change), but handle anyways
           }
           int segmentCount = binaryDelta.getFullPath().segmentCount();
           IResourceDelta[] children =
               binaryDelta.getAffectedChildren(); // .class files from class folder
           StringSet structurallyChangedTypes = null;
           if (bLocation.isOutputFolder())
             structurallyChangedTypes =
                 this.newState.getStructurallyChangedTypes(
                     this.javaBuilder.getLastState(prereqProject));
           for (int j = 0, m = children.length; j < m; j++)
             findAffectedSourceFiles(children[j], segmentCount, structurallyChangedTypes);
           this.notifier.checkCancel();
         }
       }
     }
   }
   return true;
 }
コード例 #3
0
 private boolean hasStructuralDelta() {
   // handle case when currentProject has only .class file folders and/or jar files... no
   // source/output folders
   IResourceDelta delta = getDelta(this.currentProject);
   if (delta != null && delta.getKind() != IResourceDelta.NO_CHANGE) {
     ClasspathLocation[] classFoldersAndJars =
         (ClasspathLocation[]) this.binaryLocationsPerProject.get(this.currentProject);
     if (classFoldersAndJars != null) {
       for (int i = 0, l = classFoldersAndJars.length; i < l; i++) {
         ClasspathLocation classFolderOrJar =
             classFoldersAndJars[i]; // either a .class file folder or a zip/jar file
         if (classFolderOrJar != null) {
           IPath p = classFolderOrJar.getProjectRelativePath();
           if (p != null) {
             IResourceDelta binaryDelta = delta.findMember(p);
             if (binaryDelta != null && binaryDelta.getKind() != IResourceDelta.NO_CHANGE)
               return true;
           }
         }
       }
     }
   }
   return false;
 }