PsiElement (PsiManager psiManager, Object object, PsiElement contextElement) { if(!isRelevant(contextElement)) return null; if (object instanceof ForcedCompletionPath) { // deep completion return createFromCompletionPath((ForcedCompletionPath)object, contextElement); } else if (object instanceof TypeFieldPair) { // basic completion with Field object return createFromField((TypeFieldPair)object, contextElement); } else if (object instanceof String) { // basic completion with plain string return createFromString((String)object, contextElement); } else { return null; } }