Class UseSupertypeDescriptor
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.RefactoringDescriptor
-
- org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor
-
- org.eclipse.jdt.core.refactoring.descriptors.UseSupertypeDescriptor
-
- All Implemented Interfaces:
Comparable<RefactoringDescriptor>
public final class UseSupertypeDescriptor extends JavaRefactoringDescriptor
Refactoring descriptor for the use supertype refactoring.An instance of this refactoring descriptor may be obtained by calling
RefactoringContribution.createDescriptor()on a refactoring contribution requested by invokingRefactoringCore.getRefactoringContribution(String)with the appropriate refactoring id.Note: this class is not intended to be instantiated by clients.
- Since:
- 1.1
- Restriction:
- This class is not intended to be instantiated by clients.
-
-
Field Summary
-
Fields inherited from class org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor
ATTRIBUTE_ELEMENT, ATTRIBUTE_INPUT, ATTRIBUTE_NAME, ATTRIBUTE_REFERENCES, ATTRIBUTE_SELECTION, ATTRIBUTE_VERSION, fArguments, JAR_MIGRATION, JAR_REFACTORING, JAR_SOURCE_ATTACHMENT, VALUE_VERSION_1_0
-
Fields inherited from class org.eclipse.ltk.core.refactoring.RefactoringDescriptor
BREAKING_CHANGE, ID_UNKNOWN, MULTI_CHANGE, NONE, STRUCTURAL_CHANGE, USER_CHANGE
-
-
Constructor Summary
Constructors Constructor Description UseSupertypeDescriptor()Creates a new refactoring descriptor.UseSupertypeDescriptor(String project, String description, String comment, Map<String,String> arguments, int flags)Creates a new refactoring descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidpopulateArgumentMap()Populates the refactoring descriptor argument map based on the specified arguments.voidsetReplaceInstanceof(boolean replace)Determines whether 'instanceof' statements are considered as candidates to replace the subtype occurrence by one of its supertypes.voidsetSubtype(IType type)Sets the subtype of the refactoring.voidsetSupertype(IType type)Sets the supertype of the refactoring.RefactoringStatusvalidateDescriptor()Validates the refactoring descriptor with respect to the constraints imposed by the represented refactoring.-
Methods inherited from class org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor
createRefactoring, elementToHandle, getArguments, handleToElement, handleToElement, handleToElement, handleToResource, resourceToHandle, setComment, setDescription, setFlags, setProject
-
Methods inherited from class org.eclipse.ltk.core.refactoring.RefactoringDescriptor
compareTo, createRefactoringContext, equals, getComment, getDescription, getFlags, getID, getProject, getTimeStamp, hashCode, setTimeStamp, toString
-
-
-
-
Constructor Detail
-
UseSupertypeDescriptor
public UseSupertypeDescriptor()
Creates a new refactoring descriptor.
-
UseSupertypeDescriptor
public UseSupertypeDescriptor(String project, String description, String comment, Map<String,String> arguments, int flags)
Creates a new refactoring descriptor.- Parameters:
project- the non-empty name of the project associated with this refactoring, ornullfor a workspace refactoringdescription- a non-empty human-readable description of the particular refactoring instancecomment- the human-readable comment of the particular refactoring instance, ornullfor no commentarguments- a map of arguments that will be persisted and describes all settings for this refactoringflags- the flags of the refactoring descriptor- Throws:
IllegalArgumentException- if the argument map contains invalid keys/values- Since:
- 1.2
-
-
Method Detail
-
populateArgumentMap
protected void populateArgumentMap()
Description copied from class:JavaRefactoringDescriptorPopulates the refactoring descriptor argument map based on the specified arguments. Subclasses should extend and add their arguments toJavaRefactoringDescriptor.fArguments.- Overrides:
populateArgumentMapin classJavaRefactoringDescriptor
-
setReplaceInstanceof
public void setReplaceInstanceof(boolean replace)
Determines whether 'instanceof' statements are considered as candidates to replace the subtype occurrence by one of its supertypes.The default is to not replace the subtype occurrence.
- Parameters:
replace-trueto replace subtype occurrences in 'instanceof' statements,falseotherwise
-
setSubtype
public void setSubtype(IType type)
Sets the subtype of the refactoring.Occurrences of the subtype are replaced by the supertype set by
setSupertype(IType)where possible.- Parameters:
type- the subtype to set
-
setSupertype
public void setSupertype(IType type)
Sets the supertype of the refactoring.Occurrences of the subtype set by
setSubtype(IType)are replaced by the supertype where possible.- Parameters:
type- the supertype to set
-
validateDescriptor
public RefactoringStatus validateDescriptor()
Description copied from class:JavaRefactoringDescriptorValidates the refactoring descriptor with respect to the constraints imposed by the represented refactoring.Clients must call this method to verify that all arguments have been correctly set and that they satisfy the constraints imposed by specific refactorings. Returning a refactoring status of severity
RefactoringStatus.FATALindicates that the refactoring descriptor cannot be used to create a refactoring instance.- Overrides:
validateDescriptorin classJavaRefactoringDescriptor- Returns:
- a refactoring status describing the outcome of the validation
-
-