java.lang.Objectcom.ibm.jdg2e.jdt.AddTraceStatementsAction
com.ibm.jdg2e.jdt.AddTraceStatementsEditorAction
The purpose of AddTraceStatementEditorAction is to demonstrate how to
add simple code modifications ("refactoring") to the Java editor. This action
adds System.out.println statements, including
all parameters, to the beginning of each method.
IBuffer,
JavaCore,
IWorkingCopyManager,
ICompilationUnit| Nested Class Summary | |
protected static class |
AddTraceStatementsEditorAction.JavaMethodCollector
An AST visitor that traverses a compilation unit and gathers all instances of MethodDeclaration,
whether they be in the top-level class, inner classes,
or anonymous classes. |
| Constructor Summary | |
AddTraceStatementsEditorAction()
|
|
| Method Summary | |
void |
run(org.eclipse.jface.action.IAction action)
Traverse all the ICompilationUnit's methods using an AST,
calculating the position of each, and adding System.out.println
for each method parameter. |
void |
setActiveEditor(org.eclipse.jface.action.IAction action,
org.eclipse.ui.IEditorPart targetEditor)
Instances of IEditorActionDelegate are shared among
editors of the same type; this method notifies the action
that it now "works" for another editor. |
| Methods inherited from class com.ibm.jdg2e.jdt.AddTraceStatementsAction |
addTraceStatement, createTraceStatement, selectionChanged |
| 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 |
selectionChanged |
| Constructor Detail |
public AddTraceStatementsEditorAction()
| Method Detail |
public void run(org.eclipse.jface.action.IAction action)
ICompilationUnit's methods using an AST,
calculating the position of each, and adding System.out.println
for each method parameter.
run in interface org.eclipse.ui.IActionDelegateIActionDelegate.run(IAction action)
public void setActiveEditor(org.eclipse.jface.action.IAction action,
org.eclipse.ui.IEditorPart targetEditor)
IEditorActionDelegate are shared among
editors of the same type; this method notifies the action
that it now "works" for another editor. This determines
the context for availability of this action and the
target of the run method.
setActiveEditor in interface org.eclipse.ui.IEditorActionDelegate