Java Code Examples for org.eclipse.jdt.core.IJavaElementDelta#F_CONTENT
The following examples show how to use
org.eclipse.jdt.core.IJavaElementDelta#F_CONTENT .
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 |
/** * Collects all the deltas of the changes. * @param delta the root delta of the change * @param deltas the collection of the deltas to be collected */ private void collectDeltas(IJavaElementDelta delta) { if (delta.getKind() == IJavaElementDelta.ADDED || delta.getKind() == IJavaElementDelta.REMOVED) { if (!contain(delta)) { deltas.add(delta); } } else if (delta.getKind() == IJavaElementDelta.CHANGED && ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0)) { if (!contain(delta)) { deltas.add(delta); } } for (IJavaElementDelta d : delta.getAffectedChildren()) { collectDeltas(d); } }
Example 2
Source File: JavaProjectClasspathChangeAnalyzer.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * 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 3
Source File: ResourceChangedManager.java From ContentAssist with MIT License | 5 votes |
/** * Creates a macro corresponding to the changed delta of the change. * @param time the time when the change occurred * @param delta the changed delta of the change * @return the created resource macro */ private ResourceMacro createResourceChangedMacro(long time, IJavaElementDelta delta) { IJavaElement elem = delta.getElement(); String path = elem.getPath().toString(); if (path == null) { return null; } if ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0) { // System.out.println("CONTENT CHANGED" + path); return null; } return new ResourceMacro(time, "Changed", path, elem); }
Example 4
Source File: DeltaConverter.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @return a possibly empty list of converted deltas. */ public List<IResourceDescription.Delta> convert(IJavaElementDelta delta) { /* * a file was opened or closed or there is no relevant structural change in the delta * - we do not expect an IResourceDescription.Delta * * Deltas without any affected children or without content changes * are considered to be irrelevant */ if (delta.getFlags() == IJavaElementDelta.F_AST_AFFECTED || delta.getFlags() == (IJavaElementDelta.F_AST_AFFECTED | IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_FINE_GRAINED)) { return Collections.emptyList(); } try { List<IResourceDescription.Delta> result = Lists.newArrayListWithExpectedSize(2); convertCompilationUnits(delta, result); return result; } catch (Throwable throwable) { if (throwable instanceof VirtualMachineError) { throw (VirtualMachineError) throwable; } if (LOGGER.isEnabledFor(Level.ERROR)) { LOGGER.error(throwable.getMessage(), throwable); } return Collections.emptyList(); } }
Example 5
Source File: DefaultJavaFoldingStructureProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void elementChanged(ElementChangedEvent e) { IJavaElementDelta delta= findElement(fInput, e.getDelta()); if (delta != null && (delta.getFlags() & (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_CHILDREN)) != 0) { if (shouldIgnoreDelta(e.getDelta().getCompilationUnitAST(), delta)) return; fUpdatingCount++; try { update(createContext(false)); } finally { fUpdatingCount--; } } }
Example 6
Source File: JavaOutlinePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private boolean isPossibleStructuralChange(IJavaElementDelta cuDelta) { if (cuDelta.getKind() != IJavaElementDelta.CHANGED) { return true; // add or remove } int flags= cuDelta.getFlags(); if ((flags & IJavaElementDelta.F_CHILDREN) != 0) { return true; } return (flags & (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_FINE_GRAINED)) == IJavaElementDelta.F_CONTENT; }
Example 7
Source File: OpenTypeHistory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private boolean isUnknownStructuralChange(int flags) { if ((flags & IJavaElementDelta.F_CONTENT) == 0) return false; return (flags & IJavaElementDelta.F_FINE_GRAINED) == 0; }
Example 8
Source File: PackageExplorerContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private static boolean isStructuralCUChange(int flags) { // No refresh on working copy creation (F_PRIMARY_WORKING_COPY) return (flags & IJavaElementDelta.F_CHILDREN) != 0 || (flags & (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_FINE_GRAINED)) == IJavaElementDelta.F_CONTENT; }
Example 9
Source File: JavaEditorBreadcrumb.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private boolean isStructuralChange(IJavaElementDelta delta) { if (delta.getKind() != IJavaElementDelta.CHANGED) return true; return (delta.getFlags() & IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_FINE_GRAINED) == IJavaElementDelta.F_CONTENT; }
Example 10
Source File: TypeHierarchyLifeCycle.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private boolean isPossibleStructuralChange(int flags) { return (flags & (IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_FINE_GRAINED)) == IJavaElementDelta.F_CONTENT; }
Example 11
Source File: InterfaceIndicatorLabelDecorator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@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_PROJECT: if (isRemoved || (isChanged && (flags & IJavaElementDelta.F_CLOSED) != 0)) { return; } processChildrenDelta(delta, result); return; case IJavaElement.PACKAGE_FRAGMENT_ROOT: if (isRemoved || (isChanged && ( (flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0 || (flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0))) { return; } processChildrenDelta(delta, result); return; case IJavaElement.PACKAGE_FRAGMENT: if (isRemoved) return; processChildrenDelta(delta, result); return; case IJavaElement.TYPE: case IJavaElement.CLASS_FILE: return; case IJavaElement.JAVA_MODEL: processChildrenDelta(delta, result); return; case IJavaElement.COMPILATION_UNIT: // Not the primary compilation unit. Ignore it if (!JavaModelUtil.isPrimary((ICompilationUnit) elem)) { return; } if (isChanged && ((flags & IJavaElementDelta.F_CONTENT) != 0 || (flags & IJavaElementDelta.F_FINE_GRAINED) != 0)) { if (delta.getAffectedChildren().length == 0) return; result.add(elem); } return; default: // fields, methods, imports ect return; } }
Example 12
Source File: JavaStructureDiffViewer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Test whether the given delta represents a significant change. * * @param cuDelta the Java element delta * @return <code>true</code> if the delta represents a content change * @since 3.5 */ private boolean isContentChange(IJavaElementDelta cuDelta) { int flags= cuDelta.getFlags(); return flags != IJavaElementDelta.F_AST_AFFECTED && (cuDelta.getKind() == IJavaElementDelta.CHANGED || (flags & IJavaElementDelta.F_CONTENT) != 0); }