// compute source ranges before and after the selected code
fPreSelectedSourceRange = new SourceRange(fSelectedMethodSourceRange.getOffset(), fSelectionStart - fSelectedMethodSourceRange.getOffset());
fPostSelectedSourceRange = new SourceRange(fSelectionStart + fSelectionLength, fSelectedMethodSourceRange.getOffset() + fSelectedMethodSourceRange.getLength() - fSelectionStart + fSelectionLength);
// find all variables used in the selected method
LocalVariableFinder finder = new LocalVariableFinder();
finder.setRange(fSelectedMethodSourceRange);
fProgram.accept(finder);
// those are the used variables, including method parameters
fMethodVariables = finder.getFoundVariables();
// those are only the method parameters, as FormalParameter
fMethodParameters = finder.getParameters();
// find all assignments in the selected method
RangeAssignmentFinder assignmentFinder = new RangeAssignmentFinder();
assignmentFinder.setRange(fSelectedMethodSourceRange);
fProgram.accept(assignmentFinder);