ElementPresentation (PsiElement psiElement) { if (psiElement == null || !psiElement.isValid()) return new InvalidPresentation(); if (psiElement instanceof PsiDirectory) return new ForDirectory((PsiDirectory)psiElement); if (psiElement instanceof PsiFile) return new ForFile((PsiFile)psiElement); if (psiElement instanceof PsiPackage) return new ForPackage((PsiPackage)psiElement); if (psiElement instanceof XmlTag) return new ForXmlTag((XmlTag)psiElement); if (psiElement instanceof PsiAnonymousClass) return new ForAnonymousClass((PsiAnonymousClass)psiElement); if (psiElement instanceof PsiClass) return new ForClass((PsiClass)psiElement); if (psiElement instanceof PsiMethod) return new ForMethod((PsiMethod)psiElement); if (psiElement instanceof PsiField) return new ForField((PsiField)psiElement); return new ForGeneralElement(psiElement); }