public final class RenameJavaElementDescriptor extends JavaRefactoringDescriptor
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.
Modifier and Type | Field and Description |
---|---|
static int |
STRATEGY_EMBEDDED
Similar declaration updating strategy which finds exact names and
embedded names as well (value:
2 ). |
static int |
STRATEGY_EXACT
Similar declaration updating strategy which finds exact names only
(value:
1 ). |
static int |
STRATEGY_SUFFIX
Similar declaration updating strategy which finds exact names, embedded
names and name suffixes (value:
3 ). |
ATTRIBUTE_ELEMENT, ATTRIBUTE_INPUT, ATTRIBUTE_NAME, ATTRIBUTE_REFERENCES, ATTRIBUTE_SELECTION, ATTRIBUTE_VERSION, fArguments, JAR_MIGRATION, JAR_REFACTORING, JAR_SOURCE_ATTACHMENT, VALUE_VERSION_1_0
BREAKING_CHANGE, ID_UNKNOWN, MULTI_CHANGE, NONE, STRUCTURAL_CHANGE, USER_CHANGE
Constructor and Description |
---|
RenameJavaElementDescriptor(String id)
Creates a new refactoring descriptor.
|
RenameJavaElementDescriptor(String id,
String project,
String description,
String comment,
Map arguments,
int flags)
Creates a new refactoring descriptor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
populateArgumentMap()
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.
|
RefactoringStatus |
validateDescriptor()
Validates the refactoring descriptor with respect to the constraints
imposed by the represented refactoring.
|
createRefactoring, elementToHandle, getArguments, handleToElement, handleToElement, handleToElement, handleToResource, resourceToHandle, setComment, setDescription, setFlags
compareTo, createRefactoringContext, equals, getComment, getDescription, getFlags, getID, getProject, getTimeStamp, hashCode, setTimeStamp, toString
public static final int STRATEGY_EMBEDDED
2
).public static final int STRATEGY_EXACT
1
).public static final int STRATEGY_SUFFIX
3
).public RenameJavaElementDescriptor(String id)
id
- the unique id of the rename refactoringIJavaRefactorings
public RenameJavaElementDescriptor(String id, String project, String description, String comment, Map arguments, int flags)
id
- the ID of this descriptorproject
- the non-empty name of the project associated with this
refactoring, or null
for a workspace
refactoringdescription
- a non-empty human-readable description of the particular
refactoring instancecomment
- the human-readable comment of the particular refactoring
instance, or null
for no commentarguments
- a map of arguments that will be persisted and describes
all settings for this refactoringflags
- the flags of the refactoring descriptorIllegalArgumentException
- if the argument map contains invalid keys/valuesprotected void populateArgumentMap()
JavaRefactoringDescriptor.fArguments
.populateArgumentMap
in class JavaRefactoringDescriptor
public void setDeprecateDelegate(boolean deprecate)
Note: Deprecation of the delegate is currently applicable to the Java elements
IMethod
and IField
. The default is to not deprecate the
delegate.
deprecate
- true
to deprecate the delegate,
false
otherwisepublic void setFileNamePatterns(String patterns)
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
and IType
. The default is to use no
file name patterns (meaning that all files are processed).
patterns
- the non-empty file name patterns stringpublic void setJavaElement(IJavaElement element)
Note: If the Java element to be renamed is of type
IJavaElement.JAVA_PROJECT
, clients are required to to set the
project name to null
.
element
- the Java element to be renamedpublic void setKeepOriginal(boolean delegate)
Note: Keeping of original elements as delegates is currently applicable to the Java
elements IMethod
and IField
. The default is to not keep
the original as delegate.
delegate
- true
to keep the original, false
otherwisepublic void setMatchStrategy(int strategy)
Valid arguments are STRATEGY_EXACT
, STRATEGY_EMBEDDED
or STRATEGY_SUFFIX
.
Note: Similar declaration updating is currently applicable to Java elements of type
IType
. The default is to use the STRATEGY_EXACT
match
strategy.
strategy
- the match strategy to usepublic void setNewName(String name)
name
- the non-empty new name to setpublic void setProject(String project)
Note: If the Java element to be renamed is of type
IJavaElement.JAVA_PROJECT
, clients are required to to set the
project name to null
.
The default is to associate the refactoring with the workspace.
setProject
in class JavaRefactoringDescriptor
project
- the non-empty project name to set, or null
for
the workspaceRefactoringDescriptor.getProject()
public void setRenameGetters(boolean rename)
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.
rename
- true
to rename getter methods,
false
otherwisepublic void setRenameSetters(boolean rename)
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.
rename
- true
to rename setter methods,
false
otherwisepublic void setUpdateHierarchy(boolean update)
Note: Hierarchical updating is currently applicable for Java elements of
type IPackageFragment
. The default is to not update Java
elements hierarchically.
update
- true
to update hierarchically,
false
otherwisepublic void setUpdateQualifiedNames(boolean update)
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
and IType
. The default is to not rename
qualified names.
update
- true
to update qualified names,
false
otherwisepublic void setUpdateReferences(boolean update)
Note: Reference updating is currently applicable to all Java element types except
IPackageFragmentRoot
. The default is to not update references.
update
- true
to update references, false
otherwisepublic void setUpdateSimilarDeclarations(boolean update)
Note: Similar declaration updating is currently applicable to Java elements of type
IType
. The default is to not update similar declarations.
update
- true
to update similar declarations,
false
otherwisepublic void setUpdateTextualOccurrences(boolean update)
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
and IField
. The default
is to not rename textual occurrences.
update
- true
to update occurrences, false
otherwisepublic RefactoringStatus validateDescriptor()
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.
validateDescriptor
in class JavaRefactoringDescriptor
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.