Class RenameJavaElementDescriptor
- All Implemented Interfaces:
Comparable<org.eclipse.ltk.core.refactoring.RefactoringDescriptor>
An instance of this refactoring descriptor may be obtained by calling
RefactoringContribution.createDescriptor()
on a refactoring
contribution requested by invoking
RefactoringCore.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
Modifier and TypeFieldDescriptionstatic final int
Similar declaration updating strategy which finds exact names and embedded names as well (value:2
).static final int
Similar declaration updating strategy which finds exact names only (value:1
).static final int
Similar 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Populates the refactoring descriptor argument map based on the specified arguments.void
setDeprecateDelegate
(boolean deprecate) Determines whether the delegate for a Java element should be declared as deprecated.void
setFileNamePatterns
(String patterns) Sets the file name patterns to use during qualified name updating.void
setJavaElement
(IJavaElement element) Sets the Java element to be renamed.void
setKeepOriginal
(boolean delegate) Determines whether the the original Java element should be kept as delegate to the renamed one.void
setMatchStrategy
(int strategy) Determines which strategy should be used during similar declaration updating.void
setNewName
(String name) Sets the new name to rename the Java element to.void
setProject
(String project) Sets the project name of this refactoring.void
setRenameGetters
(boolean rename) Determines whether getter methods for the Java element should be renamed.void
setRenameSetters
(boolean rename) Determines whether setter methods for the Java element should be renamed.void
setUpdateHierarchy
(boolean update) Determines whether other Java elements in the hierarchy of the input element should be renamed as well.void
setUpdateQualifiedNames
(boolean update) Determines whether qualified names of the Java element should be renamed.void
setUpdateReferences
(boolean update) Determines whether references to the Java element should be renamed.void
setUpdateSimilarDeclarations
(boolean update) Determines whether similar declarations of the Java element should be updated.void
setUpdateTextualOccurrences
(boolean update) Determines whether textual occurrences of the Java element should be renamed.org.eclipse.ltk.core.refactoring.RefactoringStatus
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 Details
-
STRATEGY_EMBEDDED
public static final int STRATEGY_EMBEDDEDSimilar declaration updating strategy which finds exact names and embedded names as well (value:2
).- See Also:
-
STRATEGY_EXACT
public static final int STRATEGY_EXACTSimilar declaration updating strategy which finds exact names only (value:1
).- See Also:
-
STRATEGY_SUFFIX
public static final int STRATEGY_SUFFIXSimilar declaration updating strategy which finds exact names, embedded names and name suffixes (value:3
).- See Also:
-
-
Constructor Details
-
RenameJavaElementDescriptor
Creates a new refactoring descriptor.- Parameters:
id
- the unique id of the rename refactoring- See Also:
-
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, ornull
for a workspace refactoringdescription
- a non-empty human-readable description of the particular refactoring instancecomment
- the human-readable comment of the particular refactoring instance, ornull
for 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 Details
-
populateArgumentMap
protected void populateArgumentMap()Description copied from class:JavaRefactoringDescriptor
Populates the refactoring descriptor argument map based on the specified arguments. Subclasses should extend and add their arguments toJavaRefactoringDescriptor.fArguments
.- Overrides:
populateArgumentMap
in 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
IMethod
andIField
. The default is to not deprecate the delegate.- Parameters:
deprecate
-true
to deprecate the delegate,false
otherwise
-
setFileNamePatterns
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
IPackageFragment
andIType
. 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
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
IMethod
andIField
. The default is to not keep the original as delegate.- Parameters:
delegate
-true
to keep the original,false
otherwise
-
setMatchStrategy
public void setMatchStrategy(int strategy) Determines which strategy should be used during similar declaration updating.Valid arguments are
STRATEGY_EXACT
,STRATEGY_EMBEDDED
orSTRATEGY_SUFFIX
.Note: Similar declaration updating is currently applicable to Java elements of type
IType
. The default is to use theSTRATEGY_EXACT
match strategy.- Parameters:
strategy
- the match strategy to use
-
setNewName
Sets the new name to rename the Java element to.- Parameters:
name
- the non-empty new name to set
-
setProject
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:
setProject
in classJavaRefactoringDescriptor
- Parameters:
project
- the non-empty project name to set, ornull
for 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
IField
elements which do not represent enum constants only. The default is to not rename any getter methods.- Parameters:
rename
-true
to rename getter methods,false
otherwise
-
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
IField
elements which do not represent enum constants only. The default is to not rename any setter methods.- Parameters:
rename
-true
to rename setter methods,false
otherwise
-
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
-true
to update hierarchically,false
otherwise
-
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
IPackageFragment
andIType
. The default is to not rename qualified names.- Parameters:
update
-true
to update qualified names,false
otherwise
-
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
-true
to update references,false
otherwise
-
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
-true
to update similar declarations,false
otherwise
-
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
,IType
andIField
. The default is to not rename textual occurrences.- Parameters:
update
-true
to update occurrences,false
otherwise
-
validateDescriptor
public org.eclipse.ltk.core.refactoring.RefactoringStatus validateDescriptor()Description copied from class:JavaRefactoringDescriptor
Validates 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.FATAL
indicates that the refactoring descriptor cannot be used to create a refactoring instance.- Overrides:
validateDescriptor
in classJavaRefactoringDescriptor
- Returns:
- a refactoring status describing the outcome of the validation
-