弹出菜单 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 .
博客围绕Eclipse插件弹出菜单展开,介绍了开发方法,可通过查看现有文件中定义好的extension points寻找相似plug - in,还给出了plug - in.xml的示例代码,说明了鼠标选中特定元素时菜单显示规则,此外提到了插件国际化,可通过替换plugin.properties文件改变语言。
982

被折叠的 条评论
为什么被折叠?



