protected @Nullable T performElementAddition() {
    final DomElement parent = getParentDomElement();
    final DomManager domManager = parent.getManager();
    final TypeChooser[] oldChoosers = new TypeChooser[]{null};
    final Type[] aClass = new Type[]{null};
    final StableElement<T> result = WriteCommandAction.writeCommandAction(domManager.getProject(), DomUtil.getFile(parent)).compute(() -> {
      final DomElement parentDomElement = getParentDomElement();
      final T t = (T)getDomCollectionChildDescription().addValue(parentDomElement, getElementType());
      tuneNewValue(t);
      aClass[0] = parent.getGenericInfo().getCollectionChildDescription(t.getXmlElementName()).getType();
      oldChoosers[0] = domManager.getTypeChooserManager().getTypeChooser(aClass[0]);
      final SmartPsiElementPointer pointer =
        SmartPointerManager.getInstance(domManager.getProject()).createSmartPsiElementPointer(t.getXmlTag());
      domManager.getTypeChooserManager().registerTypeChooser(aClass[0], new TypeChooser() {
        @Override
        public Type chooseType(final XmlTag tag) {
          if (tag == pointer.getElement()) {
            return getElementType();
          }
          return oldChoosers[0].chooseType(tag);
        }

        @Override
        public void distinguishTag(final XmlTag tag, final Type aClass) throws IncorrectOperationException {
          oldChoosers[0].distinguishTag(tag, aClass);
        }

        @Override
        public Type[] getChooserTypes() {
          return oldChoosers[0].getChooserTypes();
        }
      });
      return t.createStableCopy();
    });
    if (result != null) {
      domManager.getTypeChooserManager().registerTypeChooser(aClass[0], oldChoosers[0]);
      return result.getWrappedElement();
    }
    return null;
  }
protected @Nullable T performElementAddition()