PsiElement (Editor editor, PsiFile file, boolean rename) { if (editor == null || file == null) return null; if (!rename && !MavenDomUtil.isMavenFile(file)) return null; PsiElement target = TargetElementUtil.findTargetElement(editor, TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED); if (target instanceof MavenPsiElementWrapper) { return ((MavenPsiElementWrapper)target).getWrappee(); } if (target == null || isSchema(target)) { target = file.findElementAt(editor.getCaretModel().getOffset()); if (target == null) return null; } return PsiTreeUtil.getParentOfType(target, XmlTag.class, false); }