java.lang.Objectcom.ibm.jdg2e.jdt.AddTraceStatementsAction
The purpose of AddTraceStatementsAction is to demonstrate how to
add simple code modifications ("refactoring") to the Java editor. This action
is an abstract implementation for those subclasses wishing to
add trace statements for each method, including
all parameters, one or more methods.
IBuffer,
JavaCore,
IWorkingCopyManager,
ICompilationUnit| Constructor Summary | |
AddTraceStatementsAction()
|
|
| Method Summary | |
protected void |
addTraceStatement(org.eclipse.jdt.core.dom.MethodDeclaration md,
org.eclipse.jdt.core.IBuffer buffer)
Adds a garden-variety trace statement to the given method, using System.out.println. |
java.lang.String |
createTraceStatement(org.eclipse.jdt.core.dom.MethodDeclaration md,
java.lang.String source,
boolean format)
Given a MethodDeclaration, return a source
System.out.println listing the method name and parameters. |
void |
selectionChanged(org.eclipse.jface.action.IAction action,
org.eclipse.jface.viewers.ISelection selection)
Selection has changed, the default is to do nothing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.ui.IActionDelegate |
run |
| Constructor Detail |
public AddTraceStatementsAction()
| Method Detail |
protected void addTraceStatement(org.eclipse.jdt.core.dom.MethodDeclaration md,
org.eclipse.jdt.core.IBuffer buffer)
System.out.println. Subclasses may override to
add more sophisticated trace statements.
public java.lang.String createTraceStatement(org.eclipse.jdt.core.dom.MethodDeclaration md,
java.lang.String source,
boolean format)
MethodDeclaration, return a source
System.out.println listing the method name and parameters.
System.out.println("Start " + method + "<" p1 + ">");
This method handles the cases where the parameter doesn't understand
the toString (or at least tries).
public void selectionChanged(org.eclipse.jface.action.IAction action,
org.eclipse.jface.viewers.ISelection selection)
selectionChanged in interface org.eclipse.ui.IActionDelegate