我在編寫Eclipse RCP應用程序。 我在左側有一個視圖,在右側有一個編輯器。該視圖是一個菜單。點擊菜單中的按鈕,編輯器應該打開並且視圖應該改變。編輯器在點擊後打開,但視圖不會更改。在Eclipse RCP中執行操作後刷新視圖
我必須關閉菜單視圖並打開一個新菜單嗎?如果是,如何?
如果我寫page.showView(ID_of_my_view_class.ID)它會打開一個新的標籤旁邊的日誌顯示控制檯page.openEditor(..)前。
當前代碼:
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
該視圖應顯示在左側,而不是包含所有按鈕的菜單。
您使用的視角是什麼?如果你有自己的觀點,你應該能夠設置視圖的位置時,視角設置。否則,我認爲你(但一個更確定的),你應該能夠添加布局信息爲您欣賞到活動的透視圖。 –
感謝您的回答。我在代碼下面編輯了我的問題。 – Baloo