Reputation: 118
Interest is to get list of opened files in eclipse cdt editor. Lets say aaa.c, bbb.c, ddd.c are the files opened in eclipse editor. How to get the IFile[] for these files.
Upvotes: 1
Views: 235
Reputation: 111142
You can get a list of all open editors using the IWorkbenchPage
getEditorReferences
method. You can use this to find the editors you are interested in. So:
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorReference [] editors = page.getEditorReferences();
for (IEditorReference editor : editors) {
String editorId = editor.getId();
// TODO test if this is an editor you are interested in
IEditorInput inout = editor.getEditorInput();
IFile file = inout.getAdapter(IFile.class);
...
}
Upvotes: 2