2012-08-02 23 views
1

我試圖在菜單上以編程方式添加一些選項,我已經發現如何添加菜單「窗口」後的菜單,但我想在默認菜單中添加一個選項(更具體地說,在Window> Open Perspective中添加我的視角)。在擴展org.eclipse.plugin.menus插入項目的默認菜單

我不知道什麼是正確的LocationURL。

其實,我的擴展點配置這樣的:

<extension 
    point="org.eclipse.ui.menus"> 
    <menuContribution 
     allPopups="false" 
     locationURI="menu:org.eclipse.ui.main.menu?after=window"> 
    <menu 
      icon="icons/enmac.jpg" 
      id="enmac" 
      label="EnMac"> 
     <command 
       commandId="EnMac.openPerspective" 
       icon="icons/enmac.jpg" 
       label="Open Perspective" 
       style="push" 
       tooltip="open"> 
     </command> 
    </menu> 
    </menuContribution> 
</extension> 

回答

0

您可以經常使用的插件在Eclipse中的間諜工具來查找菜單的URI。這可以通過ALT + SHIFT + F2(至少在Windows平臺上)訪問,然後點擊一個合適的菜單項。

然而,在這種情況下,它聽起來像你真的只是試圖添加你的視角到默認的透視菜單。在這種情況下,您應該使用org.eclipse.ui.perspectives擴展點註冊您的透視類。有關更多詳細信息,請參見this tutorial

+0

哦..謝謝你......那個間諜工具救了我...... – 2012-08-02 10:52:50