Java Code Examples for org.eclipse.core.resources.IResourceDelta

The following examples show how to use org.eclipse.core.resources.IResourceDelta. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * {@inheritDoc}
 */
public void elementChanged(ElementChangedEvent event) {
	IWorkingSet[] workingSets;
	synchronized(fWorkingSets) {
		workingSets= fWorkingSets.toArray(new IWorkingSet[fWorkingSets.size()]);
	}
	for (int w= 0; w < workingSets.length; w++) {
		WorkingSetDelta workingSetDelta= new WorkingSetDelta(workingSets[w]);
		processJavaDelta(workingSetDelta, event.getDelta());
		IResourceDelta[] resourceDeltas= event.getDelta().getResourceDeltas();
		if (resourceDeltas != null) {
			for (int r= 0; r < resourceDeltas.length; r++) {
				processResourceDelta(workingSetDelta, resourceDeltas[r]);
			}
		}
		workingSetDelta.process();
	}
}
 
Example 2
@Override
public void resourceChanged(IResourceChangeEvent event) {
    try {
        if (event != null && event.getDelta() != null) {
            event.getDelta().accept(new IResourceDeltaVisitor() {

                @Override
                public boolean visit(IResourceDelta delta) throws CoreException {
                    IProject project = repository.getProject();
                    if (project.isAccessible()) {
                        IFile projectFile = project.getFile(".project");
                        final IResource resource = delta.getResource();
                        if (Objects.equals(resource, projectFile)) {
                            return checkVersion(project);
                        }
                    }
                    return true;
                }
            });
        }
    } catch (CoreException e) {
        BonitaStudioLog.error(e);
    }
}
 
Example 3
Source Project: thym   Source File: PluginContentProvider.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void resourceChanged(IResourceChangeEvent event) {
	IResourceDelta delta = event.getDelta();
	if (viewer == null || delta == null)
		return;
	IResourceDelta[] deltas = delta.getAffectedChildren();
	for (int i = 0; i < deltas.length; i++) {
		if (deltas[i].findMember(new Path(PlatformConstants.DIR_PLUGINS)) != null) {
			viewer.getControl().getDisplay().asyncExec(new Runnable() {
				@Override
				public void run() {
					viewer.refresh();
				}
			});
			return;
		}
	}
}
 
Example 4
Source Project: Pydev   Source File: PydevGrouperVisitor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This will use the internal builders to traverse the delta. Note that the resource is always a valid
 * python file and is also always located in the pythonpath.
 */
@Override
protected void onVisitDelta(IResourceDelta delta) {
    //Note: removals happen now, additions and changes happen later (so that renames are
    //properly treated).

    switch (delta.getKind()) {
        case IResourceDelta.ADDED:
        case IResourceDelta.CHANGED:
            delayedVisits.add(delta);
            break;
        case IResourceDelta.REMOVED:
            IResource resource = delta.getResource();
            memo.put(PyDevBuilderVisitor.DOCUMENT_TIME, System.currentTimeMillis());
            visitRemovedResource(resource, null, monitor);
            break;
    }
}
 
Example 5
Source Project: thym   Source File: ConfigEditor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public boolean visit(IResourceDelta delta) {
	if (delta == null
			|| !delta.getResource().equals(
					((FileEditorInput) getEditorInput()).getFile())){
		return true;
	}

	if (delta.getKind() == IResourceDelta.REMOVED) {
		if ((IResourceDelta.MOVED_TO & delta.getFlags()) == 0) {
			if (!isDirty())
				closeEditor();
		} else { 
			final IFile newFile = ResourcesPlugin.getWorkspace()
					.getRoot().getFile(delta.getMovedToPath());
			Display display = getSite().getShell().getDisplay();
			display.asyncExec(new Runnable() {
				public void run() {
					editorPart.setInput(new FileEditorInput(newFile));
				}
			});
		}
	}
	return false;
}
 
Example 6
protected void handleSVNDir(IContainer svnDir, int kind) {
	if((kind & IResourceDelta.ALL_WITH_PHANTOMS)!=0) {
		if(kind==IResourceDelta.ADDED) {
			// should this dir be made team-private? If it contains Entries then yes!
			IFile entriesFile = svnDir.getFile(new Path(SVNConstants.SVN_ENTRIES));

			if (entriesFile.exists() &&  !svnDir.isTeamPrivateMember()) {
				try {
					svnDir.setTeamPrivateMember(true);			
					if(Policy.DEBUG_METAFILE_CHANGES) {
						System.out.println("[svn] found a new SVN meta folder, marking as team-private: " + svnDir.getFullPath()); //$NON-NLS-1$
					}
				} catch(CoreException e) {
					SVNProviderPlugin.log(SVNException.wrapException(svnDir, Policy.bind("SyncFileChangeListener.errorSettingTeamPrivateFlag"), e)); //$NON-NLS-1$
				}
			}
		}
	}
}
 
Example 7
public boolean visit(IResourceDelta delta) {
	boolean clear = false;
	IResource resource = delta.getResource();

	if (resource instanceof IFile) {
		switch (delta.getKind()) {
		case IResourceDelta.ADDED:
		case IResourceDelta.REMOVED:
			clear = true;
			break;
		case IResourceDelta.CHANGED:
			int flags = delta.getFlags();
			if ((flags & (IResourceDelta.CONTENT | IResourceDelta.LOCAL_CHANGED)) != 0) {
				clear = true;
			}
		default:
			break;
		}
		if (clear) {
			model.clearFileCache((IFile) resource);
		}
	}
	return true;
}
 
Example 8
Source Project: hybris-commerce-eclipse-plugin   Source File: TsvBuilder.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
		throws CoreException {
	//TODO find referenced extensions and their eclipse projects and return them
	if (kind == CLEAN_BUILD) {
		clean(monitor);
	}
	else if (kind == FULL_BUILD) {
		fullBuild(monitor);
	} else {
		IResourceDelta delta = getDelta(getProject());
		if (delta == null) {
			fullBuild(monitor);
		} else {
			incrementalBuild(delta, monitor);
		}
	}
	return null;
}
 
Example 9
Source Project: typescript.java   Source File: TypeScriptBuilder.java    License: MIT License 6 votes vote down vote up
@Override
protected IProject[] build(int kind, Map<String, String> args, final IProgressMonitor monitor)
		throws CoreException {
	IProject project = this.getProject();
	if (!TypeScriptResourceUtil.isTypeScriptProject(project)) {
		return null;
	}

	IIDETypeScriptProject tsProject = TypeScriptResourceUtil.getTypeScriptProject(project);
	if (kind == FULL_BUILD) {
		fullBuild(tsProject, monitor);
	} else {
		IResourceDelta delta = getDelta(getProject());
		if (delta == null) {
			fullBuild(tsProject, monitor);
		} else {
			incrementalBuild(tsProject, delta, monitor);
		}
	}
	return null;
}
 
Example 10
/**
 * Returns the IHierarchicalDataModel. If one does not exists, this method
 * will create one and register a workspace listener.
 *
 * @return
 */
public static IHierarchicalDataModel getHierarchicalDataModel() {
	IHierarchicalDataModelGetFileModel getModel = new GetFileModelFactory();
	final HierarchicalDataModel model = new HierarchicalDataModel(getModel);

	IResourceChangeListener listener = new IResourceChangeListener() {

		@Override
		public void resourceChanged(IResourceChangeEvent event) {
			IResourceDelta delta = event.getDelta();
			if (delta != null) {
				try {
					delta.accept(new DeltaVisitor(model));
				} catch (CoreException e) {
					// our visitor does not throw CoreException
				}
			}
		}
	};
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	workspace.addResourceChangeListener(listener);

	return model;
}
 
Example 11
Source Project: xds-ide   Source File: XBookmarksPlugin.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void resourceChanged(IResourceChangeEvent event) {
    if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
        try {
            event.getDelta().accept(new IResourceDeltaVisitor() {
                @Override
                public boolean visit(IResourceDelta delta) throws CoreException {
                    IResource res = delta.getResource();
                    switch (delta.getKind()) {
                    case IResourceDelta.REMOVED:
                        XBookmarksUtils.removeBookmarksFrom(res);
                        break;
                    }
                    return true; // visit the children
                }
            });
        } catch (CoreException e) {}
    }
}
 
Example 12
Source Project: xds-ide   Source File: XdsModel.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void handleChangeResource(IResourceDelta rootDelta, IResource affectedResource, boolean isContentChanged) {
    if (DEBUG_PRINT_OF_THE_CHANGE_NOTIFICATIONS) System.out.println("Change resource : " + affectedResource); //$NON-NLS-1$
    if (workspaceRoot == affectedResource) { // ignore plain workspace changes
        return;
    }
    
    if (affectedResource instanceof IProject) {
        IProject p = (IProject)affectedResource;
        IXdsProject xdsProject = getXdsProjectBy(p);
        if (xdsProject == null) { // this will be the case when the project is re-opened
            refreshProject(p);
            postponeProjectForRebuild(affectedResource.getProject());
        }
    }
    else if (affectedResource instanceof IFile) {
        IXdsResource xdsElement = getWorkspaceXdsElement(affectedResource);
        if (xdsElement != null) {
            xdsElement.resourceChanged();
        }
    }
}
 
Example 13
Source Project: typescript.java   Source File: ProblemManager.java    License: MIT License 6 votes vote down vote up
private void handleResourceChanged(IResourceChangeEvent event) {
	IResourceDelta delta = event.getDelta();
	if (delta == null) {
		return;
	}

	// Find resourced whose problems changed and report them to listeners
	Set<IResource> changedResources = new HashSet<>();
	try {
		delta.accept(new ProblemMarkerDeltaVisitor(changedResources));
	} catch (CoreException e) {
		TypeScriptCorePlugin.logError(e);
	}
	if (!changedResources.isEmpty()) {
		notifyListeners(Collections.unmodifiableSet(changedResources));
	}
}
 
Example 14
public void resourceChanged(IResourceChangeEvent event) {
	HashSet<IResource> changedElements= new HashSet<IResource>();

	try {
		IResourceDelta delta= event.getDelta();
		if (delta != null)
			delta.accept(new ProjectErrorVisitor(changedElements));
	} catch (CoreException e) {
		JavaPlugin.log(e.getStatus());
	}

	if (!changedElements.isEmpty()) {
		boolean hasChanges= false;
		synchronized (this) {
			if (fResourcesWithMarkerChanges.isEmpty()) {
				fResourcesWithMarkerChanges= changedElements;
				hasChanges= true;
			} else {
				hasChanges= fResourcesWithMarkerChanges.addAll(changedElements);
			}
		}
		if (hasChanges) {
			fireChanges();
		}
	}
}
 
Example 15
Source Project: spotbugs   Source File: RefreshJob.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public int compare(DeltaInfo o1, DeltaInfo o2) {
    if (o1.changeKind == o2.changeKind) {
        return 0;
    }
    if (o1.changeKind == IResourceDelta.REMOVED) {
        return -1;
    }
    return 1;
}
 
Example 16
Source Project: Pydev   Source File: ProblemMarkerManager.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void checkInvalidate(IResourceDelta delta, IResource resource) {
    int kind = delta.getKind();
    if (kind == IResourceDelta.REMOVED || kind == IResourceDelta.ADDED
            || (kind == IResourceDelta.CHANGED && isErrorDelta(delta))) {
        // invalidate the resource and all parents
        while (resource.getType() != IResource.ROOT && fChangedElements.add(resource)) {
            resource = resource.getParent();
        }
    }
}
 
Example 17
Source Project: n4js   Source File: N4JSAllContainersState.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 18
Source Project: RADL   Source File: RadlValidatingVisitorTest.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void validatesNewlyAddedRadlFile() throws CoreException {
  IResourceDelta delta = someResourceDelta();
  when(delta.getKind()).thenReturn(IResourceDelta.ADDED);

  visitor.visit(delta);

  verify(validator).validate(any(InputStream.class), any(Collection.class));
}
 
Example 19
Source Project: RADL   Source File: RadlBuilder.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
    throws CoreException {
  if (kind == FULL_BUILD) {
    fullBuild();
  } else {
    IResourceDelta delta = getDelta(getProject());
    if (delta == null) {
      fullBuild();
    } else {
      incrementalBuild(delta);
    }
  }
  return new IProject[0];
}
 
Example 20
Source Project: n4js   Source File: ProjectStateChangeListener.java    License: Eclipse Public License 1.0 5 votes vote down vote up
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 21
Source Project: JReFrameworker   Source File: JReFrameworkerBuilder.java    License: MIT License 5 votes vote down vote up
/**
 * Incrementally builds the project given a set of file changes
 * 
 * Reference: http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2FresAdv_builders.htm
 * 
 * @param delta
 * @param monitor
 * @throws CoreException
 */
protected void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor) throws CoreException {
	if(JReFrameworkerPreferences.isVerboseLoggingEnabled()) Log.info("Incremental Build");
	JReFrameworkerProject jrefProject = incrementalBuilder.getJReFrameworkerProject();
	BuildDeltaVisitor deltaVisitor = new BuildDeltaVisitor(jrefProject);
	delta.accept(deltaVisitor);
	if(!deltaVisitor.getDeltaBuildFilesToProcess().isEmpty()){
		// TODO: this could be improved to just detect changes to individual libraries...but too much work for now...
		// changes to the build file require a full build
		clean(monitor);
	} else {
		// process incremental changes
		// changes could be to source code, which will change the class files
		// changes could also be to class files only (if a build error was resolved but the source was not touched)
		Set<DeltaSource> sourceDeltas = deltaVisitor.getDeltaSourcesToProcess();
		if(!sourceDeltas.isEmpty()){
			try {
				IncrementalBuilder.PostBuildAction postBuildAction = incrementalBuilder.build(sourceDeltas, monitor);
				if(postBuildAction == IncrementalBuilder.PostBuildAction.UPDATE_CLASSPATH){
					updateBuildClasspath(jrefProject);
				} else if(postBuildAction == IncrementalBuilder.PostBuildAction.CLEAN_REBUILD) {
					if(JReFrameworkerPreferences.isVerboseLoggingEnabled()){
						Log.info("Rebuilding");
					}
					clean(monitor);
				}
			} catch (IncrementalBuilderException e) {
				Log.error("Error incrementally building JReFrameworker project", e);
			}
		}
	}
	if(JReFrameworkerPreferences.isVerboseLoggingEnabled()){
		Log.info("Incremental build complete");
	}
}
 
Example 22
Source Project: neoscada   Source File: ProjectBuilder.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean visit ( final IResourceDelta delta )
{
    final IResource resource = delta.getResource ();

    return handleResource ( delta, resource, this.adapterFactory, this.extensions, this.monitor );
}
 
Example 23
Source Project: goclipse   Source File: ResourceUtils.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected static String deltaKindToString(IResourceDelta delta) {
	switch (delta.getKind()) {
	case IResourceDelta.ADDED: return "+";
	case IResourceDelta.REMOVED: return "-";
	case IResourceDelta.CHANGED: return "*";
	case IResourceDelta.ADDED_PHANTOM: return "%+%";
	case IResourceDelta.REMOVED_PHANTOM: return "%-%";
	default:
		throw assertFail();
	}
}
 
Example 24
private void nonJavaResourcesChanged(Openable element, IResourceDelta delta) 	throws JavaModelException {
	// reset non-java resources if element was open
	if (element.isOpen()) {
		JavaElementInfo info = (JavaElementInfo)element.getElementInfo();
		switch (element.getElementType()) {
			case IJavaElement.JAVA_MODEL :
				((JavaModelInfo) info).nonJavaResources = null;
				if (!ExternalFoldersManager.isInternalPathForExternalFolder(delta.getFullPath()))
					currentDelta().addResourceDelta(delta);
				return;
			case IJavaElement.JAVA_PROJECT :
				((JavaProjectElementInfo) info).setNonJavaResources(null);

				// if a package fragment root is the project, clear it too
				JavaProject project = (JavaProject) element;
				PackageFragmentRoot projectRoot =
					(PackageFragmentRoot) project.getPackageFragmentRoot(project.getProject());
				if (projectRoot.isOpen()) {
					((PackageFragmentRootInfo) projectRoot.getElementInfo()).setNonJavaResources(null);
				}
				break;
			case IJavaElement.PACKAGE_FRAGMENT :
				 ((PackageFragmentInfo) info).setNonJavaResources(null);
				break;
			case IJavaElement.PACKAGE_FRAGMENT_ROOT :
				 ((PackageFragmentRootInfo) info).setNonJavaResources(null);
		}
	}

	JavaElementDelta current = currentDelta();
	JavaElementDelta elementDelta = current.find(element);
	if (elementDelta == null) {
		// don't use find after creating the delta as it can be null (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63434)
		elementDelta = current.changed(element, IJavaElementDelta.F_CONTENT);
	}
	if (!ExternalFoldersManager.isInternalPathForExternalFolder(delta.getFullPath()))
		elementDelta.addResourceDelta(delta);
}
 
Example 25
Source Project: neoscada   Source File: PreviewEditorImpl.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected void handleResourceChanged ( final IResourceChangeEvent event )
{
    try
    {
        event.getDelta ().accept ( new IResourceDeltaVisitor () {

            @Override
            public boolean visit ( final IResourceDelta delta ) throws CoreException
            {
                return handleResource ( delta );
            }
        } );
    }
    catch ( final CoreException e )
    {
        StatusManager.getManager ().handle ( e.getStatus () );
    }

    if ( this.needReload )
    {
        this.needReload = false;

        getSite ().getShell ().getDisplay ().asyncExec ( new Runnable () {

            @Override
            public void run ()
            {
                reload ();
            }
        } );
    }
}
 
Example 26
Source Project: tlaplus   Source File: ToolboxDirectoryVisitor.java    License: MIT License 5 votes vote down vote up
/** 
 * The visit method gets a resource and returns true or false depending on
 * whether or not it wants to be called with the children of the resource.
 * In this case, we return true unless the resource is a project representing
 * a spec (and thus whose resource is stored as a File (in this case a directory)
 * with extension toolbox.
 * 
 * @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(org.eclipse.core.resources.IResourceDelta)
 */
public boolean visit(IResourceDelta delta) throws CoreException
{
    IResource resource = delta.getResource(); 
    if ((resource instanceof IProject) ) {
        iprojects.add((IProject) resource);
        return false;
    }
    return true;
}
 
Example 27
Source Project: tracecompass   Source File: TmfEventsEditor.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void resourceChanged(final IResourceChangeEvent event) {
    final Set<@NonNull IMarker> added = new HashSet<>();
    final Set<@NonNull IMarker> removed = new HashSet<>();
    boolean deltaFound = false;
    for (final IMarkerDelta delta : event.findMarkerDeltas(IMarker.BOOKMARK, false)) {
        if (delta.getResource().equals(fFile)) {
            if (delta.getKind() == IResourceDelta.REMOVED) {
                removed.add(delta.getMarker());
            } else if (delta.getKind() == IResourceDelta.ADDED) {
                added.add(delta.getMarker());
            }
            /* this also covers IResourceDelta.CHANGED */
            deltaFound = true;
        }
    }
    if (!deltaFound) {
        return;
    }
    Display.getDefault().asyncExec(() -> {
        if (removed.isEmpty() && added.isEmpty()) {
            fEventsTable.getTable().refresh();
        } else {
            if (!removed.isEmpty()) {
                fEventsTable.removeBookmark(Iterables.toArray(removed, IMarker.class));
            }
            if (!added.isEmpty()) {
                fEventsTable.addBookmark(Iterables.toArray(added, IMarker.class));
            }
        }
    });
}
 
Example 28
public void resourceChanged(IResourceChangeEvent event) {
	IResourceDelta delta = event.getDelta();
	if (delta != null) {
		IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
		for (int i = 0; i < projDeltas.length; ++i) {
			IResourceDelta projDelta = projDeltas[i];
			if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) {
				setEnabled(hasClosedProjectsInWorkspace());
				return;
			}
		}
	}
}
 
Example 29
Source Project: M2Doc   Source File: EclipseJDTClassProvider.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void resourceChanged(IResourceChangeEvent event) {
    if (event != null) {
        final IResourceDelta delta = event.getDelta();
        for (IResourceDelta child : delta.getAffectedChildren()) {
            final IResource resource = child.getResource();
            if (resource != null) {
                final IProject project = resource.getProject();
                if (project != null) {
                    classLoaders.remove(project.getName());
                }
            }
        }
    }
}
 
Example 30
Source Project: google-cloud-eclipse   Source File: ResourceUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testGetAffectedFiles_emptyDelta() throws CoreException {
  IResourceDelta delta = mockDelta();
  Multimap<IProject, IFile> files = ResourceUtils.getAffectedFiles(delta);
  assertNotNull(files);
  assertEquals(0, files.size());
}