0
我創建了一個ToolItem「另存爲」像上面的圖像,但它不顯示在工具欄的位置。因此,如何建立內部ViewPart時工具欄(不使用的plugin.xml)如何創建一個工具欄裏面的viewpart(不使用plugin.xml)
這是我的代碼創建工具欄:
public void createToolbar(Composite parent) {
// Create composite Toolbar and set layout
toolBarComposite = new Composite(parent, SWT.NONE);
gridLayout = new GridLayout(1, false);
toolBarComposite.setLayout(gridLayout);
gridData = new GridData(SWT.RIGHT, SWT.NONE, true, false);
toolBarComposite.setLayoutData(gridData);
// Create Toolbar
gridData = new GridData(SWT.RIGHT, SWT.NONE, true, false);
toolBar = new ToolBar(toolBarComposite, SWT.FLAT);
toolBar.setLayoutData(gridData);
// Create Item
item = new ToolItem(toolBar, SWT.PUSH);
item.setImage(SAVE_IMAGE);
item.setToolTipText("Save (Ctrl + S)");
item.setEnabled(true);
item.addSelectionListener(new SelectionAdapter() {
private static final long serialVersionUID = -102212312093090431L;
@Override
public void widgetSelected(SelectionEvent e) {
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
感謝你提前!
感謝您的建議,但我想ToolItem分解工具欄下面一行,怎麼做? – Ace 2014-11-03 02:03:18
@Ace我很抱歉,但我不完全理解你的問題。你不能只是在側面複合材料上創建你的工具欄嗎? – GGrec 2014-11-03 09:01:24