Composite Refactoring
v1.0

compositeRefactoring.changes
Class CreateAbstractMethodChange

java.lang.Object
  |
  +--org.eclipse.jdt.internal.corext.refactoring.base.Change
        |
        +--compositeRefactoring.changes.CreateAbstractMethodChange
All Implemented Interfaces:
IChange

public class CreateAbstractMethodChange
extends Change
implements IChange

This class represents an IChange for the refactoring CreateAbstractMethodRefactoring. It is created when the method CreateAbstractMethodRefactoring.createChange(IProgressMonitor pm) is called. An abstract method (with no body) is created and stored in the parent element, here an IType object.


Fields inherited from interface org.eclipse.jdt.internal.corext.refactoring.base.IChange
REFACTORING_CHANGE_ABORTED
 
Constructor Summary
CreateAbstractMethodChange(IType parentType, String name, String returnType, String[] parameters)
          creates a new CreateAbstractMethodChange object.
 
Method Summary
 Object getModifiedLanguageElement()
          gets the modified language element.
 String getName()
          gets the name of this change.
 IChange getUndoChange()
          gets the undo change.
 void perform(ChangeContext context, IProgressMonitor pm)
          performs the change.
 
Methods inherited from class org.eclipse.jdt.internal.corext.refactoring.base.Change
aboutToPerform, checkIfModifiable, checkIfModifiable, handleException, handleJavaModelException, isActive, isUndoable, performed, setActive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jdt.internal.corext.refactoring.base.IChange
aboutToPerform, isActive, isUndoable, performed, setActive
 

Constructor Detail

CreateAbstractMethodChange

public CreateAbstractMethodChange(IType parentType,
                                  String name,
                                  String returnType,
                                  String[] parameters)
creates a new CreateAbstractMethodChange object.
Parameters:
parentType - the Type in which the new method is to be created.
name - the name of the abstract method.
returnType - the return type of the abstract method.
parameters - the method's parameter. The String array should look like {"Object o", "java.util.Vector", "int i"}.
Method Detail

perform

public void perform(ChangeContext context,
                    IProgressMonitor pm)
             throws JavaModelException,
                    ChangeAbortException
performs the change. When this method is called, a new abstract method is created in the parentType. The method's declaration is "public abstrac 'methodName'('parameters');".
Specified by:
perform in interface IChange
Parameters:
context - the change context in which the change is performed
pm - a progress monitor tracking the changes.

getUndoChange

public IChange getUndoChange()
gets the undo change. The undo change deletes the created method from the parentType.
Specified by:
getUndoChange in interface IChange
Returns:
the undo change.

getName

public String getName()
gets the name of this change.
Specified by:
getName in interface IChange
Following copied from interface: org.eclipse.jdt.internal.corext.refactoring.base.IChange
Returns:
the change's name.

getModifiedLanguageElement

public Object getModifiedLanguageElement()
gets the modified language element. In this case, the modified language element is a type.
Specified by:
getModifiedLanguageElement in interface IChange
Returns:
the modified language element.

Composite Refactoring
v1.0