Eclipse Platform
Release 3.4

org.eclipse.ltk.core.refactoring.resource
Class RenameResourceDescriptor

java.lang.Object
  extended byorg.eclipse.ltk.core.refactoring.RefactoringDescriptor
      extended byorg.eclipse.ltk.core.refactoring.resource.RenameResourceDescriptor
All Implemented Interfaces:
Comparable

public final class RenameResourceDescriptor
extends RefactoringDescriptor

Refactoring descriptor for the rename resource 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 refactoring id (ID).

Note: this class is not intended to be subclassed or instantiated by clients.

Since:
3.4
Restriction
This class is not intended to be instantiated by clients.

Field Summary
static String ID
          Refactoring id of the 'Rename Resource' refactoring (value: org.eclipse.ltk.core.refactoring.rename.resource).
 
Fields inherited from class org.eclipse.ltk.core.refactoring.RefactoringDescriptor
BREAKING_CHANGE, ID_UNKNOWN, MULTI_CHANGE, NONE, STRUCTURAL_CHANGE, USER_CHANGE
 
Constructor Summary
RenameResourceDescriptor()
          Creates a new refactoring descriptor.
 
Method Summary
 Refactoring createRefactoring(RefactoringStatus status)
          Creates the a new refactoring instance for this refactoring descriptor.
 String getNewName()
          Returns the new name to rename the resource to.
 IPath getResourcePath()
          Returns the path of the resource to rename.
 boolean isUpdateReferences()
          Returns if this rename will also update references
 void setNewName(String name)
          Sets the new name to rename the resource to.
 void setProject(String project)
          Sets the project name of this refactoring.
 void setResourcePath(IPath resourcePath)
          Sets the resource to be renamed.
 void setUpdateReferences(boolean updateReferences)
          If set to true, this rename will also update references.
 
Methods inherited from class org.eclipse.ltk.core.refactoring.RefactoringDescriptor
compareTo, equals, getComment, getDescription, getFlags, getID, getProject, getTimeStamp, hashCode, setComment, setDescription, setFlags, setTimeStamp, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final String ID
Refactoring id of the 'Rename Resource' refactoring (value: org.eclipse.ltk.core.refactoring.rename.resource).

Clients may safely cast the obtained refactoring descriptor to RenameResourceDescriptor.

See Also:
Constant Field Values
Constructor Detail

RenameResourceDescriptor

public RenameResourceDescriptor()
Creates a new refactoring descriptor.

Clients should not instantiated this class but use RefactoringCore.getRefactoringContribution(String) with ID to get the contribution that can create the descriptor.

Method Detail

setNewName

public void setNewName(String name)
Sets the new name to rename the resource to.

Parameters:
name - the non-empty new name to set

getNewName

public String getNewName()
Returns the new name to rename the resource to.

Returns:
the new name to rename the resource to

setProject

public void setProject(String project)
Sets the project name of this refactoring.

Note: If the resource to be renamed is of type IResource.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 RefactoringDescriptor
Parameters:
project - the non-empty project name to set, or null for the workspace
See Also:
RefactoringDescriptor.getProject()

setResourcePath

public void setResourcePath(IPath resourcePath)
Sets the resource to be renamed.

Note: If the resource to be renamed is of type IResource.PROJECT, clients are required to to set the project name to null.

Parameters:
resourcePath - the resource to be renamed

getResourcePath

public IPath getResourcePath()
Returns the path of the resource to rename.

Returns:
the path of the resource to rename

setUpdateReferences

public void setUpdateReferences(boolean updateReferences)
If set to true, this rename will also update references. The default is to update references.

Parameters:
updateReferences - true if this rename will update references

isUpdateReferences

public boolean isUpdateReferences()
Returns if this rename will also update references

Returns:
returns true if this rename will update references

createRefactoring

public Refactoring createRefactoring(RefactoringStatus status)
                              throws CoreException
Description copied from class: RefactoringDescriptor
Creates the a new refactoring instance for this refactoring descriptor.

This method is used by the refactoring framework to instantiate a refactoring from a refactoring descriptor, in order to apply it later on a local or remote workspace.

The returned refactoring must be in an initialized state, i.e. ready to be executed via PerformRefactoringOperation.

Specified by:
createRefactoring in class RefactoringDescriptor
Parameters:
status - a refactoring status used to describe the outcome of the initialization
Returns:
the refactoring, or null if this refactoring descriptor represents the unknown refactoring, or if no refactoring contribution is available for this refactoring descriptor which is capable to create a refactoring
Throws:
CoreException - if an error occurs while creating the refactoring instance

Eclipse Platform
Release 3.4

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.