org.prorefactor.refactor.action
Class ExtractMethod
java.lang.Object
org.prorefactor.refactor.action.ExtractMethod
public class ExtractMethod
- extends java.lang.Object
Provides the Extract Method Refactoring.
Extracts a selected segment of source, and moves
it to a new method, replacing the original segment
with a call to the new method. Calculates the
parameters necessary for data elements in the selection.
Places the new method at the end of the file.
Field Summary |
protected boolean |
useCaps
|
Method Summary |
protected void |
checkFieldRef(FieldRefNode refNode)
Check if a Field_ref is in the selection range. |
java.lang.String |
generateCallText()
|
java.lang.String |
generateMethodText()
|
java.lang.String |
getMethodName()
|
java.lang.String |
getSelectedText()
|
void |
run(java.io.File sourceFile,
int[] selectionBegin,
int[] selectionEnd,
java.io.File compileFile)
Run this refactor for a file and an integer array [4]
with the start line/column and end line/column of the code
section to be extracted. |
void |
setMethodName(java.lang.String string)
|
void |
setSelectedText(java.lang.String string)
|
java.lang.String |
zztrace01()
This tracing/debugging method gets a string representation of the arguments list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
useCaps
protected boolean useCaps
ExtractMethod
public ExtractMethod(Rollback rollback)
checkFieldRef
protected void checkFieldRef(FieldRefNode refNode)
- Check if a Field_ref is in the selection range.
Update our reference list if so.
generateCallText
public java.lang.String generateCallText()
generateMethodText
public java.lang.String generateMethodText()
getMethodName
public java.lang.String getMethodName()
getSelectedText
public java.lang.String getSelectedText()
run
public void run(java.io.File sourceFile,
int[] selectionBegin,
int[] selectionEnd,
java.io.File compileFile)
throws RefactorException,
java.io.IOException
- Run this refactor for a file and an integer array [4]
with the start line/column and end line/column of the code
section to be extracted.
- Parameters:
sourceFile
- The source file containing the segment to be extracted.selectionBegin
- line/columnselectionEnd
- line/column endcompileFile
- The source file for the compile unit for building
an AST. Is different than the sourceFile if the sourceFile is not
compilable.
- Throws:
RefactorException
java.io.IOException
setMethodName
public void setMethodName(java.lang.String string)
setSelectedText
public void setSelectedText(java.lang.String string)
zztrace01
public java.lang.String zztrace01()
- This tracing/debugging method gets a string representation of the arguments list.
Copyright © 2008 Joanju Software. All Rights Reserved.