Community
Participate
Working Groups
Build id: I20050219-1500 I declared a move participant that should be notified when a MoveMethod refactoring performs. This works fine if I move a static method. I looked into the code and saw that MoveInstanceMethodRefactoring is also implemented using the processor/participant architecture. However, if I perform a MoveInstanceMethod my participant never gets called. Below is plugin.xml part that deals with this: <extension point="org.eclipse.ltk.core.refactoring.moveParticipants"> <moveParticipant class="edu.uiuc.refactoringparticipants.PersistenceMoveInstanceMethodParticipan t" name="PersistenceMoveInstanceMethodParticipant" id="edu.uiuc.refactoringparticipants.PersistenceMoveInstanceMethodParticipant"> <enablement> <with variable="affectedNatures"> <iterate operator="or"> <equals value="org.eclipse.jdt.core.javanature" /> </iterate> </with> <with variable="element"> <instanceof value="org.eclipse.jdt.core.IMethod" /> </with> </enablement> </moveParticipant> </extension> And the participant code is below: public class PersistenceMoveInstanceMethodParticipant extends MoveParticipant { IMember member; protected boolean initialize(Object element) { member= (IMember) element; return true; } public String getName() { return "PersistenceMoveMemberParticipant"; } public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException { return new RefactoringStatus(); } public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { System.out.println("AHA - got you!!!"); return null; } } I tried to supply more information in the plugin.xml, at the moveParticipant extension point: <with variable="processorId"> <equals value="org.eclipse.jdt.ui.moveInstanceMethodProcessor" /> </with> I got this from the MoveInstanceMethodProcessor's IDENTIFIER. Did not work either (my participant code never got called). I also tried: <with variable="processorId"> <instanceOf value= ... fully qualified name of MoveInstanceMethodProcessor /> </with> and did not work either. I inserted a breakPoint into ProcessorBasedRefactoring #createChange (the place where it iterates over all the participants and creates all their chages) and I noticed that fParticipants does not contain my participant at all.
Dani, although the refactoring is implemented as a processor it doesn't currently load any participants(see method loadParticipants in MoveInstanceMethodProcessor). The refactorings that support participants are listed in the interface IRefactoringProcessorIds, which is public API. Adding this support will very likely not happen for 3.1. Our current focus is J2SE 5.0 and performance.
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.
I am developing the moreUnit plugin which helps user to write unit tests. There is refacotring support: if a user renames a method, the testcase gets renamed as well... I can not implement move method refactoring support for instance methods if participants are not supported. Any chance this will be added?
We have no plans to work on this, but we could look into a high quality patch. But note that this will not be as easy as participant support for moving resources or static members. The Move Instance Method refactoring not only moves the method, but it also adds a parameter sometimes, so this also needs to be reflected in the refactoring arguments.