compositeRefactoring.refactoring
Class InheritRefactoring
java.lang.Object
|
+--org.eclipse.jdt.internal.corext.refactoring.base.Refactoring
|
+--compositeRefactoring.refactoring.InheritRefactoring
- All Implemented Interfaces:
- IRefactoring
- public class InheritRefactoring
- extends Refactoring
- implements IRefactoring
This class is the representation of a refactoring performing an inheritence transformation.
Base inherits from Derived.
Base's superclass is changed to Derived unless one of the following enabling conditions are not
fulfilled:
- Base is not superclass of Derived. Otherwise, the InheritChange would cause a cyclic inheritance hierarchy.
- Base has no superclass yet.
- Derived is not equal to Base
InheritRefactoring
public InheritRefactoring(ICompilationUnit base,
ICompilationUnit derived)
- creates the InheritRefactoring object.
- Parameters:
base
- the subclass of the inheritence dependencyderived
- the superclass of the inheritence dependency
checkActivation
public RefactoringStatus checkActivation(IProgressMonitor pm)
throws JavaModelException
- checks if the refactoring can be activated, e.g. if the vompilation units
of base and derived exist, whether they are modifyable
- Overrides:
checkActivation
in class Refactoring
- Parameters:
pm
- a progress monitor tracking the check.- Returns:
- the status of the check
checkInput
public RefactoringStatus checkInput(IProgressMonitor pm)
throws JavaModelException
- checks the enabling conditions of the inherit refactoring. The conditions are
- base must not be superclass of derived (cyclic inheritence dependency)
- base and derived must not be the same
- all abstract methods of derived must be implemented in base
- Overrides:
checkInput
in class Refactoring
- Following copied from class:
org.eclipse.jdt.internal.corext.refactoring.base.Refactoring
- See Also:
Refactoring.checkActivation(org.eclipse.core.runtime.IProgressMonitor)
,
RefactoringStatus.isOK()
createChange
public IChange createChange(IProgressMonitor pm)
throws JavaModelException
- creates the change object for this refactoring. The change object is the actual transformation
of code.
- Specified by:
createChange
in interface IRefactoring
- Parameters:
pm
- the progress monitor tracking the change.- Returns:
- the change object.
getName
public String getName()
- gets the name of the refactoring.
- Specified by:
getName
in interface IRefactoring
- Returns:
- the name of the refactoring.