void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement psiElement = descriptor.getPsiElement(); final PsiFile containingFile = psiElement.getContainingFile(); final FileModificationService modificationService = FileModificationService.getInstance(); Navigatable result = null; if (myPropFile != null) { final VirtualFile vFile = myPropFile.getVirtualFile(); if (myPropFile instanceof PsiFile) { if (!modificationService.prepareFileForWrite((PsiFile)myPropFile)) { return; } } else if (vFile != null) { if (!modificationService.prepareVirtualFilesForWrite(project, Collections.singleton(vFile))) { return; } } result = WriteAction.compute(() -> { final IProperty generatedProperty = myPropFile.addProperty(myCanonicalText, ""); return vFile != null ? PsiNavigationSupport.getInstance().createNavigatable(project, vFile, generatedProperty.getPsiElement().getTextRange() .getEndOffset()) : generatedProperty; }); } else { if (containingFile instanceof XmlFile xmlFile) { final XmlTag rootTag = xmlFile.getRootTag(); if (!modificationService.prepareFileForWrite(xmlFile)) { return; } if (rootTag != null) { result = WriteAction.compute(() -> { final XmlTag propTag = rootTag.createChildTag(PROPERTY, rootTag.getNamespace(), null, false); propTag.setAttribute(NAME_ATTR, myCanonicalText); propTag.setAttribute(VALUE_ATTR, ""); final DomElement contextElement = DomUtil.getDomElement(descriptor.getPsiElement()); PsiElement generated; if (contextElement == null) { generated = rootTag.addSubTag(propTag, true); } else { final AntDomTarget containingTarget = contextElement.getParentOfType(AntDomTarget.class, false); final DomElement anchor = containingTarget != null ? containingTarget : contextElement; final XmlTag tag = anchor.getXmlTag(); if (!rootTag.equals(tag)) { generated = tag.getParent().addBefore(propTag, tag); } else { generated = rootTag.addSubTag(propTag, true); } } Navigatable navigatable = null; if (generated instanceof XmlTag) { final XmlAttribute valueAttrib = ((XmlTag)generated).getAttribute(VALUE_ATTR); if (valueAttrib != null) { final XmlAttributeValue valueElement = valueAttrib.getValueElement(); if (valueElement instanceof Navigatable) { navigatable = (Navigatable)valueElement; } } } if (navigatable == null && generated instanceof Navigatable) { navigatable = (Navigatable)generated; } return navigatable; }); } } } if (result != null) { result.navigate(true); } }