我想在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 Home
Clearcase详细信息
Clearcase Detail 8信息
我怎么想在CC Home Portal菜单下的CC Home,SSC ClearCase详细信息和SSC Clearcase 8详细信息..请帮助..我是一个新的eclipse插件。
答案 0 :(得分: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以了解工具栏