我想在 Eclipse RCP 应用程序的工具栏中有一个右对齐的搜索字段。我已经在 ActionBarAdvisor 类中创建了文本字段作为 ControlContribution 和相应的搜索操作:
protected void fillCoolBar(ICoolBarManager coolBar) {
IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
//...
toolbar.add(new ControlContribution("searchText") {
//...
这有效,我在工具栏中有搜索字段。但是如何在右侧对齐搜索文本(或工具栏与搜索文本)?
谢谢,
迈克尔
最佳答案
如果您的意思是将搜索工具栏定位在主工具栏的右侧站点,那么请考虑使用这些区域(当使用 org.eclipse.ui.menus 扩展点时):
toolbar:org.eclipse.ui.main.toolbar - the top-level tool bar
toolbar:org.eclipse.ui.trim.command1 - the top left trim
toolbar:org.eclipse.ui.trim.command2 - the top right trim
toolbar:org.eclipse.ui.trim.vertical1 - the left vertical trim
toolbar:org.eclipse.ui.trim.vertical2 - the right vertical trim
toolbar:org.eclipse.ui.trim.status - the status line trim
关于eclipse-rcp - eclipse RCP : Right aligned search field in toolbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3969715/