4
我想用一個打印當前項目名稱的命令做一個小插件。該代碼片段是以下:Eclipse包中缺少類,幫助
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IEditorPart editorPart = window.getActivePage().getActiveEditor();
if (editorPart != null){
IFileEditorInput input = (IFileEditorInput)editorPart.getEditorInput() ;
IFile file = input.getFile();
IProject activeProject = file.getProject();
String activeProjectName = activeProject.getName();
//... use activeProjectName
}
問題:IFileEditorInput無法找到(錯誤味精:不能解析爲一個類型)。我有導入org.eclipse.ui。*;在文件的頂部,但它不起作用。似乎IFileEditorInput丟失,但我怎麼能找到它?
非常感謝!
完全正確。 – xiaolong 2011-06-16 22:12:15