【发布时间】:2012-05-15 12:48:17
【问题描述】:
我正在编写一个 Eclipse RCP 应用程序。 我在左边有一个视图,在右边有一个编辑器。视图是一个菜单。单击菜单中的按钮,编辑器应该打开并且视图应该改变。点击后编辑器打开,但视图没有改变。
我必须关闭菜单视图并打开一个新的吗?如果是,怎么做?
如果我在 page.openEditor(..) 之前写 page.showView(ID_of_my_view_class.ID),它会在显示的控制台旁边打开一个新选项卡,其中包含日志。
当前代码:
public Object execute(ExecutionEvent event) throws ExecutionException {
this.log.info(this.getClass().getSimpleName() + " called");
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
IWorkbenchPage page = window.getActivePage();
KuenstlerEditorInput input = new KuenstlerEditorInput(new Kuenstler());
try {
page.openEditor(input, KuenstlerEditor.ID);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error",
"Editor f¸r K¸nstler konnte nicht geˆffnet werden: "
+ e.getMessage());
this.log.error(e);
}
return null;
}
当我启动程序时,它看起来像这样:http://i.imgur.com/KXHAe.png 当我执行 page.showView(the_ID.ID) 命令时,它看起来像这样:http://i.imgur.com/BZ8y1.png
视图应该出现在左侧,而不是带有所有按钮的菜单。
【问题讨论】:
-
您使用的透视图是什么?如果您有自己的透视图,则应该能够在设置透视图时设置视图的位置。否则,我认为您(但更确定)您应该能够将视图的布局信息添加到活动透视图中。
-
感谢您的回答。我在代码下方编辑了我的问题。
标签: eclipse view eclipse-rcp rcp