Adding a refactoring [message #48024] |
Tue, 03 June 2003 22:48  |
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,
I originally posted this request on e.platform, and got the suggestion
that I use a solution such as:
<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>
This doesn't appear to work for me, and I'm suspecting it's because of
the hard-coding mentioned in the
org.eclipse.jdt.ui.actions.RefactorActionGroup class. I'm interested in
any thoughts you may have. Thanks again,
David Saff
|
|
|
Re: Adding a refactoring [message #49098 is a reply to message #48024] |
Wed, 04 June 2003 14:20  |
Eclipse User |
|
|
|
All,
I now have the new action added into the refactoring menu. I used a
different technique than the one indicated below. My plugin.xml looks
like this:
<extension
point="org.eclipse.ui.actionSets">
<actionSet
label="RefactoringActionSetLabel"
description="RefactoringActionSetLabelDescription"
visible="false"
id=" edu.mit.lcs.pag.testfactoring.refactoring.RefactoringActionS et ">
<action
definitionId=" edu.mit.lcs.pag.testfactoring.refactoring.replace.data.value .with.object "
label="Replace Data Value With Object"
retarget="true"
menubarPath="org.eclipse.jdt.ui.refactoring.menu/codingGroup "
id=" edu.mit.lcs.pag.testfactoring.refactoring.ReplaceDataValueWi thObject ">
</action>
</actionSet>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
name="Replace Data Value With Object"
description="Replace Data Value With Object"
category="org.eclipse.jdt.ui.category.refactoring"
id=" edu.mit.lcs.pag.testfactoring.refactoring.replace.data.value .with.object ">
</command>
<keyBinding
string=""
scope="org.eclipse.ui.globalScope"
command=" edu.mit.lcs.pag.testfactoring.refactoring.replace.data.value .with.object "
configuration="org.eclipse.ui.defaultAcceleratorConfiguration ">
</keyBinding>
</extension>
<extension
id="org.eclipse.jdt.ui.tfrjavaeditor"
point="org.eclipse.ui.editors">
<editor
name="TFR Java Editor"
default="true"
icon="icons/full/obj16/jcu_obj.gif"
extensions="java"
contributorClass=" org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor ActionContributor "
class=" edu.mit.lcs.pag.testfactoring.refactoring.TfrCompilationUnit Editor "
symbolicFontName="org.eclipse.jdt.ui.editors.textfont"
id=" edu.mit.lcs.pag.testfactoring.refactoring.TfrCompilationUnit Editor ">
</editor>
</extension>
If anyone wants more information, I'm happy to provide it. Share and Enjoy,
David Saff
David Saff wrote:
> 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,
>
> I originally posted this request on e.platform, and got the suggestion
> that I use a solution such as:
>
> <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>
>
> This doesn't appear to work for me, and I'm suspecting it's because of
> the hard-coding mentioned in the
> org.eclipse.jdt.ui.actions.RefactorActionGroup class. I'm interested in
> any thoughts you may have. Thanks again,
>
> David Saff
>
|
|
|
Powered by
FUDForum. Page generated in 0.03628 seconds