01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.refactor.method;
10:
11: import net.sourceforge.jrefactory.ast.SimpleNode;
12: import org.acm.seguin.refactor.TransformAST;
13: import org.acm.seguin.summary.Summary;
14: import org.acm.seguin.summary.FileSummary;
15: import org.acm.seguin.summary.MethodSummary;
16: import org.acm.seguin.summary.SummaryLoadVisitor;
17: import org.acm.seguin.summary.SummaryLoaderState;
18:
19: /**
20: * A transform that renames a specific method
21: *
22: * @author Mike Atkinson
23: * @since 2.9.11
24: */
25: public class RenameMethodTransform extends TransformAST {
26: private MethodSummary oldMethod;
27: private String newName;
28:
29: /**
30: * Constructor for the RemoveFieldTransform object
31: *
32: *@param oldName Description of Parameter
33: *@param newName Description of Parameter
34: */
35: public RenameMethodTransform(MethodSummary oldMethod, String newName) {
36: this .oldMethod = oldMethod;
37: this .newName = newName;
38: }
39:
40: /**
41: * Updates the root
42: *
43: *@param root the root node
44: */
45: public void update(SimpleNode root) {
46: System.out.println("RenameMethodTransform.update()");
47: RenameMethodVisitor rfv = new RenameMethodVisitor();
48: rfv.visit(root, new RenameMethodData(oldMethod, newName));
49: /*
50: Summary parent = oldMethod.getParent();
51: while ( !(parent instanceof FileSummary) ) {
52: parent = parent.getParent();
53: }
54: SummaryLoaderState state = new SummaryLoaderState();
55: state.setFile( ((FileSummary)parent).getFile() );
56: root.jjtAccept(new SummaryLoadVisitor(), state);
57: */
58: }
59: }
|