本文整理汇总了Java中org.eclipse.jdt.core.IJavaElementDelta.getAffectedChildren方法的典型用法代码示例。如果您正苦于以下问题:Java IJavaElementDelta.getAffectedChildren方法的具体用法?Java IJavaElementDelta.getAffectedChildren怎么用?Java IJavaElementDelta.getAffectedChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IJavaElementDelta
的用法示例。
在下文中一共展示了IJavaElementDelta.getAffectedChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectDeltas
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
/**
* 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);
}
}
示例2: visit
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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;
}
}
示例3: getProjectDeltas
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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;
}
示例4: collectRemoved
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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]);
}
}
}
示例5: addReconcileDelta
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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);
}
}
示例6: isClasspathChange
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
/**
* 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;
}
示例7: collectRemoved
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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]);
}
}
}
示例8: addAffectedChildren
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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;
}
}
}
示例9: processDelta
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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;
}
}
示例10: visitJavaElementDelta
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
public static void visitJavaElementDelta(IJavaElementDelta delta,
IJavaElementDeltaVisitor visitor) {
if (!visitor.visit(delta)) {
return;
}
for (IJavaElementDelta childDelta : delta.getAffectedChildren()) {
visitJavaElementDelta(childDelta, visitor);
}
}
示例11: processAffectedChildren
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
private void processAffectedChildren(IJavaElementDelta delta) throws JavaModelException {
IJavaElementDelta[] children= delta.getAffectedChildren();
for (int i= 0; i < children.length; i++) {
IJavaElementDelta elementDelta= children[i];
processDelta(elementDelta);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:8,代码来源:PackagesViewFlatContentProvider.java
示例12: processDelta
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
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;
}
}
示例13: processChildrenDelta
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
protected boolean processChildrenDelta(IJavaElementDelta delta, List<IJavaElement> result) {
IJavaElementDelta[] children= delta.getAffectedChildren();
for (int i= 0; i < children.length; i++) {
processDelta(children[i], result);
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:AbstractJavaElementLabelDecorator.java
示例14: findElement
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
protected IJavaElementDelta findElement(IJavaElement unit, IJavaElementDelta delta) {
if (delta == null || unit == null)
return null;
IJavaElement element= delta.getElement();
if (unit.equals(element)) {
if (isPossibleStructuralChange(delta)) {
return delta;
}
return null;
}
if (element.getElementType() > IJavaElement.CLASS_FILE)
return null;
IJavaElementDelta[] children= delta.getAffectedChildren();
if (children == null || children.length == 0)
return null;
for (int i= 0; i < children.length; i++) {
IJavaElementDelta d= findElement(unit, children[i]);
if (d != null)
return d;
}
return null;
}
示例15: getChangedParentElement
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
/**
* Returns the most generic ancestor of the given input which has a change, or <b>null</b>
* if no such ancestor exists.
*
* @param input the input of which the result must be an ancestor
* @param delta the delta describing the model change
* @return the changed element or <code>null</code>
*/
private IJavaElement getChangedParentElement(IJavaElement input, IJavaElementDelta delta) {
IJavaElement element= delta.getElement();
if (!isAncestor(element, input))
return null;
if (element instanceof ICompilationUnit) {
ICompilationUnit cu= (ICompilationUnit) element;
if (!cu.getPrimary().equals(cu))
return null;
if (isStructuralChange(delta))
return element;
} else {
if (!onlyChildrenChanged(delta))
return element;
}
IJavaElementDelta[] affectedChildren= delta.getAffectedChildren();
for (int i= 0; i < affectedChildren.length; i++) {
IJavaElement res= getChangedParentElement(input, affectedChildren[i]);
if (res != null)
return res;
}
return null;
}