[英]How to get the list of files open in active eclipse editor window in eclipse?
感興趣的是在Eclipse CDT編輯器中獲取打開文件的列表。 可以說aaa.c,bbb.c,ddd.c是在Eclipse編輯器中打開的文件。 如何獲取這些文件的IFile []。
您可以使用IWorkbenchPage
getEditorReferences
方法獲取所有打開的編輯器的列表。 您可以使用它來查找您感興趣的編輯器。
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);
...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.