I'm trying to create a plugin that annotates eclipse java projects based on external output. Currently, I'm traversing all of the open projects based on this tutorial: http://www.vogella.de/articles/EclipseJDT/article.html However, I'm looking for a way to get a full list of only the files that are currently open in the java editor. Is there a way or command for me to get that?
解决方案
//get all active editor references,check if reference is of type java editor
IEditorReference[] ref = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
.getEditorReferences();
List javaEditors = new ArrayList();
for (IEditorReference reference : ref) {
if ("org.eclipse.jdt.ui.CompilationUnitEditor".equals(reference.getId())){
javaEditors.add(reference);
}
}