private static void registerExtension(final DomFileElement<IdeaPlugin> selectedValue,
                                        final ExtensionPointCandidate candidate,
                                        final PsiClass extensionClass) {
    PsiElement navTarget =
      WriteCommandAction.writeCommandAction(selectedValue.getFile().getProject(), selectedValue.getFile()).compute(() -> {
        Extensions extensions = PluginDescriptorChooser.findOrCreateExtensionsForEP(selectedValue, candidate.epName);
        Extension extension = extensions.addExtension(candidate.epName);
        XmlTag tag = extension.getXmlTag();
        PsiElement target = null;
        String keyAttrName = candidate.beanClassName==null?null:KEY_MAP.get(candidate.beanClassName);
        if (keyAttrName != null) {
          XmlAttribute attr = tag.setAttribute(keyAttrName, "");
          target = attr.getValueElement();
        }
        String qualifiedName = ClassUtil.getJVMClassName(extensionClass);
        if (candidate.attributeName != null) {
          tag.setAttribute(candidate.attributeName, qualifiedName);
        }
        else {
          XmlTag subTag = tag.createChildTag(candidate.tagName, null, qualifiedName, false);
          tag.addSubTag(subTag, false);
        }
        return target != null ? target : extension.getXmlTag();
      });
    PsiNavigateUtil.navigate(navTarget);
  }
private static void registerExtension(final DomFileElement<IdeaPlugin> selectedValue,
                                        final ExtensionPointCandidate candidate,
                                        final PsiClass extensionClass)