弹出菜单 Pop-up Menus
1)MONKEY SEE/MONKEY DO RULE
Always start by copying the structure of a similar plug-in.
寻找相似的plug-in的方法
通过查看现有文件中已经定义好的 extension points.
Since the popupMenus extension point is defined by the org.eclipse.ui plug-in we open its plugin.xml file in the manifest editor. On the Extension Points tab of the manifest editor we can see the extension points defined in this plug-in and (more to our purpose here) where they are used.
2)关于plug-in.xml
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
id="org.eclipse.contribution.junit.runtest"
--当鼠标作选中的元素为“Type (classes and interfaces)”类型的时候才在popupMenus显示“Run Test”
objectClass="org.eclipse.jdt.core.IType">
<action
id="org.eclipse.contribution.junit.runtest.action"
label="Run Test"
--鼠标只选中一个"Type"元素的时候才显示“Run Test”
enablesFor="1"
class="org.eclipse.compare.internal.AddFromHistoryAction">
</action>
</objectContribution>
</extension>
3)国际化
Labels beginning with "%" will be used as a key into plugin.properties file. Replacing this file allows you to change the language of the plug-in .