我無法在任何地方找到如何將按鈕添加到Eclipse窗體的右上角,與提供的屏幕截圖相同。Eclipse RCP - 如何將按鈕添加到eclipse窗體的右上角
按鈕似乎是表單標題區域的一部分,是形式的功能或者它只是另一種複合材料,它看起來像一個窗體標題部分?任何源代碼示例(甚至草稿)高度讚賞。
編輯:
我設法按鈕添加到款,但仍沒有到窗體本身,我已經用在這裏發現了一個例子:
private void createSectionToolbar(Section section, FormToolkit toolkit) {
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
ToolBar toolbar = toolBarManager.createControl(section);
final Cursor handCursor = new Cursor(Display.getCurrent(),
SWT.CURSOR_HAND);
toolbar.setCursor(handCursor);
// Cursor needs to be explicitly disposed
toolbar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if ((handCursor != null) && (handCursor.isDisposed() == false)) {
handCursor.dispose();
}
}
});
// save
CommandContributionItemParameter saveContributionParameter = new CommandContributionItemParameter(
editor.getSite(), null,
"it.wellnet.easysitebox.menu.commands.saveMenu",
CommandContributionItem.STYLE_PUSH);
saveContributionParameter.icon = RegiloCoreImages.getInstance().DESC_UPDATE;
CommandContributionItem saveMenu = new CommandContributionItem(
saveContributionParameter);
toolBarManager.add(saveMenu);
toolBarManager.update(true);
section.setTextClient(toolbar);
}
仍雖然沒有形式本身的運氣。
獲取工具欄經理,我不能讓它工作,我的EditorPart裏面我用形式= toolkit.createScrolledForm(父)初始化我的表單對象;在createPartControl(..)方法內,也許多數民衆贊成在問題,我的形式是一個ScrolledForm類型? – Kris
沒有時間來驗證它,因爲我不再使用Eclipse RCP,但是因爲它的upvoted我相信它的真實:)並將其標記爲正確的答案,thx – Kris