com.ibm.lab.soln.jdt
Class AddTraceStatementsEditorActionDelegate

java.lang.Object
  |
  +--com.ibm.lab.soln.jdt.AddTraceStatementsEditorActionDelegate
All Implemented Interfaces:
org.eclipse.ui.IActionDelegate, org.eclipse.ui.IEditorActionDelegate

public class AddTraceStatementsEditorActionDelegate
extends java.lang.Object
implements org.eclipse.ui.IEditorActionDelegate

The purpose of AddTraceStatementsEditorAction is to demonstrate how to add simple code modifications ("refactoring") to the Java editor. This action adds System.out.println statements for each method, including all parameters, to the beginning of each method.

See Also:
IBuffer, IWorkingCopy, JavaCore, IWorkingCopyManager, ICompilationUnit

Constructor Summary
AddTraceStatementsEditorActionDelegate()
           
 
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 selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection)
           
 void setActiveEditor(org.eclipse.jface.action.IAction action, org.eclipse.ui.IEditorPart targetEditor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddTraceStatementsEditorActionDelegate

public AddTraceStatementsEditorActionDelegate()
Method Detail

run

public 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.

Specified by:
run in interface org.eclipse.ui.IActionDelegate
See Also:
IActionDelegate.run(org.eclipse.jface.action.IAction)

selectionChanged

public void selectionChanged(org.eclipse.jface.action.IAction action,
                             org.eclipse.jface.viewers.ISelection selection)
Specified by:
selectionChanged in interface org.eclipse.ui.IActionDelegate

setActiveEditor

public void setActiveEditor(org.eclipse.jface.action.IAction action,
                            org.eclipse.ui.IEditorPart targetEditor)
Specified by:
setActiveEditor in interface org.eclipse.ui.IEditorActionDelegate