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;
 }
Пример #2
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;
 }