try{
IASTTranslationUnit ast = src.getAST(index,
ITranslationUnit.AST_CONFIGURE_USING_SOURCE_CONTEXT |
ITranslationUnit.AST_SKIP_INDEXED_HEADERS);
IASTNodeSelector selector = ast.getNodeSelector(null);
IASTName name = selector.findEnclosingName(offset, length);
if (name != null){
IBinding binding = name.resolveBinding();
int flags = IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES;
if (context == FIND_CONTEXT){
if (!name.isDeclaration() && !name.isDefinition()){
flags |= IIndex.FIND_DEFINITIONS;
} else {
// if on the declaration, search for the definition and vice verca
flags |= (name.isDefinition() ?
IIndex.FIND_DECLARATIONS : IIndex.FIND_DEFINITIONS);
}
} else if (context == CSearchQuery.FIND_ALL_OCCURRENCES){
flags |= IIndex.FIND_ALL_OCCURRENCES;
} else if (context == CSearchQuery.FIND_REFERENCES){