Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: IBM Corporation - initial API and implementation /
Utility class used to warp an set of resources in a resource mapper. The resulting mapper will return the workspace root as the model object. TODO: The ability to wrap multiple resources in a single mapping should be provided by the resources plugin.

public final class WorkspaceResourceMapper extends ResourceMapping {
    private final IResource resource;
    private final int depth;
Convert the provided resources to one or more resource mappers that traverse the elements deeply. The model element of the resource mappers will be the workspace root.

resources the resources
a resource mappers that traverses the resources
    public static ResourceMapping[] asResourceMappers(final IResource[] resourcesint depth) {
        List result = new ArrayList();
        for (int i = 0; i < resources.lengthi++) {
            IResource resource = resources[i];
            result.add(new WorkspaceResourceMapper(resourcedepth));
        return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
    public WorkspaceResourceMapper(IResource resourceint depth) {
        this. = resource;
        this. = depth;
    public Object getModelObject() {
        return ;
    public IProject[] getProjects() {
        return new IProject[] { .getProject() };
    public ResourceTraversal[] getTraversals(ResourceMappingContext contextIProgressMonitor monitorthrows CoreException {
        return asTraversal(context);
    private ResourceTraversal[] asTraversal(IResource resourcefinal int depthResourceMappingContext context) {
        return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { resource }, depth.)} ;
    public boolean contains(ResourceMapping mapping) {
    	return false;
New to GrepCode? Check out our FAQ X