use of org.eclipse.jdt.core.IJavaElementDelta in project che by eclipse.
the class JavaModelOperation method addReconcileDelta.
/*
* Registers the given reconcile delta with the Java Model Manager.
*/
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);
}
// 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);
}
}
use of org.eclipse.jdt.core.IJavaElementDelta in project che by eclipse.
the class JavaSearchScope method processDelta.
/*
* @see AbstractSearchScope#processDelta(IJavaElementDelta)
*/
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;
}
}
use of org.eclipse.jdt.core.IJavaElementDelta in project che by eclipse.
the class SearchResultUpdater method elementChanged.
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));
}
Aggregations