【问题标题】:classes missing in Eclipse package, helpEclipse 包中缺少的类,求助
【发布时间】: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


    【解决方案1】:

    您需要添加对org.eclipse.ui.ide 插件的依赖。 IFileEditorInput 存在于org.eclipse.ui 中,而不是同名的插件,这很混乱。您还可以通过使用包依赖项而不是显式依赖某些插件来避免这种类型的混淆。

    【讨论】:

      猜你喜欢
      • 2014-07-26
      • 2012-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多