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

The following examples show how to use org.eclipse.jdt.core.IJavaElementDelta#F_OPENED . 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: 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]);
	}
}
 
Example 2
Source File: OthersWorkingSetUpdater.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void processJavaDelta(List<IAdaptable> elements, IJavaElementDelta delta) {
	IJavaElement jElement= delta.getElement();
	int type= jElement.getElementType();
	if (type == IJavaElement.JAVA_PROJECT) {
		int index= elements.indexOf(jElement);
		int kind= delta.getKind();
		int flags= delta.getFlags();
		if (kind == IJavaElementDelta.CHANGED) {
			if (index != -1 && (flags & IJavaElementDelta.F_CLOSED) != 0) {
				elements.set(index, ((IJavaProject)jElement).getProject());
				fWorkingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
			} else if ((flags & IJavaElementDelta.F_OPENED) != 0) {
				index= elements.indexOf(((IJavaProject)jElement).getProject());
				if (index != -1) {
					elements.set(index, jElement);
					fWorkingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
				}
			}
		}
		// don't visit below projects
		return;
	}
	IJavaElementDelta[] children= delta.getAffectedChildren();
	for (int i= 0; i < children.length; i++) {
		processJavaDelta(elements, children[i]);
	}
}
 
Example 3
Source File: ClasspathUpdateHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
private boolean isClasspathChanged(int flags) {
	return 0 != (flags & (IJavaElementDelta.F_CLASSPATH_CHANGED | IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED
			| IJavaElementDelta.F_CLOSED | IJavaElementDelta.F_OPENED));
}