Java Code Examples for org.eclipse.jdt.core.IJavaElementDelta#ADDED
The following examples show how to use
org.eclipse.jdt.core.IJavaElementDelta#ADDED .
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: ChangeCollector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void addTypeRemoval(IType type, SimpleDelta existingDelta) { if (existingDelta != null) { switch (existingDelta.getKind()) { case IJavaElementDelta.ADDED: // ADDED then REMOVED this.changes.remove(type); break; case IJavaElementDelta.CHANGED: // CHANGED then REMOVED existingDelta.removed(); break; // REMOVED then REMOVED: should not happen } } else { // check whether the type removal affects the hierarchy if (this.hierarchy.contains(type)) { SimpleDelta typeDelta = new SimpleDelta(); typeDelta.removed(); this.changes.put(type, typeDelta); } } }
Example 4
Source File: SimpleDelta.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected void toDebugString(StringBuffer buffer) { buffer.append("["); //$NON-NLS-1$ switch (getKind()) { case IJavaElementDelta.ADDED : buffer.append('+'); break; case IJavaElementDelta.REMOVED : buffer.append('-'); break; case IJavaElementDelta.CHANGED : buffer.append('*'); break; default : buffer.append('?'); break; } buffer.append("]: {"); //$NON-NLS-1$ toDebugString(buffer, getFlags()); buffer.append("}"); //$NON-NLS-1$ }
Example 5
Source File: ClasspathChangeListener.java From scava with Eclipse Public License 2.0 | 5 votes |
private void visit(IJavaElementDelta delta) { IJavaElement el = delta.getElement(); switch (el.getElementType()) { case IJavaElement.JAVA_MODEL: visitChildren(delta); break; case IJavaElement.JAVA_PROJECT: if (isClasspathChanged(delta.getFlags())) { System.out.println(); IJavaElementDelta[] affectedChildren = delta.getAffectedChildren(); for (IJavaElementDelta iJavaElementDelta : affectedChildren) { if (iJavaElementDelta.getKind() == IJavaElementDelta.CHANGED || iJavaElementDelta.getKind() == IJavaElementDelta.ADDED) { int flags = iJavaElementDelta.getFlags(); if (isRemove(flags)) { Activator.getDefault().getEventBus().post(new ClasspathChangeEvent( iJavaElementDelta.getElement().getElementName(), ClasspathChangeEventType.DELETED)); } if (isAdd(flags)) { Activator.getDefault().getEventBus().post(new ClasspathChangeEvent( iJavaElementDelta.getElement().getElementName(), ClasspathChangeEventType.ADDED)); } } } } break; default: break; } }
Example 6
Source File: DeltaConverter.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void convertCompilationUnit(IJavaElementDelta delta, List<IResourceDescription.Delta> result) { if (delta.getKind() == IJavaElementDelta.ADDED) { convertAddedCompilationUnit(delta, result); } else if (delta.getKind() == IJavaElementDelta.REMOVED) { convertRemovedTypes(delta, result); } else { convertChangedCompilationUnit(delta, result); } }
Example 7
Source File: DeltaConverter.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.5 */ protected void convertPackageFragment(IJavaElementDelta delta, List<IResourceDescription.Delta> result) { if (delta.getKind() == IJavaElementDelta.ADDED) { convertAddedPackageFragment(delta, result); } else if (delta.getKind() == IJavaElementDelta.REMOVED) { convertRemovedTypes(delta, result); } }
Example 8
Source File: ChangeCollector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void addChange(IImportContainer importContainer, IJavaElementDelta newDelta) throws JavaModelException { int newKind = newDelta.getKind(); if (newKind == IJavaElementDelta.CHANGED) { addAffectedChildren(newDelta); return; } SimpleDelta existingDelta = (SimpleDelta)this.changes.get(importContainer); if (existingDelta != null) { switch (newKind) { case IJavaElementDelta.ADDED: if (existingDelta.getKind() == IJavaElementDelta.REMOVED) { // REMOVED then ADDED this.changes.remove(importContainer); } break; case IJavaElementDelta.REMOVED: if (existingDelta.getKind() == IJavaElementDelta.ADDED) { // ADDED then REMOVED this.changes.remove(importContainer); } break; // CHANGED handled above } } else { SimpleDelta delta = new SimpleDelta(); switch (newKind) { case IJavaElementDelta.ADDED: delta.added(); break; case IJavaElementDelta.REMOVED: delta.removed(); break; } this.changes.put(importContainer, delta); } }
Example 9
Source File: ChangeCollector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void addChange(IImportDeclaration importDecl, IJavaElementDelta newDelta) { SimpleDelta existingDelta = (SimpleDelta)this.changes.get(importDecl); int newKind = newDelta.getKind(); if (existingDelta != null) { switch (newKind) { case IJavaElementDelta.ADDED: if (existingDelta.getKind() == IJavaElementDelta.REMOVED) { // REMOVED then ADDED this.changes.remove(importDecl); } break; case IJavaElementDelta.REMOVED: if (existingDelta.getKind() == IJavaElementDelta.ADDED) { // ADDED then REMOVED this.changes.remove(importDecl); } break; // CHANGED cannot happen for import declaration } } else { SimpleDelta delta = new SimpleDelta(); switch (newKind) { case IJavaElementDelta.ADDED: delta.added(); break; case IJavaElementDelta.REMOVED: delta.removed(); break; } this.changes.put(importDecl, delta); } }
Example 10
Source File: ElementChangedListener.java From JDeodorant with MIT License | 5 votes |
private void processDelta(IJavaElementDelta delta) { IJavaElement javaElement = delta.getElement(); switch(javaElement.getElementType()) { case IJavaElement.JAVA_MODEL: case IJavaElement.JAVA_PROJECT: case IJavaElement.PACKAGE_FRAGMENT_ROOT: case IJavaElement.PACKAGE_FRAGMENT: IJavaElementDelta[] affectedChildren = delta.getAffectedChildren(); for(IJavaElementDelta affectedChild : affectedChildren) { processDelta(affectedChild); } break; case IJavaElement.COMPILATION_UNIT: ICompilationUnit compilationUnit = (ICompilationUnit)javaElement; if(delta.getKind() == IJavaElementDelta.ADDED) { CompilationUnitCache.getInstance().compilationUnitAdded(compilationUnit); } else if(delta.getKind() == IJavaElementDelta.REMOVED) { CompilationUnitCache.getInstance().compilationUnitRemoved(compilationUnit); } else if(delta.getKind() == IJavaElementDelta.CHANGED) { if((delta.getFlags() & IJavaElementDelta.F_FINE_GRAINED) != 0) { CompilationUnitCache.getInstance().compilationUnitChanged(compilationUnit); } } } }
Example 11
Source File: SimpleDelta.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public void added() { this.kind = IJavaElementDelta.ADDED; }