I want to write an Eclipse plug-in that adds an item to the Refactor menu in Eclipse JDT? How can I do this?
Thanks a lot
Recently, I was writing a plug-in that performs some re factoring.
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.
Here is the correct plugin.xml snippet:
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.
The path for the Refactor menu is org.eclipse.jdt.ui.refactoring.menu.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With