Search code examples
eclipse-pluginfindworkspace

API to find a resource in Eclipse workspace tree


Is there any API available to find a resoruce(java file) in Eclipse workspace tree when a resource name is given? I mean recursively.

Thanks.

Tim.


Solution

  • You can search at any level of the workspace, even the top starting with org.eclipse.core.resources.ResourcesPlugin.getWorkspace(). Then use something like:

    root.getRoot().accept(myResourceVisitor);
    

    See the javadoc for org.eclipse.core.resources.IResource.accept(IResourceVisitor) for more information.

    PW