Adding a refactoring [message #60987] |
Tue, 03 June 2003 13:11  |
Eclipse User |
|
|
|
All,
I am currently working on a plug-in to add one (to begin with) new
refactoring to the Refactoring menu in JDT. I was surprised to find
that the number of items in this menu seems to be rather hard-coded, in
places like org.eclipse.jdt.ui.actions.RefactorActionGroup. I've read
in the Eclipse 3.0 Draft Plan
( http://www.eclipse.org/eclipse/development/eclipse_project_p lan_3_0.html#ThemeJDTUserExperience)
that there is a plan for improving the refactoring API to allow added
refactorings, but it's not clear to me when this will be available, so
I'm plugging ahead with my plugin for now.
It appears that I'll have to subclass
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor and add in
my own action group. I'll report back if I have any success, but in the
meantime, if anyone has successfully added refactorings without altering
the jdt plugins, I'd be very interested to hear. Thanks,
David Saff
|
|
|
|
|
Re: Adding a refactoring [message #61710 is a reply to message #61058] |
Tue, 03 June 2003 22:26   |
Eclipse User |
|
|
|
Valentino,
Thank you for the suggestion. I've given this mechanism a couple tries,
and don't seem to be getting as close as I was with my previous,
brute-force approach. I'm suspecting that it has to do with the fact
that the class org.eclipse.jdt.ui.actions.RefactorActionGroup explicitly
builds the context menu, considering only a hardcoded set of action
classes, and apparently ignoring extension points.
Of course, it's likely that I'm just being bone-headed, and you already
know about this hardcoding, and already know that if I had used
objectContribution correctly, I would be on my way by now. Here's my
translation of your code snippet:
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
id="edu.mit.lcs.pag.testfactoring.refactoring.popupMenu"
objectClass="org.eclipse.jdt.core.ICompilationUnit">
<action
id=" edu.mit.lcs.pag.testfactoring.refactoring.replace.data.value .with.object "
label="My Refactoring"
menubarPath="org.eclipse.jdt.ui.refactoring.menu/codingGroup "
class=" edu.mit.lcs.pag.testfactoring.refactoring.ReplaceDataValueAc tion "
enablesFor="1">
</action>
</objectContribution>
</extension>
Does it look to you like this should work? Thank you for your help,
David Saff
Valentino Kyriakides wrote:
> Some time ago Dirk Baeumer mentioned the following extension point example:
>
> <extension point="org.eclipse.ui.popupMenus">
> <objectContribution
> id="com.xyz.C1"
> objectClass="org.eclipse.jdt.core.ICompilationUnit">
> <action id="com.xyz.runXYZ"
> label="My Refactoring"
> menubarPath="org.eclipse.jdt.ui.refactoring.menu/codingGroup "
> class="com.xyz.actions.XYZToolActionDelegate"
> enablesFor="1">
> </action>
> </objectContribution>
> </extension>
>
>
> Valentino
>
>
> "David Saff" <saff@mit.edu> schrieb im Newsbeitrag
> news:bbikr9$1eu$1@rogue.oti.com...
>>I am currently working on a plug-in to add one (to begin with) new
>>refactoring to the Refactoring menu in JDT.
|
|
|
Re: Adding a refactoring [message #61734 is a reply to message #61641] |
Tue, 03 June 2003 22:32  |
Eclipse User |
|
|
|
Adam Kiezun wrote:
>>I am currently working on a plug-in to add one (to begin with) new
>>refactoring to the Refactoring menu in JDT.
>
> do you mean the global menu bar, a view's context menu or the java editor
> context menu?
Adam,
Thank you for asking--I have to admit that I hadn't yet thought hard
enough about it--since I usually refactor using the java editor context
menu, I was concentrating on that point first. How would a different
question change your answer?
> btw, please ask this on eclipse.tools.jdt which is the correct forum for this
> question
I'm sorry if I've spammed the wrong group. I found the description of
the newsgroups at http://www.eclipse.org/newsgroups/index.html rather
confusing:
eclipse.tools.jdt: ...how to use the Java development tools (JDT)
eclipse.platform: ...how to develop editors, views, preference pages,
wizards, builders, etc
Since I want to develop a plugin for eclipse, and not ask a question
about the use of JDT, I came here. Do you agree that the language could
be more clear there?
I'll ask my question over there--if you wish to continue the
conversation over there, please do. Thank you for your time,
David Saff
|
|
|
Powered by
FUDForum. Page generated in 0.04203 seconds