PsiElement () { if (myPosition instanceof XmlTag) { final XmlElementDescriptor descriptor = ((XmlTag)myPosition).getDescriptor(); if (descriptor != null) { final PsiElement declaration = descriptor.getDeclaration(); if (declaration instanceof PsiMethod && ((PsiMethod)declaration).hasModifierProperty(PsiModifier.STATIC)) { final PsiClass containingClass = ((PsiMethod)declaration).getContainingClass(); if (containingClass != null && myReference.getCanonicalText().equals(containingClass.getName())) { return containingClass; } } } } else if (myPosition instanceof XmlAttributeValue) { return JavaFxPsiUtil.findPsiClass(((XmlAttributeValue)myPosition).getValue(), myPosition); } return null; }