【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>
【Teamcenter胖客户端开发】teamcenter菜单添加图文教程<1>这部分内容实际上是eclipse的插件开发的功能, 这里做个简单分类,菜单文件的扩展点都是<extensionpoint="org.eclipse.ui.menus">,添加菜单就是在这里面添加内容。这里只要注意location即可!
(1)在主工具条上添加菜单。
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu id="com.plmhome.plmhomeTool"label="PLMHome ToolKits">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menu>
</menuContribution>
(2)在工具功能的后面添加按钮。
<menuContribution
locationURI="menu:tools?after=additions">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menuContribution>
(3)在右键弹出菜单加按钮
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menuContribution>
(4)在具体的菜单后面加功能按钮
<menuContribution
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
<menu
label="PLMHomeToolKits"
mnemonic="M"
id="com.plmhome.createFolder.menus.sampleMenu">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menu>
</menuContribution>
(5)指定位置,直接加按钮
<menuContribution
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="Say hello world"
id="com.plmhome.createFolder.toolbars.sampleCommand">
</command>
</menuContribution>
(6)加工具条按钮
<menuContribution
locationURI="toolbar:navigator_Toolbar?after=additions">
<toolbar
id="com.plmhome.createFolder.toolbars.sampleToolbar">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="Say hello world"
id="com.plmhome.createFolder.toolbars.sampleCommand">
</command>
</toolbar>
</menuContribution>
完整的例子如下:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="com.plmhome.createFolder.commands.category">
</category>
<command
name="PLMHome CreateFolder"
categoryId="com.plmhome.createFolder.commands.category"
id="com.plmhome.createFolder.commands.sampleCommand">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.plmhome.createFolder.commands.sampleCommand"
class="com.plmhome.createfolder.handlers.SampleHandler">
</handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
<key
commandId="com.plmhome.createFolder.commands.sampleCommand"
contextId="org.eclipse.ui.contexts.window"
sequence="M1+6"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu?after=additions">
<menu id="com.plmhome.plmhomeTool"label="PLMHome ToolKits">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menu>
</menuContribution>
<menuContribution
locationURI="menu:tools?after=additions">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menuContribution>
<menuContribution
locationURI="menu:com.teamcenter.rac.ui.views.DetailsView?after=group4">
<menu
label="PLMHomeToolKits"
mnemonic="M"
id="com.plmhome.createFolder.menus.sampleMenu">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
mnemonic="S"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menu>
</menuContribution>
<menuContribution
locationURI="toolbar:com.teamcenter.rac.ui.views.DetailsView">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="Say hello world"
id="com.plmhome.createFolder.menus.sampleCommand">
</command>
</menuContribution>
<menuContribution
locationURI="toolbar:navigator_Toolbar?after=additions">
<toolbar
id="com.plmhome.createFolder.toolbars.sampleToolbar">
<command
commandId="com.plmhome.createFolder.commands.sampleCommand"
icon="icons/sample.gif"
tooltip="Say hello world"
id="com.plmhome.createFolder.toolbars.sampleCommand">
</command>
</toolbar>
</menuContribution>
</extension>
</plugin>
页:
[1]