I am trying to create a plugin that will give me a list of the absolute path of all files inside a project opened in eclipse.
I tried, but I can only get the path to the active window.
My action code:
IWorkbenchPart workbenchPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
IFile file = (IFile) workbenchPart.getSite().getPage().getActiveEditor().getEditorInput().getAdapter(IFile.class);
if (file == null)
try {
throw new FileNotFoundException();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String path = file.getRawLocation().toOSString();
System.out.println("path: " + path);
Here I get only the path to the active window. But I need a list of the absolute path for all files inside the project ... only the files in the src folder ...
Please guide me if I can do it the same way or if I need to use several APIs for this.
source
share