我有一个 Eclipse 插件,其中我需要文本编辑器中的工具栏,就像切换面包屑视图一样。Eclipse 中是否有任何通用实用程序类允许我这样做?
@Override
protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler,
int styles)
{
composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, true);
gridLayout.numColumns = 1;
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
composite.setLayout(gridLayout);
ToolBar toolBar = new ToolBar(composite, SWT.FLAT);
GridData gridData = new GridData(GridData.FILL, SWT.TOP, true, false);
toolBar.setLayoutData(gridData);
toolBarManager = new ToolBarManager(toolBar);
return super.createSourceViewer(composite, ruler, styles);
}