Java Code Examples for org.eclipse.core.resources.IResourceDelta#findMember()
The following examples show how to use
org.eclipse.core.resources.IResourceDelta#findMember() .
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: JavaReconciler.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public void resourceChanged(IResourceChangeEvent e) { if (isRunningInReconcilerThread()) return; IResourceDelta delta= e.getDelta(); IResource resource= getResource(); if (delta != null && resource != null) { IResourceDelta child= delta.findMember(resource.getFullPath()); if (child != null) { IMarkerDelta[] deltas= child.getMarkerDeltas(); int i= deltas.length; while (--i >= 0) { if (deltas[i].isSubtypeOf(IMarker.PROBLEM)) { forceReconciling(); return; } } } } }
Example 3
Source File: AbstractEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void resourceChanged(IResourceChangeEvent e) { IResourceDelta delta = e.getDelta(); final FileEditorInput fInput = (FileEditorInput) getEditorInput(); final IFile file = fInput.getFile(); if (delta != null) { delta = delta.findMember(file.getFullPath()); } if (delta != null) { final int flags = delta.getFlags(); if (delta.getKind() == IResourceDelta.REMOVED && (IResourceDelta.MOVED_TO & flags) != 0) { updateEditorInput( new FileEditorInput(file.getWorkspace().getRoot().getFile(delta.getMovedToPath()))); } else if (delta.getKind() == IResourceDelta.CHANGED) { if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.REPLACED) != 0) { if (!resourceChangeEventSkip) { FileEditorInput newEditorInput = new FileEditorInput(delta.getResource().getAdapter(IFile.class)); Display.getDefault().asyncExec(() -> updateEditorInput(newEditorInput)); } } } } }
Example 4
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 5
Source File: AppEngineWebBuilder.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Override protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException { IFacetedProject project = ProjectFacetsManager.create(getProject()); if (project == null || !AppEngineStandardFacet.hasFacet(project)) { logger.fine(getProject() + ": no build required: no App Engine Standard facet"); return null; } IFile appEngineWebDescriptor = AppEngineConfigurationUtil.findConfigurationFile( project.getProject(), new Path("appengine-web.xml")); if (appEngineWebDescriptor == null || !appEngineWebDescriptor.exists()) { logger.warning(getProject() + ": no build required: missing appengine-web.xml"); return null; } if (kind == FULL_BUILD) { checkRuntimeElement(project, appEngineWebDescriptor, monitor); } else { IResourceDelta delta = getDelta(getProject()); if (delta == null || delta.findMember(appEngineWebDescriptor.getProjectRelativePath()) != null) { checkRuntimeElement(project, appEngineWebDescriptor, monitor); } else { logger.finer(getProject() + ": no build required: appengine-web.xml not changed"); } } return null; }
Example 6
Source File: DerivedSourceView.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void resourceChanged(IResourceChangeEvent event) { if (selectedSource == null || getWorkbenchPartSelection() == null) { return; } IResourceDelta delta = event.getDelta(); if (delta != null) { IResourceDelta child = delta.findMember(selectedSource.getFullPath()); if (child != null) { refreshJob.reschedule(); } } }
Example 7
Source File: DefaultResourceChangeToIssueProcessor.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected IResourceDelta getDeltaForFile(final IResourceChangeEvent event, final IFile file) { final String[] segments = file.getFullPath().segments(); IResourceDelta currentDelta = event.getDelta(); for (final String segment : segments) { final IResourceDelta matchingDelta = currentDelta.findMember(new Path(segment)); if (matchingDelta != null) { currentDelta = matchingDelta; continue; } return null; } return currentDelta; }
Example 8
Source File: FindBugsBuilder.java From spotbugs with GNU Lesser General Public License v2.1 | 4 votes |
private boolean isConfigUnchanged(IResourceDelta resourceDelta) { return resourceDelta != null && resourceDelta.findMember(new Path(".project")) == null && resourceDelta.findMember(new Path(".classpath")) == null && resourceDelta.findMember(FindbugsPlugin.DEPRECATED_PREFS_PATH) == null && resourceDelta.findMember(FindbugsPlugin.DEFAULT_PREFS_PATH) == null; }
Example 9
Source File: DeleteResourceShortcutListener.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) */ public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); switch (delta.getKind()) { case IResourceDelta.REMOVED: break; case IResourceDelta.CHANGED: List<IConnectionPoint> deleted = new ArrayList<IConnectionPoint>(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IConnectionPointManager manager = CoreIOPlugin.getConnectionPointManager(); IConnectionPoint[] projectShortcuts = manager.getConnectionPointCategory(CATEGORY_ID) .getConnectionPoints(); WorkspaceConnectionPoint connectionPoint; for (IConnectionPoint shortcut : projectShortcuts) { connectionPoint = (WorkspaceConnectionPoint) shortcut; // see if the relative path matches the changed item IResourceDelta d = delta.findMember(connectionPoint.getPath()); if (d != null && d.getKind() == IResourceDelta.REMOVED) { if (d.getMovedToPath() == null) { IResource resource = d.getResource(); if (!(resource instanceof IProject) && resource.getProject().exists() && !resource.getProject().isOpen()) { continue; } // the original container was deleted deleted.add(shortcut); } else { // the original container was moved IPath newPath = d.getMovedToPath(); IContainer newContainer; if (d.getResource() instanceof IProject) { newContainer = root.getProject(newPath.toString()); } else { newContainer = root.getFolder(newPath); } connectionPoint.setResource(newContainer); connectionPoint.setName(newContainer.getName()); } } } // if the item was deleted, remove it for (IConnectionPoint projectShortcut : deleted) { manager.removeConnectionPoint(projectShortcut); } break; } }
Example 10
Source File: PythonNatureStore.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void resourceChanged(IResourceChangeEvent event) { if (project == null) { return; } traceFunc("resourceChanged -- ", project.getName()); if (inInit) { traceFunc("END resourceChanged (inInit)"); return; } //not synched -- called when a file is changed boolean doRebuild = false; if (!project.isOpen()) { traceFunc("END resourceChanged (!open)"); return; // project closed... no need to do anything if the project is closed } IResourceDelta eventDelta = event.getDelta(); if (eventDelta == null) { traceFunc("END resourceChanged (eventDelta == null)"); return; //no delta here... move on } IResourceDelta delta = eventDelta.findMember(xmlFile.getFullPath()); if (delta != null) { try { if (loadFromFile()) { //it'll only return true if the contents really changed. doRebuild = true; } } catch (CoreException e) { traceFunc("END resourceChanged (EXCEPTION)"); throw new RuntimeException(e); } } if (doRebuild) { PythonNature nature = PythonNature.getPythonNature(project); if (nature != null) { nature.rebuildPath(); } } traceFunc("END resourceChanged -- rebuilt:", doRebuild); }