public final class RenameJavaScriptElementDescriptor extends JavaScriptRefactoringDescriptor
An instance of this refactoring descriptor may be obtained by calling
org.eclipse.ltk.core.refactoring.RefactoringContribution#createDescriptor()
on a refactoring
contribution requested by invoking
org.eclipse.ltk.core.refactoring.RefactoringCore#getRefactoringContribution(String)
with the
appropriate refactoring id.
Note: this class is not intended to be instantiated by clients.
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.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
Constructor and Description |
---|
RenameJavaScriptElementDescriptor(java.lang.String id)
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(java.lang.String patterns)
Sets the file name patterns to use during qualified name updating.
|
void |
setJavaElement(IJavaScriptElement 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(java.lang.String name)
Sets the new name to rename the Java element to.
|
void |
setProject(java.lang.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
public static final int STRATEGY_EMBEDDED
2
).public static final int STRATEGY_EXACT
1
).public static final int STRATEGY_SUFFIX
3
).public RenameJavaScriptElementDescriptor(java.lang.String id)
id
- the unique id of the rename refactoringIJavaScriptRefactorings
protected void populateArgumentMap()
populateArgumentMap
in class JavaScriptRefactoringDescriptor
public void setDeprecateDelegate(boolean deprecate)
Note: Deprecation of the delegate is currently applicable to the Java elements
IFunction
and IField
. The default is to not deprecate the
delegate.
deprecate
- true
to deprecate the delegate,
false
otherwisepublic void setFileNamePatterns(java.lang.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(IJavaScriptElement element)
Note: If the Java element to be renamed is of type
IJavaScriptElement.JAVASCRIPT_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 IFunction
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(java.lang.String name)
name
- the non-empty new name to setpublic void setProject(java.lang.String project)
Note: If the Java element to be renamed is of type
IJavaScriptElement.JAVASCRIPT_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 JavaScriptRefactoringDescriptor
project
- the non-empty project name to set, or null
for
the workspace#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 JavaScriptRefactoringDescriptor
Copyright (c) IBM Corp. and others 2000, 2016. All Rights Reserved.