Class MoveDescriptor
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.RefactoringDescriptor
-
- org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor
-
- org.eclipse.jdt.core.refactoring.descriptors.MoveDescriptor
-
- All Implemented Interfaces:
Comparable<RefactoringDescriptor>
public final class MoveDescriptor extends JavaRefactoringDescriptor
Refactoring descriptor for the move 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 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 MoveDescriptor()
Creates a new refactoring descriptor.MoveDescriptor(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 void
populateArgumentMap()
Populates the refactoring descriptor argument map based on the specified arguments.void
setDestination(IResource resource)
Sets the destination of the move.void
setDestination(IJavaElement element)
Sets the destination of the move.void
setFileNamePatterns(String patterns)
Sets the file name patterns to use during qualified name updating.void
setMoveMembers(IMember[] members)
Sets the members to move.void
setMovePackageFragmentRoots(IPackageFragmentRoot[] roots)
Sets the package fragment roots to move.void
setMovePackages(IPackageFragment[] fragments)
Sets the package fragments to move.void
setMoveResources(IFile[] files, IFolder[] folders, ICompilationUnit[] units)
Sets the resources and compilation units to move.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.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, setProject
-
Methods inherited from class org.eclipse.ltk.core.refactoring.RefactoringDescriptor
compareTo, createRefactoringContext, equals, getComment, getDescription, getFlags, getID, getProject, getTimeStamp, hashCode, setTimeStamp, toString
-
-
-
-
Constructor Detail
-
MoveDescriptor
public MoveDescriptor()
Creates a new refactoring descriptor.
-
MoveDescriptor
public MoveDescriptor(String project, String description, String comment, Map<String,String> arguments, int flags)
Creates a new refactoring descriptor.- Parameters:
project
- 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- Since:
- 1.2
-
-
Method Detail
-
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
-
setDestination
public void setDestination(IJavaElement element)
Sets the destination of the move.Note: Clients may call only one of the
setDestination
methods.- Parameters:
element
- the java element
-
setDestination
public void setDestination(IResource resource)
Sets the destination of the move.Note: Clients may call only one of the
setDestination
methods.- Parameters:
resource
- the resource
-
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 files, folders and compilation units. The default is to not update qualified names.
- Parameters:
patterns
- the non-empty file name patterns string
-
setMoveMembers
public void setMoveMembers(IMember[] members)
Sets the members to move.Note: Clients must only call one of the
setMoveXXX
methods.- Parameters:
members
- the members to move
-
setMovePackageFragmentRoots
public void setMovePackageFragmentRoots(IPackageFragmentRoot[] roots)
Sets the package fragment roots to move.Note: Clients must only call one of the
setMoveXXX
methods.- Parameters:
roots
- the package fragment roots to move
-
setMovePackages
public void setMovePackages(IPackageFragment[] fragments)
Sets the package fragments to move.Note: Clients must only call one of the
setMoveXXX
methods.- Parameters:
fragments
- the package fragments to move
-
setMoveResources
public void setMoveResources(IFile[] files, IFolder[] folders, ICompilationUnit[] units)
Sets the resources and compilation units to move.Note: Clients must only call one of the
setMoveXXX
methods.- Parameters:
files
- the files to movefolders
- the folders to moveunits
- the compilation units to move
-
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 files, folders and compilation units. The default is to use no file name patterns (meaning that all files are processed).
- 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.- Parameters:
update
-true
to update references,false
otherwise
-
validateDescriptor
public 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
-
-