コード例 #1
0
ファイル: DeltaAnalyzer.java プロジェクト: NVIDIA/cdt-nsight
  private void processDelta(ICElementDelta delta, Set<IResource> handled) throws CoreException {
    final int flags = delta.getFlags();

    final boolean hasChildren = (flags & ICElementDelta.F_CHILDREN) != 0;
    if (hasChildren) {
      for (ICElementDelta child : delta.getAffectedChildren()) {
        processDelta(child, handled);
      }
    }

    final ICElement element = delta.getElement();
    switch (element.getElementType()) {
      case ICElement.C_UNIT:
        ITranslationUnit tu = (ITranslationUnit) element;
        if (!tu.isWorkingCopy()) {
          handled.add(element.getResource());
          switch (delta.getKind()) {
            case ICElementDelta.CHANGED:
              if ((flags & ICElementDelta.F_CONTENT) != 0) {
                fChanged.add(tu);
              }
              break;
            case ICElementDelta.ADDED:
              fChanged.add(tu);
              break;
            case ICElementDelta.REMOVED:
              fRemoved.add(tu);
              break;
          }
        }
        break;
      case ICElement.C_CCONTAINER:
        ICContainer folder = (ICContainer) element;
        if (delta.getKind() == ICElementDelta.ADDED) {
          handled.add(element.getResource());
          collectSources(folder, fChanged);
        }
        break;
    }

    if (!sSuppressPotentialTUs) {
      // Always look at the children of the resource delta (bug 343538)
      final IResourceDelta[] rDeltas = delta.getResourceDeltas();
      processResourceDelta(rDeltas, element, handled);
    }
  }
コード例 #2
0
 /**
  * Determines is structural change.
  *
  * @param cuDelta Delta to check.
  * @return <b>true</b> if structural change.
  */
 private boolean isPossibleStructuralChange(ICElementDelta cuDelta) {
   boolean ret;
   if (cuDelta.getKind() != ICElementDelta.CHANGED) {
     ret = true; // add or remove
   } else {
     final int flags = cuDelta.getFlags();
     if ((flags & ICElementDelta.F_CHILDREN) != 0) {
       ret = true;
     } else {
       ret =
           (flags & (ICElementDelta.F_CONTENT | ICElementDelta.F_FINE_GRAINED))
               == ICElementDelta.F_CONTENT;
     }
   }
   return ret;
 }