我想在SWT中的一个部分添加一个工具栏.
我在PDE清单编辑器中看到了一个例子.
如何添加此工具栏或按钮?
也许我需要使用不同的控件?
谢谢,
我做
解决方法:
您可以使用ImageHyperLink控件.我认为这就是PDE清单编辑器使用的内容.
Section section = new Section(parent, SWT.NONE);
Composite toolbar = new Composite(section, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.marginLeft = 0;
layout.marginRight = 0;
layout.spacing = 0;
layout.marginTop = 0;
layout.marginBottom = 0;
toolbar.setLayout(layout);
parent.setTextClient(toolbar);
ImageHyperlink imageHyperLink = new ImageHyperlink(toolbar, SWT.CENTER);
imageHyperLink.setBackgroundImage(section.getBackgroundImage());
imageHyperLink.setToolTipText("Click me for help");
imageHyperLink.setImage(JFaceResources.getImage(Dialog.DLG_IMG_HELP));
imageHyperLink.addHyperlinkListener(new HyperlinkAdapter()
{
public void linkActivated(HyperlinkEvent e)
{
// Show help
}
});
标签:java,eclipse,eclipse-plugin,swt
来源: https://codeday.me/bug/20190607/1192073.html