Java Code Examples for org.eclipse.jdt.core.IJavaElementDelta#F_MODIFIERS
The following examples show how to use
org.eclipse.jdt.core.IJavaElementDelta#F_MODIFIERS .
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: SimpleDelta.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected boolean toDebugString(StringBuffer buffer, int flags) { boolean prev = false; if ((flags & IJavaElementDelta.F_MODIFIERS) != 0) { if (prev) buffer.append(" | "); //$NON-NLS-1$ buffer.append("MODIFIERS CHANGED"); //$NON-NLS-1$ prev = true; } if ((flags & IJavaElementDelta.F_SUPER_TYPES) != 0) { if (prev) buffer.append(" | "); //$NON-NLS-1$ buffer.append("SUPER TYPES CHANGED"); //$NON-NLS-1$ prev = true; } return prev; }
Example 2
Source File: OpenTypeHistory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Computes whether the history needs a consistency check or not. * * @param delta the Java element delta * * @return <code>true</code> if consistency must be checked * <code>false</code> otherwise. */ private boolean processDelta(IJavaElementDelta delta) { IJavaElement elem= delta.getElement(); boolean isChanged= delta.getKind() == IJavaElementDelta.CHANGED; boolean isRemoved= delta.getKind() == IJavaElementDelta.REMOVED; switch (elem.getElementType()) { case IJavaElement.JAVA_PROJECT: if (isRemoved || (isChanged && (delta.getFlags() & IJavaElementDelta.F_CLOSED) != 0)) { return true; } return processChildrenDelta(delta); case IJavaElement.PACKAGE_FRAGMENT_ROOT: if (isRemoved || (isChanged && ( (delta.getFlags() & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0 || (delta.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0))) { return true; } return processChildrenDelta(delta); case IJavaElement.TYPE: if (isChanged && (delta.getFlags() & IJavaElementDelta.F_MODIFIERS) != 0) { return true; } if (isRemoved) { return true; } return processChildrenDelta(delta); case IJavaElement.JAVA_MODEL: case IJavaElement.PACKAGE_FRAGMENT: case IJavaElement.CLASS_FILE: if (isRemoved) { return true; } return processChildrenDelta(delta); case IJavaElement.COMPILATION_UNIT: // Not the primary compilation unit. Ignore it if (!JavaModelUtil.isPrimary((ICompilationUnit) elem)) { return false; } if (isRemoved || (isChanged && isUnknownStructuralChange(delta.getFlags()))) { return true; } return processChildrenDelta(delta); default: // fields, methods, imports ect return false; } }
Example 3
Source File: ChangeCollector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void addTypeChange(IType type, int newFlags, SimpleDelta existingDelta) throws JavaModelException { if (existingDelta != null) { switch (existingDelta.getKind()) { case IJavaElementDelta.CHANGED: // CHANGED then CHANGED int existingFlags = existingDelta.getFlags(); boolean hasChange = false; if ((existingFlags & IJavaElementDelta.F_SUPER_TYPES) != 0 && hasSuperTypeChange(type)) { existingDelta.superTypes(); hasChange = true; } if ((existingFlags & IJavaElementDelta.F_MODIFIERS) != 0 && hasVisibilityChange(type)) { existingDelta.modifiers(); hasChange = true; } if (!hasChange) { // super types and visibility are back to the ones in the existing hierarchy this.changes.remove(type); } break; // ADDED then CHANGED: leave it as ADDED // REMOVED then CHANGED: should not happen } } else { // check whether the type change affects the hierarchy SimpleDelta typeDelta = null; if ((newFlags & IJavaElementDelta.F_SUPER_TYPES) != 0 && this.hierarchy.includesTypeOrSupertype(type)) { typeDelta = new SimpleDelta(); typeDelta.superTypes(); } if ((newFlags & IJavaElementDelta.F_MODIFIERS) != 0 && (this.hierarchy.hasSupertype(type.getElementName()) || type.equals(this.hierarchy.focusType))) { if (typeDelta == null) { typeDelta = new SimpleDelta(); } typeDelta.modifiers(); } if (typeDelta != null) { this.changes.put(type, typeDelta); } } }