Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recursively list all files in eclipse workspace programmatically

I am getting workspace by calling ResourcesPlugin.getWorkspace().getRoot().

How I can list all files(IFile) recursively in the workspace.

like image 963
Chandrayya G K Avatar asked Oct 19 '25 21:10

Chandrayya G K


1 Answers

The root, projects and folders in a workspace all implement the IContainer interface.

Call IContainer.members() to get all the resources in the container.

Something like:

void processContainer(IContainer container) throws CoreException
{
   IResource [] members = container.members();
   for (IResource member : members)
    {
       if (member instanceof IContainer)
         processContainer((IContainer)member);
       else if (member instanceof IFile)
         processFile((IFile)member);
    }
} 
like image 64
greg-449 Avatar answered Oct 22 '25 04:10

greg-449