|
|
|
|
org.eclipse.jdt.core.refactoring.descriptors
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
-
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 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
|
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 ). |
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
|
Method Summary
|
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. |
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,
equals,
getComment,
getDescription,
getFlags,
getID,
getProject,
getTimeStamp,
hashCode,
setTimeStamp,
toString
|
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
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 arguments,
int flags)
- Creates a new refactoring descriptor.
-
Parameters:
-
id - the ID of this descriptor -
project - the non-empty name of the project associated with this
refactoring, or null for a workspace
refactoring -
description - a non-empty human-readable description of the particular
refactoring instance -
comment - the human-readable comment of the particular refactoring
instance, or null for no comment -
arguments - a map of arguments that will be persisted and describes
all settings for this refactoring -
flags - the flags of the refactoring descriptor
-
Throws:
-
IllegalArgumentException
- if the argument map contains invalid keys/values -
Since:
- 1.2
populateArgumentMap
protected void populateArgumentMap()
- Populates the refactoring descriptor argument map based on the specified
arguments. Subclasses should extend and add their arguments to
JavaRefactoringDescriptor.fArguments .
-
-
Overrides:
-
populateArgumentMap
in class
JavaRefactoringDescriptor
-
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 and
IField . The default is to not deprecate the
delegate.
-
-
Parameters:
-
deprecate - true to deprecate the delegate,
false otherwise
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
IPackageFragment and
IType . 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 to null .
-
-
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 and
IField . 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
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.
-
-
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 to null .
The default is to associate the refactoring with the workspace.
-
-
Overrides:
-
setProject
in class
JavaRefactoringDescriptor
-
-
Parameters:
-
project - the non-empty project name to set, or null 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 and
IType . 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 and
IField . The default
is to not rename textual occurrences.
-
-
Parameters:
-
update - true to update occurrences, false
otherwise
validateDescriptor
public
RefactoringStatus validateDescriptor()
- 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 class
JavaRefactoringDescriptor
-
-
Returns:
- a refactoring status describing the outcome of the validation
Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.
|
|
|