boolean (Object element, PsiElement context) { if(element instanceof PsiElement) { final ASTNode node = ((PsiElement)element).getNode(); return node != null && node.getElementType() == myType; } else if(element instanceof ASTNode){ return ((ASTNode)element).getElementType() == myType; } return false; }