Java Code Examples for org.eclipse.core.resources.IResourceDelta#DESCRIPTION
The following examples show how to use
org.eclipse.core.resources.IResourceDelta#DESCRIPTION .
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: ProjectOpenedOrClosedListener.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @since 2.17 */ protected boolean visitResourceDelta(IResourceDelta delta, final Set<IProject> accumulator) { if (delta.getResource() instanceof IWorkspaceRoot) return true; if (delta.getResource() instanceof IProject) { IProject project = (IProject) delta.getResource(); if ((delta.getKind() & IResourceDelta.CHANGED) != 0 && project.isOpen()) { if ((delta.getFlags() & IResourceDelta.OPEN) != 0) { accumulator.add(project); } if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { if ((delta.findMember(new Path(".project")) != null) && XtextProjectHelper.hasNature(project) && XtextProjectHelper.hasBuilder(project)) accumulator.add(project); else if (!XtextProjectHelper.hasNature(project)) { scheduleRemoveProjectJobIfNecessary(project, delta); } } } } return false; }
Example 2
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 3
Source File: OthersWorkingSetUpdater.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void resourceChanged(IResourceChangeEvent event) { if (fWorkingSet == null) return; // not yet initialized IResourceDelta delta= event.getDelta(); IResourceDelta[] affectedChildren= delta.getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED, IResource.PROJECT); if (affectedChildren.length > 0) { updateElements(); } else { affectedChildren= delta.getAffectedChildren(IResourceDelta.CHANGED, IResource.PROJECT); for (int i= 0; i < affectedChildren.length; i++) { IResourceDelta projectDelta= affectedChildren[i]; if ((projectDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { updateElements(); // one is enough return; } } } }
Example 4
Source File: N4JSAllContainersState.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Indicates whether the resource change represented by the given {@code delta} does affect this container state. * * Note that this method will only be invoked until a container-state-affecting delta is found. Thus, it is not * suitable for listening for all resource changes that may occur in the workspace. */ @Override protected boolean isAffectingContainerState(IResourceDelta delta) { if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED) { String fileExtension = delta.getFullPath().getFileExtension(); if (null != fileExtension && fileExtensionTypeHelper.isTypable(fileExtension)) { return true; } if (IN4JSProject.PACKAGE_JSON.equals(delta.getFullPath().lastSegment())) { return true; } if (delta.getResource() instanceof IProject) { return true; } if (delta.getResource() instanceof IFolder && isSourceContainerModification(delta)) { return true; } return false; } else if (delta.getKind() == IResourceDelta.CHANGED && delta.getResource() instanceof IProject) { if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { return true; } if ((delta.getFlags() & IResourceDelta.OPEN) != 0) { return true; } return false; } if (packageJSONFileHasBeenChanged(delta)) { return true; } return false; }
Example 5
Source File: ProjectStateChangeListener.java From n4js with Eclipse Public License 1.0 | 5 votes |
private boolean collectAffectedProjects(IResourceDelta delta, Set<IProject> accumulator) { IResource resource = delta.getResource(); if (resource instanceof IProject && "RemoteSystemsTempFiles".equals(resource.getName())) { return false; } if (resource instanceof IWorkspaceRoot) return true; if (resource instanceof IProject) { IProject project = (IProject) resource; if ("RemoteSystemsTempFiles".equals(resource.getName())) { return false; } if ((delta.getKind() & IResourceDelta.CHANGED) != 0 && project.isOpen()) { if ((delta.getFlags() & IResourceDelta.OPEN) != 0) { accumulator.add(project); } if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { if ((delta.findMember(new Path(".project")) != null) && XtextProjectHelper.hasNature(project) && XtextProjectHelper.hasBuilder(project)) { accumulator.add(project); } } } return true; } if (resource instanceof IFolder) { if (N4JSGlobals.NODE_MODULES.equals(resource.getName())) { accumulator.add(resource.getProject()); } else if ((delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED) && isSourceContainerModification(resource)) { accumulator.add(resource.getProject()); } } return false; }
Example 6
Source File: AbstractAllContainersState.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.3 */ protected boolean isAffectingContainerState(IResourceDelta delta) { if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED) { if (delta.getResource() instanceof IStorage) { if (getUri((IStorage) delta.getResource()) != null) { return true; } } } else if (delta.getKind() == IResourceDelta.CHANGED && delta.getResource() instanceof IProject) { if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { return true; } } return false; }
Example 7
Source File: FilterUpdater.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void resourceChanged(IResourceChangeEvent event) { if (fViewer.getInput() == null) { return; } IResourceDelta delta= event.getDelta(); if (delta == null) return; IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED); for (int i= 0; i < projDeltas.length; i++) { IResourceDelta pDelta= projDeltas[i]; if ((pDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { IProject project= (IProject) pDelta.getResource(); if (needsRefiltering(project)) { final Control ctrl= fViewer.getControl(); if (ctrl != null && !ctrl.isDisposed()) { // async is needed due to bug 33783 ctrl.getDisplay().asyncExec(new Runnable() { public void run() { if (!ctrl.isDisposed()) fViewer.refresh(false); } }); } return; // one refresh is good enough } } } }