@Override
  protected void doOKAction() {
    super.doOKAction();

    mySettings.setContainingClassName((String)myClassComboBox.getSelectedItem());
    mySettings.setStatic(myStaticCheckBox.isSelected());
    GrTypeElement typeElement = getEnteredTypeName();

    if (typeElement == null) {
      mySettings.setType(CommonClassNames.JAVA_LANG_OBJECT);
    }
    else {
      PsiType type = typeElement.getType();
      if (type instanceof PsiPrimitiveType) {
        type = TypesUtil.boxPrimitiveType(type, typeElement.getManager(), ProjectScope.getAllScope(myProject));
      }

      mySettings.setType(type.getCanonicalText());
    }

    final Document document = PsiDocumentManager.getInstance(myProject).getDocument(myContext.getContainingFile());

    CommandProcessor.getInstance().executeCommand(myProject, () -> {
      UndoManager.getInstance(myProject).undoableActionPerformed(new GlobalUndoableAction(document) {
        @Override
        public void undo() {

          final DItemElement itemElement;
          if (mySettings.isMethod()) {
            final List<ParamInfo> myPairList = mySettings.getParams();
            final String[] argumentsTypes = QuickfixUtil.getArgumentsTypes(myPairList);
            itemElement =
              myDynamicManager.findConcreteDynamicMethod(mySettings.getContainingClassName(), mySettings.getName(), argumentsTypes);
          }
          else {
            itemElement = myDynamicManager.findConcreteDynamicProperty(mySettings.getContainingClassName(), mySettings.getName());
          }

          if (itemElement == null) {
            Messages.showWarningDialog(myProject, GroovyBundle.message("Cannot.perform.undo.operation"),
                                       GroovyBundle.message("Undo.disable"));
            return;
          }
          final DClassElement classElement = myDynamicManager.getClassElementByItem(itemElement);

          if (classElement == null) {
            Messages.showWarningDialog(myProject, GroovyBundle.message("Cannot.perform.undo.operation"),
                                       GroovyBundle.message("Undo.disable"));
            return;
          }

          removeElement(itemElement);

          if (classElement.getMethods().isEmpty() && classElement.getProperties().isEmpty()) {
            myDynamicManager.removeClassElement(classElement);
          }
        }

        @Override
        public void redo() {
          addElement(mySettings);
        }
      });

      addElement(mySettings);
    }, GroovyBundle.message("command.name.add.dynamic.member"), null);
  }
@Override
  protected void doOKAction()