org.eclipse.xtext.common.types.ui.refactoring.participant
Class CompositeRefactoringProcessor

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor
          extended by org.eclipse.ltk.core.refactoring.participants.RenameProcessor
              extended by org.eclipse.xtext.ui.refactoring.impl.AbstractRenameProcessor
                  extended by org.eclipse.xtext.common.types.ui.refactoring.participant.CompositeRefactoringProcessor
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable

public class CompositeRefactoringProcessor
extends AbstractRenameProcessor

This class aggregates all processors of the participants to the same JDT refactoring and combines their changes. Unfortunately, JDT loads the same refactoring participants multiple times for the same refactoring processor (for different refactoring modifications). OTOH we have to combine the changes of the multiple participant calls in order to avoid collisions. We solve this with a singleton CompositeRefactoringProcessor.Access class, that keeps track of the ongoing JDT refactoring.

Author:
Jan Koehnlein - Initial contribution and API

Nested Class Summary
static class CompositeRefactoringProcessor.Access
           
 
Constructor Summary
CompositeRefactoringProcessor()
           
 
Method Summary
 boolean addProcessor(org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor processor)
           
 org.eclipse.ltk.core.refactoring.RefactoringStatus checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor pm, org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext context)
           
 org.eclipse.ltk.core.refactoring.RefactoringStatus checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor pm)
           
 org.eclipse.ltk.core.refactoring.Change createChange(org.eclipse.core.runtime.IProgressMonitor pm)
           
 java.lang.Object[] getElements()
           
 java.lang.String getIdentifier()
           
 java.lang.String getNewName()
           
 int getNumProcessors()
           
 java.lang.String getOriginalName()
           
 java.lang.String getProcessorName()
           
 boolean initialize(IRenameElementContext renameElementContext)
           
 boolean isApplicable()
           
 org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant[] loadParticipants(org.eclipse.ltk.core.refactoring.RefactoringStatus status, org.eclipse.ltk.core.refactoring.participants.SharableParticipants sharedParticipants)
           
 void setNewName(java.lang.String newName)
           
 org.eclipse.ltk.core.refactoring.RefactoringStatus validateNewName(java.lang.String newName)
           
 
Methods inherited from class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor
getRefactoring, postCreateChange
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeRefactoringProcessor

public CompositeRefactoringProcessor()
Method Detail

addProcessor

public boolean addProcessor(org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor processor)

getNumProcessors

public int getNumProcessors()

getElements

public java.lang.Object[] getElements()
Specified by:
getElements in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor

getProcessorName

public java.lang.String getProcessorName()
Specified by:
getProcessorName in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor

isApplicable

public boolean isApplicable()
                     throws org.eclipse.core.runtime.CoreException
Specified by:
isApplicable in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor
Throws:
org.eclipse.core.runtime.CoreException

checkInitialConditions

public org.eclipse.ltk.core.refactoring.RefactoringStatus checkInitialConditions(org.eclipse.core.runtime.IProgressMonitor pm)
                                                                          throws org.eclipse.core.runtime.CoreException,
                                                                                 org.eclipse.core.runtime.OperationCanceledException
Specified by:
checkInitialConditions in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor
Throws:
org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.OperationCanceledException

checkFinalConditions

public org.eclipse.ltk.core.refactoring.RefactoringStatus checkFinalConditions(org.eclipse.core.runtime.IProgressMonitor pm,
                                                                               org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext context)
                                                                        throws org.eclipse.core.runtime.CoreException,
                                                                               org.eclipse.core.runtime.OperationCanceledException
Specified by:
checkFinalConditions in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor
Throws:
org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.OperationCanceledException

createChange

public org.eclipse.ltk.core.refactoring.Change createChange(org.eclipse.core.runtime.IProgressMonitor pm)
                                                     throws org.eclipse.core.runtime.CoreException,
                                                            org.eclipse.core.runtime.OperationCanceledException
Specified by:
createChange in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor
Throws:
org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.OperationCanceledException

loadParticipants

public org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant[] loadParticipants(org.eclipse.ltk.core.refactoring.RefactoringStatus status,
                                                                                               org.eclipse.ltk.core.refactoring.participants.SharableParticipants sharedParticipants)
                                                                                        throws org.eclipse.core.runtime.CoreException
Specified by:
loadParticipants in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor
Throws:
org.eclipse.core.runtime.CoreException

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in class org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor

initialize

public boolean initialize(IRenameElementContext renameElementContext)
Specified by:
initialize in class AbstractRenameProcessor

getOriginalName

public java.lang.String getOriginalName()
Specified by:
getOriginalName in class AbstractRenameProcessor

getNewName

public java.lang.String getNewName()
Specified by:
getNewName in class AbstractRenameProcessor

setNewName

public void setNewName(java.lang.String newName)
Specified by:
setNewName in class AbstractRenameProcessor

validateNewName

public org.eclipse.ltk.core.refactoring.RefactoringStatus validateNewName(java.lang.String newName)
Specified by:
validateNewName in class AbstractRenameProcessor