// 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()){
for (ASTEntry entry : refs.get(tuple)){
Position position = Position.fromLineColumn(
tuple.o2.toString().replace('\\', '/'),
entry.getName(),
entry.node.beginLine,
entry.node.beginColumn);
if (!results.contains(position)){
results.add(position);
}
}
}
// find declaration
}else{
IPyRefactoring pyRefactoring = AbstractPyRefactoring.getPyRefactoring();
ItemPointer[] defs = pyRefactoring.findDefinition(request);
for (ItemPointer item : defs){
if (item.file == null || item.file.toString().endsWith(".so")){
continue;
}