Eclipse RCP:工具栏中的右对齐搜索字段

时间:2010-10-19 14:57:41

标签: eclipse-rcp toolbar

我希望在Eclipse RCP应用程序的工具栏中有一个右对齐的搜索字段。我已经将文本字段创建为ControlContribution以及ActionBarAdvisor类中的相应搜索操作:

protected void fillCoolBar(ICoolBarManager coolBar) {
  IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
  //...
  toolbar.add(new ControlContribution("searchText") {
  //...

这有效,我在工具栏中有搜索字段。但是如何在右侧将搜索文本(或工具栏与搜索文本)对齐?

谢谢, 迈克尔

1 个答案:

答案 0 :(得分:8)

如果您的意思是将搜索工具栏定位在主工具栏的右侧网站上,请考虑使用这些区域(使用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