Eclipse plugin Eclipse:按ID创建IEditorPart

Eclipse plugin Eclipse:按ID创建IEditorPart,eclipse-plugin,Eclipse Plugin,如何通过ID在eclipse插件中创建IEditorPart 注意,我知道我可以做到: IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); page.openEditor( input, "the-editor-id); 然而,这不是我想要的。我想创建一个IEditorPart,以便将

如何通过ID在eclipse插件中创建IEditorPart

注意,我知道我可以做到:

    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    page.openEditor(
                input,
                "the-editor-id);
然而,这不是我想要的。我想创建一个IEditorPart,以便将其嵌入到多页编辑器中。我没有直接访问编辑器类的权限,因此无法直接用“new”实例化一个编辑器类


谢谢。

作为参考,这就是我所做的。 注意,它使用非API。似乎没有使用官方API的机制:

    EditorDescriptor d = (EditorDescriptor)PlatformUI
            .getWorkbench()
            .getEditorRegistry()
            .findEditor("my.editor.id");
    IEditorPart editor = d.createEditor();

EditorDescriptor类和createEditor方法不是api。IEditorDescriptor接口没有声明createrEditor方法。

我看不到任何方法可以做到这一点。所有现有的多页编辑器都只是
new
他们想要使用的编辑器。如果你不能直接访问编辑器类,这听起来像是他们不想让你做的事情。@事实上,这是我们控制的代码,但由于各种实际原因,无法直接实例化。这是一个可选的依赖项。。此外,我可以很容易地通过ID打开编辑器,只是不直接创建IEditorPart。我真的不明白为什么后者与前者有什么不同。