Java Code Examples for org.eclipse.core.resources.IResourceDelta#TYPE
The following examples show how to use
org.eclipse.core.resources.IResourceDelta#TYPE .
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: ResourceUtils.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Given a resource delta, indicate whether or the delta contains a type of * resource change that GWT generally cares about. */ public static boolean isRelevantResourceChange(IResourceDelta delta) { if (delta == null) { return false; } int relevantChanges = IResourceDelta.CONTENT | IResourceDelta.DESCRIPTION | IRESOURCEDELTA_LOCAL_CHANGED | IResourceDelta.OPEN | IResourceDelta.REPLACED | IResourceDelta.TYPE; // Either added or removed (through != CHANGED), or changed in some // relevant way (through (.. & relevantChanges) != 0) if (delta.getKind() != IResourceDelta.CHANGED || (delta.getFlags() & relevantChanges) != 0) { return true; } return false; }
Example 2
Source File: ResourceManager.java From gama with GNU General Public License v3.0 | 4 votes |
@Override public boolean visit(final IResourceDelta delta) { final IResource res = delta.getResource(); boolean update = false; switch (delta.getKind()) { case IResourceDelta.OPEN: if (res.isAccessible()) { update = projectOpened((IProject) res); } else { update = projectClosed((IProject) res); } break; case IResourceDelta.ADDED: update = processAddition(res); break; case IResourceDelta.REMOVED: update = processRemoval(res); break; case IResourceDelta.CHANGED: final int flags = delta.getFlags(); if ((flags & IResourceDelta.MARKERS) != 0) { update = processMarkersChanged(res); } if ((flags & IResourceDelta.TYPE) != 0) { if (DEBUG.IS_ON()) { DEBUG.OUT("Resource type changed: " + res); } } if ((flags & IResourceDelta.CONTENT) != 0) { if (DEBUG.IS_ON()) { DEBUG.OUT("Resource contents changed: " + res); } } if ((flags & IResourceDelta.SYNC) != 0) { if (DEBUG.IS_ON()) { DEBUG.OUT("Resource sync info changed: " + res); } } if ((flags & IResourceDelta.LOCAL_CHANGED) != 0) { if (DEBUG.IS_ON()) { DEBUG.OUT("Linked resource target info changed: " + res); } update = processLinkedTargerChanged(res); } break; } if (update) { updateResource(res); } return true; // visit the children }
Example 3
Source File: PackageExplorerContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Process a resource delta. * * @param delta the delta to process * @param parent the parent * @param runnables the resulting view changes as runnables (type {@link Runnable}) * @return true if the parent got refreshed */ private boolean processResourceDelta(IResourceDelta delta, Object parent, Collection<Runnable> runnables) { int status= delta.getKind(); int flags= delta.getFlags(); IResource resource= delta.getResource(); // filter out changes affecting the output folder if (resource == null) return false; // this could be optimized by handling all the added children in the parent if ((status & IResourceDelta.REMOVED) != 0) { if (parent instanceof IPackageFragment) { // refresh one level above to deal with empty package filtering properly postRefresh(internalGetParent(parent), PARENT, parent, runnables); return true; } else { postRemove(resource, runnables); return false; } } if ((status & IResourceDelta.ADDED) != 0) { if (parent instanceof IPackageFragment) { // refresh one level above to deal with empty package filtering properly postRefresh(internalGetParent(parent), PARENT, parent, runnables); return true; } else { postAdd(parent, resource, runnables); return false; } } if ((status & IResourceDelta.CHANGED) != 0) { if ((flags & IResourceDelta.TYPE) != 0) { postRefresh(parent, PARENT, resource, runnables); return true; } } // open/close state change of a project if ((flags & IResourceDelta.OPEN) != 0) { postProjectStateChanged(internalGetParent(parent), runnables); return true; } IResourceDelta[] resourceDeltas= delta.getAffectedChildren(); int count= 0; for (int i= 0; i < resourceDeltas.length; i++) { int kind= resourceDeltas[i].getKind(); if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) { count++; if (count > 1) { postRefresh(parent, PARENT, resource, runnables); return true; } } } for (int i= 0; i < resourceDeltas.length; i++) { if (processResourceDelta(resourceDeltas[i], resource, runnables)) { return false; // early return, element got refreshed } } return false; }