PyEdit pyEdit = new PyEdit(){
public File getEditorFile() {
return file;
}
};
RefactoringRequest request = new RefactoringRequest(
file, selection, null, nature, pyEdit);
ArrayList<Position> results = new ArrayList<Position>();
String context = commandLine.getValue(Options.CONTEXT_OPTION);
// find references
if (CONTEXT_REFERENCES.equals(context)){
// for some reason the pydev project's path isn't initialized properly
// leading to findAllOccurrences only finding results from the current
// file. This seems to be plenty fast for my reasonably sized project, so
// hopefully it won't be a bottleneck for others.
PythonNature pythonNature = PythonNature.getPythonNature(project);
pythonNature.rebuildPath();
request.fillInitialNameAndOffset();
IPyRefactoring2 pyRefactoring = (IPyRefactoring2)
AbstractPyRefactoring.getPyRefactoring();
Map<Tuple<String,File>, HashSet<ASTEntry>> refs =
pyRefactoring.findAllOccurrences(request);
for (Tuple<String,File> tuple : refs.keySet()){