在Eclipse中添加菜单项 [英] Adding menu item in Eclipse

查看:187
本文介绍了在Eclipse中添加菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个Eclipse插件,它将一个项目添加到Eclipse JDT中的 Refactor 菜单中?如何做到这一点?

I want to write an Eclipse plug-in that adds an item to the Refactor menu in Eclipse JDT? How can I do this?

感谢很多

推荐答案

,我正在编写一个插件来执行一些重新分解。

Recently, I was writing a plug-in that performs some re factoring.

编写重构并不是太复杂,而是弄清楚如何将菜单项正确添加到Refactor菜单中花了很多时间。

Writing the refactoring was not too complicated, but figuring out how add the menu items correctly into the Refactor menu took a lot of time.

这是正确的plugin.xml片段:

Here is the correct plugin.xml snippet:

Refactor菜单标签是来自org.eclipse.jdt.ui的原始Refactor菜单定义的副本。复制所有分隔符定义很重要。对于我的插件,我还添加了一个名为spartanGroup的新分隔符。

The Refactor menu tag is a copy of the original "Refactor" menu definition from org.eclipse.jdt.ui. It is important to copy all the separator definitions. For my plug-in, I have also added a new separator called spartanGroup.

Refactor菜单的路径是org.eclipse.jdt.ui.refactoring.menu。

The path for the Refactor menu is org.eclipse.jdt.ui.refactoring.menu.

可以通过查看org.eclipse.jdt.ui插件的plugin.xml来绘制这些信息。您可以在线查找(例如这里),或者您可以按照以下步骤导入eclipse版本的源代码:

It is possible to figure this information by looking at plugin.xml of the org.eclipse.jdt.ui plug-in. You can find it online (for example here) or you can import the source code of your eclipse build following these steps:

1 File -> Import
2 Select Plug-ins and Fragments and click next.
3 In the "Import From" section choose "The active target platform".
4 In the "Import As" section choose "Project with source folders"
5 In the next screen, locate your plug-in (org.eclipse.jdt.ui) and add it.
6 Click finish and the source code of the plug-in will be imported into your workspace.

这篇关于在Eclipse中添加菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆