// containing the lookup name back.
final LookupEx activeLookup = LookupManager.getActiveLookup(editor);
if ((activeLookup != null) && activeLookup.isFocused()) {
final PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset() - 1);
if (elementAt != null) {
Symbol lookup = new SymbolImpl(elementAt.getNode());
final LookupElement currentItem = activeLookup.getCurrentItem();
final String lookupString = currentItem != null ? currentItem.getLookupString() : "";
lookup.setName(lookupString);
return lookup;
}
}
if (contextElement != null) {
PsiElement parent = contextElement.getParent();
if ((contextElement instanceof PsiWhiteSpace) || !((parent instanceof Symbol) || (parent instanceof OperatorNameProvider))) {
PsiElement elm = file.findElementAt(editor.getCaretModel().getOffset() - 1);
if (elm != null) {
contextElement = elm;
parent = elm.getParent();
}
}
if (parent instanceof Symbol) {
return new SymbolImpl(parent.getNode());
}
// Determine if the contextElement is the operator sign of an operation.
// See the doc to OperatorNameProviderImpl.
if (parent instanceof OperatorNameProvider) {