Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.ui.refactoring
Class RenameSupport


java.lang.Object
  extended by 
org.eclipse.jdt.ui.refactoring.RenameSupport

public class RenameSupport
extends Object

Central access point to execute rename refactorings.

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

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

Field Summary
static int NONE
          Flag indication that no additional update is to be performed.
static int UPDATE_GETTER_METHOD
          Flag indicating that the getter method is to be updated as well.
static int UPDATE_JAVADOC_COMMENTS
          Deprecated. use UPDATE_REFERENCES or UPDATE_TEXTUAL_MATCHES or both.
static int UPDATE_REFERENCES
          Flag indicating that references are to be updated as well.
static int UPDATE_REGULAR_COMMENTS
          Deprecated. use UPDATE_TEXTUAL_MATCHES
static int UPDATE_SETTER_METHOD
          Flag indicating that the setter method is to be updated as well.
static int UPDATE_STRING_LITERALS
          Deprecated. use UPDATE_TEXTUAL_MATCHES
static int UPDATE_TEXTUAL_MATCHES
          Flag indicating that textual matches in comments and in string literals are to be updated as well.
 
Method Summary
static  RenameSupport create ( ICompilationUnit unit, String newName, int flags)
          Creates a new rename support for the given ICompilationUnit.
static  RenameSupport create ( IField field, String newName, int flags)
          Creates a new rename support for the given IField.
static  RenameSupport create ( IJavaProject project, String newName, int flags)
          Creates a new rename support for the given IJavaProject.
static  RenameSupport create ( ILocalVariable variable, String newName, int flags)
          Creates a new rename support for the given ILocalVariable.
static  RenameSupport create ( IMethod method, String newName, int flags)
          Creates a new rename support for the given IMethod.
static  RenameSupport create ( IPackageFragmentRoot root, String newName)
          Creates a new rename support for the given IPackageFragmentRoot.
static  RenameSupport create ( IPackageFragment fragment, String newName, int flags)
          Creates a new rename support for the given IPackageFragment.
static  RenameSupport create ( ITypeParameter parameter, String newName, int flags)
          Creates a new rename support for the given ITypeParameter.
static  RenameSupport create ( IType type, String newName, int flags)
          Creates a new rename support for the given IType.
static  RenameSupport create ( RenameJavaElementDescriptor descriptor)
          Creates a new rename support for the given RenameJavaElementDescriptor.
 void openDialog ( Shell parent)
          Opens the refactoring dialog for this rename support.
 boolean openDialog ( Shell parent, boolean showPreviewOnly)
          Opens the refactoring dialog for this rename support.
 void perform ( Shell parent, IRunnableContext context)
          Executes the rename refactoring without showing a dialog to gather additional user input (for example the new name of the IJavaElement).
  IStatus preCheck ()
          Executes some light weight precondition checking.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Flag indication that no additional update is to be performed.

See Also:
Constant Field Values

UPDATE_REFERENCES

public static final int UPDATE_REFERENCES
Flag indicating that references are to be updated as well.

See Also:
Constant Field Values

UPDATE_JAVADOC_COMMENTS

public static final int UPDATE_JAVADOC_COMMENTS
Deprecated. use UPDATE_REFERENCES or UPDATE_TEXTUAL_MATCHES or both.
Flag indicating that Javadoc comments are to be updated as well.

See Also:
Constant Field Values

UPDATE_REGULAR_COMMENTS

public static final int UPDATE_REGULAR_COMMENTS
Deprecated. use UPDATE_TEXTUAL_MATCHES
Flag indicating that regular comments are to be updated as well.

See Also:
Constant Field Values

UPDATE_STRING_LITERALS

public static final int UPDATE_STRING_LITERALS
Deprecated. use UPDATE_TEXTUAL_MATCHES
Flag indicating that string literals are to be updated as well.

See Also:
Constant Field Values

UPDATE_TEXTUAL_MATCHES

public static final int UPDATE_TEXTUAL_MATCHES
Flag indicating that textual matches in comments and in string literals are to be updated as well.

Since:
3.0
See Also:
Constant Field Values

UPDATE_GETTER_METHOD

public static final int UPDATE_GETTER_METHOD
Flag indicating that the getter method is to be updated as well.

See Also:
Constant Field Values

UPDATE_SETTER_METHOD

public static final int UPDATE_SETTER_METHOD
Flag indicating that the setter method is to be updated as well.

See Also:
Constant Field Values
Method Detail

preCheck

public 
IStatus preCheck()
                 throws 
CoreException
Executes some light weight precondition checking. If the returned status is an error then the refactoring can't be executed at all. However, returning an OK status doesn't guarantee that the refactoring can be executed. It may still fail while performing the exhaustive precondition checking done inside the methods openDialog or perform. The method is mainly used to determine enable/disablement of actions.

Returns:
the result of the light weight precondition checking.
Throws:
CoreException - if an unexpected exception occurs while performing the checking.
See Also:
openDialog(Shell), perform(Shell, IRunnableContext)

openDialog

public void openDialog(
Shell parent)
                throws 
CoreException
Opens the refactoring dialog for this rename support.

Parameters:
parent - a shell used as a parent for the refactoring dialog.
Throws:
CoreException - if an unexpected exception occurs while opening the dialog.
See Also:
openDialog(Shell, boolean)

openDialog

public boolean openDialog(
Shell parent,
                          boolean showPreviewOnly)
                   throws 
CoreException
Opens the refactoring dialog for this rename support.

This method has to be called from within the UI thread.

Parameters:
parent - a shell used as a parent for the refactoring, preview, or error dialog
showPreviewOnly - if true, the dialog skips all user input pages and directly shows the preview or error page. Otherwise, shows all pages.
Returns:
true if the refactoring has been executed successfully, false if it has been canceled or if an error has happened during initial conditions checking.
Throws:
CoreException - if an error occurred while executing the operation.
Since:
3.3
See Also:
openDialog(Shell)

perform

public void perform(
Shell parent,
                    
IRunnableContext context)
             throws 
InterruptedException,
                    
InvocationTargetException
Executes the rename refactoring without showing a dialog to gather additional user input (for example the new name of the IJavaElement). Only an error dialog is shown (if necessary) to present the result of the refactoring's full precondition checking.

The method has to be called from within the UI thread.

Parameters:
parent - a shell used as a parent for the error dialog.
context - a IRunnableContext to execute the operation.
Throws:
InterruptedException - if the operation has been canceled by the user.
InvocationTargetException - if an error occurred while executing the operation.
See Also:
openDialog(Shell), IRunnableContext.run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)

create

public static 
RenameSupport create(
RenameJavaElementDescriptor descriptor)
                            throws 
CoreException
Creates a new rename support for the given RenameJavaElementDescriptor.

Parameters:
descriptor - the RenameJavaElementDescriptor to create a RenameSupport for. The caller is responsible for configuring the descriptor before it is passed.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.
Since:
3.3

create

public static 
RenameSupport create(
IJavaProject project,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given IJavaProject.

Parameters:
project - the IJavaProject to be renamed.
newName - the project's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.

create

public static 
RenameSupport create(
IPackageFragmentRoot root,
                                   
String newName)
                            throws 
CoreException
Creates a new rename support for the given IPackageFragmentRoot.

Parameters:
root - the IPackageFragmentRoot to be renamed.
newName - the package fragment root's new name. null is a valid value indicating that no new name is provided.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.

create

public static 
RenameSupport create(
IPackageFragment fragment,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given IPackageFragment.

Parameters:
fragment - the IPackageFragment to be renamed.
newName - the package fragment's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES, and UPDATE_TEXTUAL_MATCHES, or their bitwise OR, or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.

create

public static 
RenameSupport create(
ICompilationUnit unit,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given ICompilationUnit.

Parameters:
unit - the ICompilationUnit to be renamed.
newName - the compilation unit's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES, and UPDATE_TEXTUAL_MATCHES, or their bitwise OR, or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.

create

public static 
RenameSupport create(
IType type,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given IType.

Parameters:
type - the IType to be renamed.
newName - the type's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES, and UPDATE_TEXTUAL_MATCHES, or their bitwise OR, or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.

create

public static 
RenameSupport create(
IMethod method,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given IMethod.

Parameters:
method - the IMethod to be renamed.
newName - the method's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.

create

public static 
RenameSupport create(
IField field,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given IField.

Parameters:
field - the IField to be renamed.
newName - the field's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES, UPDATE_TEXTUAL_MATCHES, UPDATE_GETTER_METHOD, and UPDATE_SETTER_METHOD, or their bitwise OR, or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.

create

public static 
RenameSupport create(
ITypeParameter parameter,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given ITypeParameter.

Parameters:
parameter - the ITypeParameter to be renamed.
newName - the parameter's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES, or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.
Since:
3.1

create

public static 
RenameSupport create(
ILocalVariable variable,
                                   
String newName,
                                   int flags)
                            throws 
CoreException
Creates a new rename support for the given ILocalVariable.

Parameters:
variable - the ILocalVariable to be renamed.
newName - the variable's new name. null is a valid value indicating that no new name is provided.
flags - flags controlling additional parameters. Valid flags are UPDATE_REFERENCES, or NONE.
Returns:
the RenameSupport.
Throws:
CoreException - if an unexpected error occurred while creating the RenameSupport.
Since:
3.1

Eclipse JDT
Release 3.5

Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire