Java 类org.eclipse.jdt.core.IJavaElementDelta 实例源码

项目:ContentAssist    文件:ResourceChangedManager.java   
/**
 * Creates a macro corresponding to the removed delta of the change.
 * @param time the time when the change occurred
 * @param delta the removed delta of the change
 * @return the created resource macro
 */
private ResourceMacro createResourceRemovedMacro(long time, IJavaElementDelta delta) {
    IJavaElement elem = delta.getElement();
    String path = elem.getPath().toString();
    if (path == null) {
        return null;
    }

    String type = "Removed";
    if ((delta.getFlags() & IJavaElementDelta.F_MOVED_TO) != 0) {
        if (isRenamed(delta.getElement(), delta.getMovedToElement())) {
            type = "RenamedTo";
        } else {
            type = "MovedTo";
        }
    }

    return new ResourceMacro(time, type, path, elem);
}
项目:ContentAssist    文件:ResourceChangedManager.java   
/**
 * Creates a macro corresponding to the added delta of the change.
 * @param time the time when the change occurred
 * @param delta the added delta of the change
 * @return the created resource macro
 */
private ResourceMacro createResourceAddedMacro(long time, IJavaElementDelta delta) {
    IJavaElement elem = delta.getElement();
    String path = elem.getPath().toString();
    if (path == null) {
        return null;
    }

    String type = "Added";
    if ((delta.getFlags() & IJavaElementDelta.F_MOVED_FROM) != 0) {
        if (isRenamed(delta.getElement(), delta.getMovedFromElement())) {
            type = "RenamedFrom";
        } else {
            type = "MovedFrom";
        }
    }

    return new ResourceMacro(time, type, path, elem);
}
项目:ContentAssist    文件:ResourceChangedManager.java   
/**
 * Collects all the deltas of the changes.
 * @param delta the root delta of the change
 * @param deltas the collection of the deltas to be collected
 */
private void collectDeltas(IJavaElementDelta delta) {
    if (delta.getKind() == IJavaElementDelta.ADDED ||
        delta.getKind() == IJavaElementDelta.REMOVED) {
        if (!contain(delta)) {
            deltas.add(delta);
        }
    } else if (delta.getKind() == IJavaElementDelta.CHANGED &&
            ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0)) {
        if (!contain(delta)) {
            deltas.add(delta);
        }
    }

    for (IJavaElementDelta d : delta.getAffectedChildren()) {
        collectDeltas(d);
    }
}
项目:wildfly-hive    文件:ClasspathChangeListener.java   
private void visit(IJavaElementDelta delta) {
    IJavaElement el = delta.getElement();
    switch (el.getElementType()) {
    case IJavaElement.JAVA_MODEL:
        for (IJavaElementDelta c : delta.getAffectedChildren()) {
            visit(c);
        }
        break;
    case IJavaElement.JAVA_PROJECT:
        IJavaProject javaProject = (IJavaProject) el;
        if (isClasspathChanged(delta)) {
            detectionJob.analyze(javaProject);
        }
        break;
    default:
        break;
    }
}
项目:bts    文件:Storage2UriMapperJavaImpl.java   
private Set<IJavaElementDelta> getProjectDeltas(IJavaElementDelta delta) {
    IJavaElement element = delta.getElement();
    if(delta.getElement().getElementType() == IJavaElement.JAVA_PROJECT) {
        return Collections.singleton(delta);
    }
    Set<IJavaElementDelta> result = null;
    if(element instanceof IJavaModel) {
        if(delta.getAddedChildren()!=null) {
            for(IJavaElementDelta child: delta.getAffectedChildren()) {
                Set<IJavaElementDelta> projectDeltas = getProjectDeltas(child);
                if(!projectDeltas.isEmpty()) {
                    if(result == null)
                        result = newLinkedHashSet(); 
                    result.addAll(projectDeltas);
                }
            }
        }
    }
    return result == null ? Collections.<IJavaElementDelta>emptySet() : result;
}
项目:bts    文件:Storage2UriMapperJavaImpl.java   
private Set<IJavaProject> getJavaProjectsWithClasspathChange(IJavaElementDelta delta) {
    IJavaElement element = delta.getElement();
    if (element instanceof IPackageFragmentRoot) {
        IPackageFragmentRoot root = (IPackageFragmentRoot) element;
        if (delta.getKind() == IJavaElementDelta.REMOVED || delta.getKind() == IJavaElementDelta.ADDED
                || (delta.getFlags() & IJavaElementDelta.F_REORDER) != 0
                || (delta.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0
                || (delta.getFlags() & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0
                || (root.isExternal() && (delta.getFlags() & // external folders change
                (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_SOURCEATTACHED | IJavaElementDelta.F_SOURCEDETACHED)) == delta
                        .getFlags())) {
            return Collections.singleton(root.getJavaProject());
        }
    } else if (element instanceof IJavaModel) {
        return getPackageFragmentRootDeltas(delta.getAffectedChildren());
    } else if (element instanceof IJavaProject) {
        if ((delta.getFlags() & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0
                || (delta.getFlags() & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0)
            return Collections.singleton((IJavaProject) element);
        return getPackageFragmentRootDeltas(delta.getAffectedChildren());
    }
    return Collections.emptySet();
}
项目:bts    文件:AbstractJavaProjectsState.java   
private boolean isAffectingPackageFragmentRoots(IJavaElementDelta delta) {
    IJavaElement element = delta.getElement();
    if (element instanceof IPackageFragmentRoot) {
        if (delta.getKind() == IJavaElementDelta.REMOVED
            || delta.getKind() == IJavaElementDelta.ADDED
            || (delta.getFlags() & IJavaElementDelta.F_REORDER) != 0
            || (delta.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0
            || (delta.getFlags() & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0
            || (((IPackageFragmentRoot) element).isExternal() && (delta.getFlags() & // external folders change
                    (IJavaElementDelta.F_CONTENT 
                            | IJavaElementDelta.F_SOURCEATTACHED 
                            | IJavaElementDelta.F_SOURCEDETACHED)) == delta.getFlags())) {
            return true;
        }
    } else if (element instanceof IJavaModel) {
        return isAffectingPackageFragmentRoots(delta.getAffectedChildren());
    } else if (element instanceof IJavaProject) {
        if ((delta.getFlags() & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0 ||
                (delta.getFlags() & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0)
            return true;
        return isAffectingPackageFragmentRoots(delta.getAffectedChildren());
    }
    return false;
}
项目:che    文件:SearchResultUpdater.java   
private void collectRemoved(
    Set<IAdaptable> potentiallyRemovedSet,
    Set<IAdaptable> removedElements,
    IJavaElementDelta delta) {
  if (delta.getKind() == IJavaElementDelta.REMOVED) removedElements.add(delta.getElement());
  else if (delta.getKind() == IJavaElementDelta.CHANGED) {
    int flags = delta.getFlags();
    if ((flags & REMOVED_FLAGS) != 0) {
      potentiallyRemovedSet.add(delta.getElement());
    } else {
      IJavaElementDelta[] childDeltas = delta.getAffectedChildren();
      for (int i = 0; i < childDeltas.length; i++) {
        collectRemoved(potentiallyRemovedSet, removedElements, childDeltas[i]);
      }
    }
  }
  IResourceDelta[] resourceDeltas = delta.getResourceDeltas();
  if (resourceDeltas != null) {
    for (int i = 0; i < resourceDeltas.length; i++) {
      collectRemovals(removedElements, resourceDeltas[i]);
    }
  }
}
项目:che    文件:JavaModelOperation.java   
protected void addReconcileDelta(ICompilationUnit workingCopy, IJavaElementDelta delta) {
  HashMap reconcileDeltas =
      JavaModelManager.getJavaModelManager().getDeltaProcessor().reconcileDeltas;
  org.eclipse.jdt.internal.core.JavaElementDelta previousDelta =
      (org.eclipse.jdt.internal.core.JavaElementDelta) reconcileDeltas.get(workingCopy);
  if (previousDelta != null) {
    IJavaElementDelta[] children = delta.getAffectedChildren();
    for (int i = 0, length = children.length; i < length; i++) {
      org.eclipse.jdt.internal.core.JavaElementDelta child =
          (org.eclipse.jdt.internal.core.JavaElementDelta) children[i];
      previousDelta.insertDeltaTree(child.getElement(), child);
    }
    // note that the last delta's AST always takes precedence over the existing delta's AST
    // since it is the result of the last reconcile operation
    if ((delta.getFlags() & IJavaElementDelta.F_AST_AFFECTED) != 0) {
      previousDelta.changedAST(delta.getCompilationUnitAST());
    }

  } else {
    reconcileDeltas.put(workingCopy, delta);
  }
}
项目:che    文件:DeltaProcessor.java   
private void firePostChangeDelta(
    IJavaElementDelta deltaToNotify,
    IElementChangedListener[] listeners,
    int[] listenerMask,
    int listenerCount) {

  // post change deltas
  if (DEBUG) {
    System.out.println(
        "FIRING POST_CHANGE Delta [" + Thread.currentThread() + "]:"); // $NON-NLS-1$//$NON-NLS-2$
    System.out.println(
        deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); // $NON-NLS-1$
  }
  if (deltaToNotify != null) {
    // flush now so as to keep listener reactions to post their own deltas for subsequent
    // iteration
    flush();

    //          // mark the operation stack has not modifying resources since resource deltas are being
    // fired
    //          JavaModelOperation.setAttribute(JavaModelOperation.HAS_MODIFIED_RESOURCE_ATTR, null);

    notifyListeners(
        deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
  }
}
项目:che    文件:DeltaProcessor.java   
private void fireReconcileDelta(
    IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) {

  IJavaElementDelta deltaToNotify = mergeDeltas(this.reconcileDeltas.values());
  if (DEBUG) {
    System.out.println(
        "FIRING POST_RECONCILE Delta ["
            + Thread.currentThread()
            + "]:"); // $NON-NLS-1$//$NON-NLS-2$
    System.out.println(
        deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); // $NON-NLS-1$
  }
  if (deltaToNotify != null) {
    // flush now so as to keep listener reactions to post their own deltas for subsequent
    // iteration
    this.reconcileDeltas = new HashMap();

    notifyListeners(
        deltaToNotify,
        ElementChangedEvent.POST_RECONCILE,
        listeners,
        listenerMask,
        listenerCount);
  }
}
项目:PDFReporter-Studio    文件:JavaProjectClassLoader.java   
private boolean ignoreClasspathChanges(ElementChangedEvent event) {
    if (event.getDelta() == null && event.getDelta().getChangedChildren() == null)
        return true;
    for (IJavaElementDelta delta : event.getDelta().getChangedChildren()) {
        if (delta.getResourceDeltas() == null)
            return false;
        for (IResourceDelta rd : delta.getResourceDeltas()) {
            if (rd.getFullPath() == null)
                continue;
            String path = rd.getFullPath().getFileExtension();
            if (path != null && !(path.equalsIgnoreCase(FileExtension.JRXML) || path.equalsIgnoreCase(FileExtension.JASPER)))
                return false;
        }
    }
    return true;
}
项目:eclipse-filecompletion    文件:MarkerFinderImpl.java   
@Override
public void reconcile(final ReconcileContext context) {
    if (FileCompletionPreferencePage.checkDuringTyping) {
        if (context == null) {
            LOG.fine("context is null");
        } else {
            IJavaElementDelta delta = context.getDelta();
            if (delta == null) {
                LOG.fine("delta is null");
            } else {
                reconcileImpl(context, delta);
            }
        }
    }

}
项目:Eclipse-Postfix-Code-Completion    文件:DefaultJavaFoldingStructureProvider.java   
private IJavaElementDelta findElement(IJavaElement target, IJavaElementDelta delta) {

            if (delta == null || target == null)
                return null;

            IJavaElement element= delta.getElement();

            if (element.getElementType() > IJavaElement.CLASS_FILE)
                return null;

            if (target.equals(element))
                return delta;

            IJavaElementDelta[] children= delta.getAffectedChildren();

            for (int i= 0; i < children.length; i++) {
                IJavaElementDelta d= findElement(target, children[i]);
                if (d != null)
                    return d;
            }

            return null;
        }
项目:Eclipse-Postfix-Code-Completion    文件:SearchResultUpdater.java   
private void collectRemoved(Set<IAdaptable> potentiallyRemovedSet, Set<IAdaptable> removedElements, IJavaElementDelta delta) {
    if (delta.getKind() == IJavaElementDelta.REMOVED)
        removedElements.add(delta.getElement());
    else if (delta.getKind() == IJavaElementDelta.CHANGED) {
        int flags= delta.getFlags();
        if ((flags & REMOVED_FLAGS) != 0) {
            potentiallyRemovedSet.add(delta.getElement());
        } else {
            IJavaElementDelta[] childDeltas= delta.getAffectedChildren();
            for (int i= 0; i < childDeltas.length; i++) {
                collectRemoved(potentiallyRemovedSet, removedElements, childDeltas[i]);
            }
        }
    }
    IResourceDelta[] resourceDeltas= delta.getResourceDeltas();
    if (resourceDeltas != null) {
        for (int i= 0; i < resourceDeltas.length; i++) {
            collectRemovals(removedElements, resourceDeltas[i]);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeCollector.java   
private void addAffectedChildren(IJavaElementDelta delta) throws JavaModelException {
    IJavaElementDelta[] children = delta.getAffectedChildren();
    for (int i = 0, length = children.length; i < length; i++) {
        IJavaElementDelta child = children[i];
        IJavaElement childElement = child.getElement();
        switch (childElement.getElementType()) {
            case IJavaElement.IMPORT_CONTAINER:
                addChange((IImportContainer)childElement, child);
                break;
            case IJavaElement.IMPORT_DECLARATION:
                addChange((IImportDeclaration)childElement, child);
                break;
            case IJavaElement.TYPE:
                addChange((IType)childElement, child);
                break;
            case IJavaElement.INITIALIZER:
            case IJavaElement.FIELD:
            case IJavaElement.METHOD:
                addChange((IMember)childElement, child);
                break;
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:SWTTemplateCompletionProposalComputer.java   
/**
 * Does the delta indicate a classpath change?
 * @param delta the delta to inspect
 * @return true if classpath has changed
 */
private boolean isClasspathChange(IJavaElementDelta delta) {
    int flags= delta.getFlags();
    if (isClasspathChangeFlag(flags))
        return true;

    if ((flags & IJavaElementDelta.F_CHILDREN) != 0) {
        IJavaElementDelta[] children= delta.getAffectedChildren();
        for (int i= 0; i < children.length; i++) {
            if (isClasspathChangeFlag(children[i].getFlags()))
                return true;
        }
    }

    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaStructureDiffViewer.java   
/**
 * Check whether the given delta has been sent when saving this reconciler's editor.
 * 
 * @param cu the compilation unit
 * @param delta the deltas
 * @return <code>true</code> if the given delta
 * @since 3.5
 */
private boolean canIgnore(IJavaElement cu, IJavaElementDelta[] delta) {
    if (delta.length != 1)
        return false;

    int flags= delta[0].getFlags();

    // become working copy
    if (flags == IJavaElementDelta.F_PRIMARY_WORKING_COPY)
        return true;

    // save
    if (flags == IJavaElementDelta.F_PRIMARY_RESOURCE && delta[0].getElement().equals(cu))
        return true;

    return canIgnore(cu, delta[0].getAffectedChildren());
}
项目:saneclipse    文件:JFaceCompletionProposalComputer.java   
/**
 * Do the flags indicate a classpath change?
 *
 * @param flags the flags to inspect
 * @return true if the flag flags a classpath change
 */
private boolean isClasspathChangeFlag(int flags) {
    if ((flags & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0) {
        return true;
    }

    if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) {
        return true;
    }

    if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) {
        return true;
    }

    if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0) {
        return true;
    }

    return false;
}
项目:saneclipse    文件:JFaceCompletionProposalComputer.java   
/**
 * Does the delta indicate a classpath change?
 *
 * @param delta the delta to inspect
 * @return true if classpath has changed
 */
private boolean isClasspathChange(IJavaElementDelta delta) {
    final int flags = delta.getFlags();
    if (isClasspathChangeFlag(flags)) {
        return true;
    }

    if ((flags & IJavaElementDelta.F_CHILDREN) != 0) {
        final IJavaElementDelta[] children = delta.getAffectedChildren();
        for (int i = 0; i < children.length; i++) {
            if (isClasspathChangeFlag(children[i].getFlags())) {
                return true;
            }
        }
    }

    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeCollector.java   
private void addAffectedChildren(IJavaElementDelta delta) throws JavaModelException {
    IJavaElementDelta[] children = delta.getAffectedChildren();
    for (int i = 0, length = children.length; i < length; i++) {
        IJavaElementDelta child = children[i];
        IJavaElement childElement = child.getElement();
        switch (childElement.getElementType()) {
            case IJavaElement.IMPORT_CONTAINER:
                addChange((IImportContainer)childElement, child);
                break;
            case IJavaElement.IMPORT_DECLARATION:
                addChange((IImportDeclaration)childElement, child);
                break;
            case IJavaElement.TYPE:
                addChange((IType)childElement, child);
                break;
            case IJavaElement.INITIALIZER:
            case IJavaElement.FIELD:
            case IJavaElement.METHOD:
                addChange((IMember)childElement, child);
                break;
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SimpleDelta.java   
protected boolean toDebugString(StringBuffer buffer, int flags) {
    boolean prev = false;
    if ((flags & IJavaElementDelta.F_MODIFIERS) != 0) {
        if (prev)
            buffer.append(" | "); //$NON-NLS-1$
        buffer.append("MODIFIERS CHANGED"); //$NON-NLS-1$
        prev = true;
    }
    if ((flags & IJavaElementDelta.F_SUPER_TYPES) != 0) {
        if (prev)
            buffer.append(" | "); //$NON-NLS-1$
        buffer.append("SUPER TYPES CHANGED"); //$NON-NLS-1$
        prev = true;
    }
    return prev;
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeCollector.java   
private void addChange(IMember member, IJavaElementDelta newDelta) throws JavaModelException {
    int newKind = newDelta.getKind();
    switch (newKind) {
        case IJavaElementDelta.ADDED:
            ArrayList allTypes = new ArrayList();
            getAllTypesFromElement(member, allTypes);
            for (int i = 0, length = allTypes.size(); i < length; i++) {
                IType innerType = (IType)allTypes.get(i);
                addTypeAddition(innerType, (SimpleDelta)this.changes.get(innerType));
            }
            break;
        case IJavaElementDelta.REMOVED:
            allTypes = new ArrayList();
            getAllTypesFromHierarchy((JavaElement)member, allTypes);
            for (int i = 0, length = allTypes.size(); i < length; i++) {
                IType type = (IType)allTypes.get(i);
                addTypeRemoval(type, (SimpleDelta)this.changes.get(type));
            }
            break;
        case IJavaElementDelta.CHANGED:
            addAffectedChildren(newDelta);
            break;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:ChangeCollector.java   
private void addTypeRemoval(IType type, SimpleDelta existingDelta) {
    if (existingDelta != null) {
        switch (existingDelta.getKind()) {
            case IJavaElementDelta.ADDED:
                // ADDED then REMOVED
                this.changes.remove(type);
                break;
            case IJavaElementDelta.CHANGED:
                // CHANGED then REMOVED
                existingDelta.removed();
                break;
                // REMOVED then REMOVED: should not happen
        }
    } else {
        // check whether the type removal affects the hierarchy
        if (this.hierarchy.contains(type)) {
            SimpleDelta typeDelta = new SimpleDelta();
            typeDelta.removed();
            this.changes.put(type, typeDelta);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaElementDelta.java   
/**
 * @see IJavaElementDelta
 */
protected IJavaElementDelta[] getChildrenOfType(int type) {
    int length = this.affectedChildren.length;
    if (length == 0) {
        return new IJavaElementDelta[] {};
    }
    ArrayList children= new ArrayList(length);
    for (int i = 0; i < length; i++) {
        if (this.affectedChildren[i].getKind() == type) {
            children.add(this.affectedChildren[i]);
        }
    }

    IJavaElementDelta[] childrenOfType = new IJavaElementDelta[children.size()];
    children.toArray(childrenOfType);

    return childrenOfType;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:DefaultJavaFoldingStructureProvider.java   
private IJavaElementDelta findElement(IJavaElement target, IJavaElementDelta delta) {

            if (delta == null || target == null)
                return null;

            IJavaElement element= delta.getElement();

            if (element.getElementType() > IJavaElement.CLASS_FILE)
                return null;

            if (target.equals(element))
                return delta;

            IJavaElementDelta[] children= delta.getAffectedChildren();

            for (int i= 0; i < children.length; i++) {
                IJavaElementDelta d= findElement(target, children[i]);
                if (d != null)
                    return d;
            }

            return null;
        }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeCollector.java   
private void addTypeRemoval(IType type, SimpleDelta existingDelta) {
    if (existingDelta != null) {
        switch (existingDelta.getKind()) {
            case IJavaElementDelta.ADDED:
                // ADDED then REMOVED
                this.changes.remove(type);
                break;
            case IJavaElementDelta.CHANGED:
                // CHANGED then REMOVED
                existingDelta.removed();
                break;
                // REMOVED then REMOVED: should not happen
        }
    } else {
        // check whether the type removal affects the hierarchy
        if (this.hierarchy.contains(type)) {
            SimpleDelta typeDelta = new SimpleDelta();
            typeDelta.removed();
            this.changes.put(type, typeDelta);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SearchResultUpdater.java   
private void collectRemoved(Set<IAdaptable> potentiallyRemovedSet, Set<IAdaptable> removedElements, IJavaElementDelta delta) {
    if (delta.getKind() == IJavaElementDelta.REMOVED)
        removedElements.add(delta.getElement());
    else if (delta.getKind() == IJavaElementDelta.CHANGED) {
        int flags= delta.getFlags();
        if ((flags & REMOVED_FLAGS) != 0) {
            potentiallyRemovedSet.add(delta.getElement());
        } else {
            IJavaElementDelta[] childDeltas= delta.getAffectedChildren();
            for (int i= 0; i < childDeltas.length; i++) {
                collectRemoved(potentiallyRemovedSet, removedElements, childDeltas[i]);
            }
        }
    }
    IResourceDelta[] resourceDeltas= delta.getResourceDeltas();
    if (resourceDeltas != null) {
        for (int i= 0; i < resourceDeltas.length; i++) {
            collectRemovals(removedElements, resourceDeltas[i]);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaElementDelta.java   
/**
 * @see IJavaElementDelta
 */
protected IJavaElementDelta[] getChildrenOfType(int type) {
    int length = this.affectedChildren.length;
    if (length == 0) {
        return new IJavaElementDelta[] {};
    }
    ArrayList children= new ArrayList(length);
    for (int i = 0; i < length; i++) {
        if (this.affectedChildren[i].getKind() == type) {
            children.add(this.affectedChildren[i]);
        }
    }

    IJavaElementDelta[] childrenOfType = new IJavaElementDelta[children.size()];
    children.toArray(childrenOfType);

    return childrenOfType;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ChangeCollector.java   
private void addChange(IMember member, IJavaElementDelta newDelta) throws JavaModelException {
    int newKind = newDelta.getKind();
    switch (newKind) {
        case IJavaElementDelta.ADDED:
            ArrayList allTypes = new ArrayList();
            getAllTypesFromElement(member, allTypes);
            for (int i = 0, length = allTypes.size(); i < length; i++) {
                IType innerType = (IType)allTypes.get(i);
                addTypeAddition(innerType, (SimpleDelta)this.changes.get(innerType));
            }
            break;
        case IJavaElementDelta.REMOVED:
            allTypes = new ArrayList();
            getAllTypesFromHierarchy((JavaElement)member, allTypes);
            for (int i = 0, length = allTypes.size(); i < length; i++) {
                IType type = (IType)allTypes.get(i);
                addTypeRemoval(type, (SimpleDelta)this.changes.get(type));
            }
            break;
        case IJavaElementDelta.CHANGED:
            addAffectedChildren(newDelta);
            break;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SWTTemplateCompletionProposalComputer.java   
/**
 * Does the delta indicate a classpath change?
 * @param delta the delta to inspect
 * @return true if classpath has changed
 */
private boolean isClasspathChange(IJavaElementDelta delta) {
    int flags= delta.getFlags();
    if (isClasspathChangeFlag(flags))
        return true;

    if ((flags & IJavaElementDelta.F_CHILDREN) != 0) {
        IJavaElementDelta[] children= delta.getAffectedChildren();
        for (int i= 0; i < children.length; i++) {
            if (isClasspathChangeFlag(children[i].getFlags()))
                return true;
        }
    }

    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SWTTemplateCompletionProposalComputer.java   
/**
 * Do the flags indicate a classpath change?
 * @param flags the flags to inspect
 * @return true if the flag flags a classpath change
 */
private boolean isClasspathChangeFlag(int flags) {
    if ((flags & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0)
        return true;

    if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0)
        return true;

    if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0)
        return true;

    if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0)
        return true;

    return false;
}
项目:ContentAssist    文件:ResourceChangedManager.java   
/**
 * Creates a macro corresponding to the changed delta of the change.
 * @param time the time when the change occurred
 * @param delta the changed delta of the change
 * @return the created resource macro
 */
private ResourceMacro createResourceChangedMacro(long time, IJavaElementDelta delta) {
    IJavaElement elem = delta.getElement();
    String path = elem.getPath().toString();
    if (path == null) {
        return null;
    }

    if ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0) {
        // System.out.println("CONTENT CHANGED" + path);
        return null;
    }

    return new ResourceMacro(time, "Changed", path, elem);
}
项目:ContentAssist    文件:ResourceChangedManager.java   
/**
 * Tests if a given change delta was already contained in the change collection.
 * @param delta the change delta
 * @return <code>true</code> if the change delta was contained in the change collection, otherwise <code> false</code>
 */
private boolean contain(IJavaElementDelta delta) {
    String path = delta.getElement().getPath().toString();
    for (IJavaElementDelta d : deltas) {
        String p = d.getElement().getPath().toString();
        if (p.compareTo(path) == 0 && d.getKind() == delta.getKind()) {
            return true;
        }
    }
    return false;
}
项目:hybris-commerce-eclipse-plugin    文件:ClasspathChagedListener.java   
private void visit(IJavaElementDelta delta) {
    IJavaElement el = delta.getElement();
    switch (el.getElementType()) {
    case IJavaElement.JAVA_MODEL:
        visitChildren(delta);
        break;
    case IJavaElement.JAVA_PROJECT:
        if (isClasspathChanged(delta.getFlags()) && platformHolder.isCurrentPlatformProject(delta.getElement().getJavaProject())) {
            notifyClasspathChanged((IJavaProject) el);
        }
        break;
    default:
        break;
    }
}
项目:bts    文件:Storage2UriMapperJavaImpl.java   
private Set<IJavaProject> getPackageFragmentRootDeltas(IJavaElementDelta[] affectedChildren) {
    LinkedHashSet<IJavaProject> set = Sets.newLinkedHashSet();
    for (IJavaElementDelta delta : affectedChildren) {
        set.addAll(getJavaProjectsWithClasspathChange(delta));
    }
    return set;
}
项目:bts    文件:AbstractJavaProjectsState.java   
private boolean isAffectingPackageFragmentRoots(IJavaElementDelta[] affectedChildren) {
    for (IJavaElementDelta delta : affectedChildren) {
        if (isAffectingPackageFragmentRoots(delta))
            return true;
    }
    return false;
}
项目:che    文件:StandardJavaElementContentProvider.java   
/**
 * Tests if the a Java element delta contains a class path change
 *
 * @param delta the Java element delta
 * @return returns <code>true</code> if the delta contains a class path change
 */
protected boolean isClassPathChange(IJavaElementDelta delta) {

  // need to test the flags only for package fragment roots
  if (delta.getElement().getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT) return false;

  int flags = delta.getFlags();
  return (delta.getKind() == IJavaElementDelta.CHANGED
          && ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0)
      || ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0)
      || ((flags & IJavaElementDelta.F_REORDER) != 0));
}
项目:che    文件:SearchResultUpdater.java   
public void elementChanged(ElementChangedEvent event) {
  // long t0= System.currentTimeMillis();
  IJavaElementDelta delta = event.getDelta();
  Set<IAdaptable> removedElements = new HashSet<IAdaptable>();
  Set<IAdaptable> potentiallyRemovedElements = new HashSet<IAdaptable>();
  collectRemoved(potentiallyRemovedElements, removedElements, delta);
  if (removedElements.size() > 0) handleRemoved(removedElements);
  if (potentiallyRemovedElements.size() > 0) handleRemoved(potentiallyRemovedElements);
  // System.out.println(this+"handled delta in: "+(System.currentTimeMillis()-t0));
}
项目:che    文件:JavaSearchScope.java   
public void processDelta(IJavaElementDelta delta, int eventType) {
  switch (delta.getKind()) {
    case IJavaElementDelta.CHANGED:
      IJavaElementDelta[] children = delta.getAffectedChildren();
      for (int i = 0, length = children.length; i < length; i++) {
        IJavaElementDelta child = children[i];
        processDelta(child, eventType);
      }
      break;
    case IJavaElementDelta.REMOVED:
      IJavaElement element = delta.getElement();
      if (this.encloses(element)) {
        if (this.elements != null) {
          this.elements.remove(element);
        }
        String path = null;
        switch (element.getElementType()) {
          case IJavaElement.JAVA_PROJECT:
            path = ((IJavaProject) element).getProject().getFullPath().toString();
            break;
          case IJavaElement.PACKAGE_FRAGMENT_ROOT:
            path = ((IPackageFragmentRoot) element).getPath().toString();
            break;
          default:
            return;
        }
        for (int i = 0; i < this.pathsCount; i++) {
          if (this.relativePaths[i].equals(path)) {
            this.relativePaths[i] = null;
            rehash();
            break;
          }
        }
      }
      break;
  }
}