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

The following examples show how to use org.eclipse.jdt.core.IJavaElementDelta#F_ADDED_TO_CLASSPATH . 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: JavaProjectClasspathChangeAnalyzer.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * determines if the delta is a relevant change on a IPackageFragmentRoot
 * 
 * @param delta
 *            the IJavaElementDelta to analyze. the deltas element must be an instance of IPackageFragmentRoot
 */
public boolean isRelevantPackageFragmentRootChange(IJavaElementDelta delta) {
	IJavaElement element = delta.getElement();
	assert (element instanceof IPackageFragmentRoot);
	return 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() 
						|| ((IPackageFragmentRoot) element).isArchive()
					) && 
					(
						delta.getFlags() & // external folders change
						(IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED)
					) == delta.getFlags()
			);
}
 
Example 2
Source File: SWTTemplateCompletionProposalComputer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: JFaceCompletionProposalComputer.java    From saneclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: StandardJavaElementContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 5
Source File: BuildpathIndicatorLabelDecorator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void processDelta(IJavaElementDelta delta, List<IJavaElement> result) {
	IJavaElement elem= delta.getElement();

	boolean isChanged= delta.getKind() == IJavaElementDelta.CHANGED;
	boolean isRemoved= delta.getKind() == IJavaElementDelta.REMOVED;
	int flags= delta.getFlags();

	switch (elem.getElementType()) {
		case IJavaElement.JAVA_MODEL:
			processChildrenDelta(delta, result);
			return;
		case IJavaElement.JAVA_PROJECT:
			if (isRemoved || (isChanged &&
					(flags & IJavaElementDelta.F_CLOSED) != 0)) {
				return;
			}
			processChildrenDelta(delta, result);
			return;
		case IJavaElement.PACKAGE_FRAGMENT_ROOT:
			if (isRemoved) {
				return;
			}
			try {
				if ((((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) ||
						((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0))
						&& ((IPackageFragmentRoot)elem).getKind() != IPackageFragmentRoot.K_SOURCE) {
					result.add(elem);
				}
			} catch (JavaModelException e) {
				// don't update
			}
			return;
		default:
			return;
	}
}
 
Example 6
Source File: LogicalPackagesProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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));
	}
 
Example 7
Source File: ClasspathChangeListener.java    From scava with Eclipse Public License 2.0 2 votes vote down vote up
private boolean isAdd(int flags) {
	return 0 != (flags & (IJavaElementDelta.F_ADDED_TO_CLASSPATH));

}