Пример #1
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;
 }
Пример #2
0
  private SimpleLookupTable findDeltas() {
    this.notifier.subTask(
        Messages.bind(Messages.build_readingDelta, this.currentProject.getName()));
    IResourceDelta delta = getDelta(this.currentProject);
    SimpleLookupTable deltas = new SimpleLookupTable(3);
    if (delta != null) {
      if (delta.getKind() != IResourceDelta.NO_CHANGE) {
        if (DEBUG)
          System.out.println(
              "JavaBuilder: Found source delta for: "
                  + this.currentProject.getName()); // $NON-NLS-1$
        deltas.put(this.currentProject, delta);
      }
    } else {
      if (DEBUG)
        System.out.println(
            "JavaBuilder: Missing delta for: " + this.currentProject.getName()); // $NON-NLS-1$
      this.notifier.subTask(""); // $NON-NLS-1$
      return null;
    }

    Object[] keyTable = this.binaryLocationsPerProject.keyTable;
    Object[] valueTable = this.binaryLocationsPerProject.valueTable;
    nextProject:
    for (int i = 0, l = keyTable.length; i < l; i++) {
      IProject p = (IProject) keyTable[i];
      if (p != null && p != this.currentProject) {
        State s = getLastState(p);
        if (!this.lastState.wasStructurallyChanged(p, s)) { // see if we can skip its delta
          if (s.wasNoopBuild())
            continue nextProject; // project has no source folders and can be skipped
          ClasspathLocation[] classFoldersAndJars = (ClasspathLocation[]) valueTable[i];
          boolean canSkip = true;
          for (int j = 0, m = classFoldersAndJars.length; j < m; j++) {
            if (classFoldersAndJars[j].isOutputFolder())
              classFoldersAndJars[j] =
                  null; // can ignore output folder since project was not structurally changed
            else canSkip = false;
          }
          if (canSkip)
            continue nextProject; // project has no structural changes in its output folders
        }

        this.notifier.subTask(Messages.bind(Messages.build_readingDelta, p.getName()));
        delta = getDelta(p);
        if (delta != null) {
          if (delta.getKind() != IResourceDelta.NO_CHANGE) {
            if (DEBUG)
              System.out.println(
                  "JavaBuilder: Found binary delta for: " + p.getName()); // $NON-NLS-1$
            deltas.put(p, delta);
          }
        } else {
          if (DEBUG)
            System.out.println("JavaBuilder: Missing delta for: " + p.getName()); // $NON-NLS-1$
          this.notifier.subTask(""); // $NON-NLS-1$
          return null;
        }
      }
    }
    this.notifier.subTask(""); // $NON-NLS-1$
    return deltas;
  }