Class RenameJavaElementDescriptor
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.RefactoringDescriptor
-
- org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor
-
- org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor
-
- All Implemented Interfaces:
Comparable<RefactoringDescriptor>
public final class RenameJavaElementDescriptor extends JavaRefactoringDescriptor
Refactoring descriptor for the rename java element 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 Modifier and Type Field Description static intSTRATEGY_EMBEDDEDSimilar declaration updating strategy which finds exact names and embedded names as well (value:2).static intSTRATEGY_EXACTSimilar declaration updating strategy which finds exact names only (value:1).static intSTRATEGY_SUFFIXSimilar declaration updating strategy which finds exact names, embedded names and name suffixes (value:3).-
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 RenameJavaElementDescriptor(String id)Creates a new refactoring descriptor.RenameJavaElementDescriptor(String id, 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.voidsetDeprecateDelegate(boolean deprecate)Determines whether the delegate for a Java element should be declared as deprecated.voidsetFileNamePatterns(String patterns)Sets the file name patterns to use during qualified name updating.voidsetJavaElement(IJavaElement element)Sets the Java element to be renamed.voidsetKeepOriginal(boolean delegate)Determines whether the the original Java element should be kept as delegate to the renamed one.voidsetMatchStrategy(int strategy)Determines which strategy should be used during similar declaration updating.voidsetNewName(String name)Sets the new name to rename the Java element to.voidsetProject(String project)Sets the project name of this refactoring.voidsetRenameGetters(boolean rename)Determines whether getter methods for the Java element should be renamed.voidsetRenameSetters(boolean rename)Determines whether setter methods for the Java element should be renamed.voidsetUpdateHierarchy(boolean update)Determines whether other Java elements in the hierarchy of the input element should be renamed as well.voidsetUpdateQualifiedNames(boolean update)Determines whether qualified names of the Java element should be renamed.voidsetUpdateReferences(boolean update)Determines whether references to the Java element should be renamed.voidsetUpdateSimilarDeclarations(boolean update)Determines whether similar declarations of the Java element should be updated.voidsetUpdateTextualOccurrences(boolean update)Determines whether textual occurrences of the Java element should be renamed.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
-
Methods inherited from class org.eclipse.ltk.core.refactoring.RefactoringDescriptor
compareTo, createRefactoringContext, equals, getComment, getDescription, getFlags, getID, getProject, getTimeStamp, hashCode, setTimeStamp, toString
-
-
-
-
Field Detail
-
STRATEGY_EMBEDDED
public static final int STRATEGY_EMBEDDED
Similar declaration updating strategy which finds exact names and embedded names as well (value:2).- See Also:
- Constant Field Values
-
STRATEGY_EXACT
public static final int STRATEGY_EXACT
Similar declaration updating strategy which finds exact names only (value:1).- See Also:
- Constant Field Values
-
STRATEGY_SUFFIX
public static final int STRATEGY_SUFFIX
Similar declaration updating strategy which finds exact names, embedded names and name suffixes (value:3).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RenameJavaElementDescriptor
public RenameJavaElementDescriptor(String id)
Creates a new refactoring descriptor.- Parameters:
id- the unique id of the rename refactoring- See Also:
IJavaRefactorings
-
RenameJavaElementDescriptor
public RenameJavaElementDescriptor(String id, String project, String description, String comment, Map<String,String> arguments, int flags)
Creates a new refactoring descriptor.- Parameters:
id- the ID of this descriptorproject- 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
-
setDeprecateDelegate
public void setDeprecateDelegate(boolean deprecate)
Determines whether the delegate for a Java element should be declared as deprecated.Note: Deprecation of the delegate is currently applicable to the Java elements
IMethodandIField. The default is to not deprecate the delegate.- Parameters:
deprecate-trueto deprecate the delegate,falseotherwise
-
setFileNamePatterns
public void setFileNamePatterns(String patterns)
Sets the file name patterns to use during qualified name updating.The syntax of the file name patterns is a sequence of individual name patterns, separated by comma. Additionally, wildcard characters '*' (any string) and '?' (any character) may be used.
Note: If file name patterns are set, qualified name updating must be enabled by calling
setUpdateQualifiedNames(boolean).Note: Qualified name updating is currently applicable to the Java elements
IPackageFragmentandIType. The default is to use no file name patterns (meaning that all files are processed).- Parameters:
patterns- the non-empty file name patterns string
-
setJavaElement
public void setJavaElement(IJavaElement element)
Sets the Java element to be renamed.Note: If the Java element to be renamed is of type
IJavaElement.JAVA_PROJECT, clients are required to to set the project name tonull.- Parameters:
element- the Java element to be renamed
-
setKeepOriginal
public void setKeepOriginal(boolean delegate)
Determines whether the the original Java element should be kept as delegate to the renamed one.Note: Keeping of original elements as delegates is currently applicable to the Java elements
IMethodandIField. The default is to not keep the original as delegate.- Parameters:
delegate-trueto keep the original,falseotherwise
-
setMatchStrategy
public void setMatchStrategy(int strategy)
Determines which strategy should be used during similar declaration updating.Valid arguments are
STRATEGY_EXACT,STRATEGY_EMBEDDEDorSTRATEGY_SUFFIX.Note: Similar declaration updating is currently applicable to Java elements of type
IType. The default is to use theSTRATEGY_EXACTmatch strategy.- Parameters:
strategy- the match strategy to use
-
setNewName
public void setNewName(String name)
Sets the new name to rename the Java element to.- Parameters:
name- the non-empty new name to set
-
setProject
public void setProject(String project)
Sets the project name of this refactoring.Note: If the Java element to be renamed is of type
IJavaElement.JAVA_PROJECT, clients are required to to set the project name tonull.The default is to associate the refactoring with the workspace.
- Overrides:
setProjectin classJavaRefactoringDescriptor- Parameters:
project- the non-empty project name to set, ornullfor the workspace- See Also:
RefactoringDescriptor.getProject()
-
setRenameGetters
public void setRenameGetters(boolean rename)
Determines whether getter methods for the Java element should be renamed.Note: Renaming of getter methods is applicable for
IFieldelements which do not represent enum constants only. The default is to not rename any getter methods.- Parameters:
rename-trueto rename getter methods,falseotherwise
-
setRenameSetters
public void setRenameSetters(boolean rename)
Determines whether setter methods for the Java element should be renamed.Note: Renaming of setter methods is applicable for
IFieldelements which do not represent enum constants only. The default is to not rename any setter methods.- Parameters:
rename-trueto rename setter methods,falseotherwise
-
setUpdateHierarchy
public void setUpdateHierarchy(boolean update)
Determines whether other Java elements in the hierarchy of the input element should be renamed as well.Note: Hierarchical updating is currently applicable for Java elements of type
IPackageFragment. The default is to not update Java elements hierarchically.- Parameters:
update-trueto update hierarchically,falseotherwise
-
setUpdateQualifiedNames
public void setUpdateQualifiedNames(boolean update)
Determines whether qualified names of the Java element should be renamed.Qualified name updating adapts fully qualified names of the Java element to be renamed in non-Java text files. Clients may specify file name patterns by calling
setFileNamePatterns(String)to constrain the set of text files to be processed.Note: Qualified name updating is currently applicable to the Java elements
IPackageFragmentandIType. The default is to not rename qualified names.- Parameters:
update-trueto update qualified names,falseotherwise
-
setUpdateReferences
public void setUpdateReferences(boolean update)
Determines whether references to the Java element should be renamed.Note: Reference updating is currently applicable to all Java element types except
IPackageFragmentRoot. The default is to not update references.- Parameters:
update-trueto update references,falseotherwise
-
setUpdateSimilarDeclarations
public void setUpdateSimilarDeclarations(boolean update)
Determines whether similar declarations of the Java element should be updated.Note: Similar declaration updating is currently applicable to Java elements of type
IType. The default is to not update similar declarations.- Parameters:
update-trueto update similar declarations,falseotherwise
-
setUpdateTextualOccurrences
public void setUpdateTextualOccurrences(boolean update)
Determines whether textual occurrences of the Java element should be renamed.Textual occurrence updating adapts textual occurrences of the Java element to be renamed in Java comments and Java strings.
Note: Textual occurrence updating is currently applicable to the Java elements
IPackageFragment,ITypeandIField. The default is to not rename textual occurrences.- Parameters:
update-trueto update occurrences,falseotherwise
-
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
-
-