【发布时间】:2011-06-16 20:46:55
【问题描述】:
我想用一个打印当前项目名称的命令做一个小插件。代码片段如下:
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(错误消息:无法解析为类型)。我有 import org.eclipse.ui.*;在文件的顶部,但它不起作用。似乎缺少 IFileEditorInput,但我怎么能找到它?
非常感谢!
【问题讨论】:
标签: eclipse plugins eclipse-plugin