IProperty (String key, String value, @Nullable IProperty anchor, boolean addToEnd) { final XmlTag anchorTag = anchor == null ? null : (XmlTag)anchor.getPsiElement().getNavigationElement(); final XmlTag rootTag = myFile.getRootTag(); final XmlTag entry = createPropertyTag(key, value); final XmlTag addedEntry = (XmlTag) (anchorTag == null ? myFile.getRootTag().addSubTag(entry, !addToEnd) : rootTag.addAfter(entry, anchorTag)); return new XmlProperty(addedEntry, this); }