【问题标题】:Eclipse RCP: Right aligned search field in toolbarEclipse RCP:工具栏中右对齐的搜索字段
【发布时间】:2010-10-19 14:57:41
【问题描述】:

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

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

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

谢谢, 迈克尔

【问题讨论】:

    标签: eclipse-rcp toolbar


    【解决方案1】:

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

    【讨论】:

    • 嘿迈克尔,你能举个例子吗?它与 e4 兼容吗?
    • @Campa 嗨。抱歉,自从我提交答案以来已经 8 年了——我什至没有编写示例的环境,因为从那时起我已经切换到不同的技术堆栈..
    猜你喜欢
    • 2013-02-23
    • 2016-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-04
    • 1970-01-01
    • 2010-09-14
    相关资源
    最近更新 更多