2012-07-25 41 views
0

我使用ActionBarAdvisor的子類向RCP應用程序的工作臺coolbar添加了JFace操作。出於某種原因,相應的菜單是用我認爲是多餘的線條繪製的。這是導致整個酷工具欄包括打開透視圖列表是方式太高:Eclipse RCP Workbench中的單行菜單操作Coolbar

enter image description here

任何人都知道如何讓它單成蔭?我嘗試將SWT.SINGLE樣式添加到Action構造函數中,但這沒有幫助。任何幫助,將不勝感激。謝謝。

ActionBarAdvisor.fillCoolBar()實現:

protected void fillCoolBar(final ICoolBarManager coolBar) { 

    final IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle()); 
    coolBar.add(new ToolBarContributionItem(toolbar, "main")); 

    toolbar.add(new Pulldown()); 
} 

行動實施:

public class Pulldown extends Action { 

    public Pulldown() { 
     super("Saved Layouts"); 
     setMenuCreator(menuCreator); 
    } 

    ... 
} 

回答

0

這不是引導你的問題的答案,但我會宣佈按鈕菜單擴展與下拉/收音機樣式。因此,您不必更改coolbar的代碼。 Here是關於工具欄菜單貢獻的教程。

<extension 
      point="org.eclipse.ui.menus"> 
     <menuContribution 
      allPopups="false" 
      locationURI="toolbar:de.example.com"> 
      <command 
       commandId="de.abas.erp.wb.base.marker.commands.PullDownCommand" 
       icon="icons/16x16/layouts.png" 
       label="Saved Layouts" 
       style="pulldown"> 
      </command> 
     </menuContribution> 
    </extension> 
+0

使用擴展點確實奏效,謝謝。對於任何有此相同問題的人,請注意,您必須使用可限制功能的代理(IWorkbenchWindowActionDelegate)(例如我的案例中的細粒度啓用控制)。 – 2012-07-27 08:45:40