2013-12-10 93 views
1

你好,請幫我在Eclipse中創建插件子菜單如何創建菜單的子菜單中的eclipse插件

下面是我的plugin.xml

<?xml version="1.0" encoding="UTF-8"?> 
    <?eclipse version="3.4"?> 
     <plugin> 
     <extension 
       point="org.eclipse.ui.commands"> 
      <category 
       name="Sample Category" 
       id="com.atos.ssc.portal.plugin.commands.category"> 
      </category> 
      <command 
       name="Run CC Portal" 
       categoryId="com.atos.ssc.portal.plugin.commands.category" 
       id="com.atos.ssc.portal.plugin.commands.sampleCommand"> 
      </command> 
      <command 
       name="CC Home" 
       categoryId="com.atos.ssc.portal.plugin.commands.category" 
       id="com.atos.ssc.portal.plugin.commands.ccHomeCommand"> 
      </command> 
      <command 
       name="SSC ClearCase Details Information" 
       categoryId="com.atos.ssc.portal.plugin.commands.category" 
       id="com.atos.ssc.portal.plugin.commands.ccUserInfoComand"> 
      </command> 
      <command 
       name="SSC ClearCase 8 Details Information" 
        categoryId="com.atos.ssc.portal.plugin.commands.category" 
        id="com.atos.ssc.portal.plugin.commands.ccUser8InfoComand"> 
       </command> 
     </extension> 
     <extension 
      point="org.eclipse.ui.handlers"> 
      <handler 
       commandId="com.atos.ssc.portal.plugin.commands.sampleCommand" 
       class="com.atos.ssc.portal.plugin.handlers.SampleHandler"> 
      </handler> 
      <handler 
       commandId="com.atos.ssc.portal.plugin.commands.ccHomeCommand" 
       class="com.atos.ssc.portal.plugin.handlers.CCHomeHandler"> 
      </handler> 
      <handler 
       commandId="com.atos.ssc.portal.plugin.commands.ccUserInfoComand" 
     class="com.atos.ssc.portal.plugin.handlers.SSCClearCaseDetailInfoHandler"> 
      </handler> 
      <handler 
      commandId="com.atos.ssc.portal.plugin.commands.ccUser8InfoComand" 
     class="com.atos.ssc.portal.plugin.handlers.SSCClearCase8DetailInfoHandler"> 
     </handler> 
    </extension> 
    <extension 
    point="org.eclipse.ui.bindings"> 
    <key 
     commandId="com.atos.ssc.portal.plugin.commands.sampleCommand" 
     contextId="org.eclipse.ui.contexts.window" 
     sequence="M1+6" 
     schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> 
    </key> 
    <key 
     commandId="com.atos.ssc.portal.plugin.commands.ccHomeCommand" 
     contextId="org.eclipse.ui.contexts.window" 
     sequence="M1+6" 
     schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> 
    </key> 
    <key 
     commandId="com.atos.ssc.portal.plugin.commands.ccUserInfoComand" 
     contextId="org.eclipse.ui.contexts.window" 
     sequence="M1+6" 
     schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> 
    </key> 
    <key 
     commandId="com.atos.ssc.portal.plugin.commands.ccUser8InfoComand" 
     contextId="org.eclipse.ui.contexts.window" 
     sequence="M1+6" 
     schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> 
    </key> 
    </extension> 
    <extension 
    point="org.eclipse.ui.menus"> 
    <menuContribution 
     allPopups="true" 
     locationURI="menu:org.eclipse.ui.main.menu?after=additions"> 
    <menu 
      label="SSC CC Portal" 
      mnemonic="S" 
      id="com.atos.ssc.portal.plugin.menus.sampleMenu"> 
     <command 
       commandId="com.atos.ssc.portal.plugin.commands.sampleCommand" 
       style="push"> 
     </command> 
    </menu> 
    </menuContribution>  
    <menuContribution 
     locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> 
    <toolbar 
      id="com.atos.ssc.portal.plugin.toolbars.sampleToolbar"> 
     <command 
       commandId="com.atos.ssc.portal.plugin.commands.sampleCommand" 
       icon="icons/sample.gif" 
       tooltip="Run CC Portal" 
       id="com.atos.ssc.portal.plugin.toolbars.sampleCommand"> 
     </command> 
    </toolbar> 
    </menuContribution> 
</extension> 
</plugin> 

隨着這我能夠創建菜單如下文特定順序

運行CC門戶

CC首頁

ClearCase的詳細信息

ClearCase的詳細信息8

如何過我想下運行CC門戶菜單CC主頁,SSC ClearCase的詳細信息和SSC ClearCase的8詳細信息...請help..I一個新Eclipse插件。

回答

0

你需要有菜單項下的命令:

<menuContribution 
     allPopups="true" 
     locationURI="menu:org.eclipse.ui.main.menu?after=additions"> 
     <menu label="Run CC Portal"> 
     <command 
       commandId="com.atos.ssc.portal.plugin.commands.ccHomeCommand" 
       style="push"> 
     </command> 
     <command 
       commandId="com.atos.ssc.portal.plugin.commands.ccUserInfoComand" 
       style="push"> 
     </command> 
     <command 
       commandId="com.atos.ssc.portal.plugin.commands.ccUser8InfoComand" 
       style="push"> 
     </command> 
    </menu> 
    </menuContribution>  

另見here對促進工具欄