LookupElement (final Object element) { if (element instanceof PsiMethod) { return new JavaMethodCallElement((PsiMethod)element) { @Override public void handleInsert(@NotNull InsertionContext context) { new MethodSignatureInsertHandler().handleInsert(context, this); } }; } if (element instanceof PsiClass) { JavaPsiClassReferenceElement classElement = new JavaPsiClassReferenceElement((PsiClass)element); classElement.setInsertHandler(JavaClassNameInsertHandler.JAVA_CLASS_INSERT_HANDLER); return classElement; } return LookupItemUtil.objectToLookupItem(element); }