Java Code Examples for org.eclipse.jdt.core.IJavaElementDelta#F_MOVED_TO

The following examples show how to use org.eclipse.jdt.core.IJavaElementDelta#F_MOVED_TO . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceChangedManager.java    From ContentAssist with MIT License 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Source File: JavaWorkingSetUpdater.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void processJavaDelta(WorkingSetDelta result, IJavaElementDelta delta) {
	IJavaElement jElement= delta.getElement();
	int index= result.indexOf(jElement);
	int type= jElement.getElementType();
	int kind= delta.getKind();
	int flags= delta.getFlags();
	if (type == IJavaElement.JAVA_PROJECT && kind == IJavaElementDelta.CHANGED) {
		if (index != -1 && (flags & IJavaElementDelta.F_CLOSED) != 0) {
			result.set(index, ((IJavaProject)jElement).getProject());
		} else if ((flags & IJavaElementDelta.F_OPENED) != 0) {
			index= result.indexOf(((IJavaProject)jElement).getProject());
			if (index != -1)
				result.set(index, jElement);
		}
	}
	if (index != -1) {
		if (kind == IJavaElementDelta.REMOVED) {
			if ((flags & IJavaElementDelta.F_MOVED_TO) != 0) {
				result.set(index, delta.getMovedToElement());
			} else {
				result.remove(index);
			}
		}
	}
	IResourceDelta[] resourceDeltas= delta.getResourceDeltas();
	if (resourceDeltas != null) {
		for (int i= 0; i < resourceDeltas.length; i++) {
			processResourceDelta(result, resourceDeltas[i]);
		}
	}
	IJavaElementDelta[] children= delta.getAffectedChildren();
	for (int i= 0; i < children.length; i++) {
		processJavaDelta(result, children[i]);
	}
}