Java Code Examples for org.eclipse.core.resources.IResource.ROOT

The following are Jave code examples for showing how to use ROOT of the org.eclipse.core.resources.IResource class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ec4e   File: IDEEditorConfigManager.java   Source Code and License Vote up 6 votes
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
	IResource resource = delta.getResource();
	if (resource == null) {
		return false;
	}
	switch (resource.getType()) {
	case IResource.ROOT:
	case IResource.PROJECT:
	case IResource.FOLDER:
		return true;
	case IResource.FILE:
		IFile file = (IFile) resource;
		if (EditorConfigConstants.EDITORCONFIG.equals(file.getName())
				&& delta.getKind() == IResourceDelta.CHANGED) {
			entries.remove(new FileResource(file));
		}
	}
	return false;
}
 
Example 2
Project: visuflow-plugin   File: ProjectListener.java   Source Code and License Vote up 5 votes
@Override
public void resourceChanged(IResourceChangeEvent event) {
	IResourceDelta delta = event.getDelta();
	if (delta.getResource().getType() == IResource.ROOT) {
		List<IProject> projects = getProjects(event.getDelta());
		// do something with new projects
		for (IProject project : projects) {
			try {
				triggerBuild(project);
			} catch (CoreException e) {
				e.printStackTrace();
			}
		}
	}
}
 
Example 3
Project: Equella   File: WorkspaceModelManager.java   Source Code and License Vote up 4 votes
@Override
public boolean visit(IResourceDelta delta) throws CoreException
{
	if( delta != null )
	{

		final IResource resource = delta.getResource();
		if( !resource.isDerived() )
		{
			switch( resource.getType() )
			{

			case IResource.ROOT:
				return true;
			case IResource.PROJECT: {
				IProject project = (IProject) resource;
				int kind = delta.getKind();
				int flags = delta.getFlags();
				if( isInterestingProject(project)
					&& (kind == IResourceDelta.ADDED || (flags & IResourceDelta.OPEN) != 0 || (kind == IResourceDelta.CHANGED
						&& (flags & IResourceDelta.DESCRIPTION) != 0 && !isProjectKnown(project))) )
				{
					createModel(project, true);
					return false;
				}
				else if( kind == IResourceDelta.REMOVED )
				{
					removeModel(project);
					return false;
				}
				return true;
			}
			case IResource.FOLDER:
				return isInterestingFolder((IFolder) resource);
			case IResource.FILE:
				// do not process
				if( isContentChange(delta) )
				{
					handleFileDelta(delta);
					return false;
				}
			}
		}
	}
	return false;
}