@Override
  protected void doReplaceRange(final String includePath, final XmlTagChild first, final XmlTagChild last) {
    ApplicationManager.getApplication().runWriteAction(() -> {
      final XmlTag parentTag = first.getParentTag();
      LOG.assertTrue(parentTag != null);
      try {
        final XmlElementDescriptor descriptor = parentTag.getDescriptor();
        LOG.assertTrue(descriptor != null);
        final @NonNls String name = descriptor.getName();
        if (HtmlUtil.SCRIPT_TAG_NAME.equals(name)) {
          parentTag.setAttribute("src", includePath);
          LOG.assertTrue(first.getParent() == parentTag);
          parentTag.deleteChildRange(first, last);
        }
        else if (HtmlUtil.STYLE_TAG_NAME.equals(name)) {
          final XmlTag linkTag = parentTag.createChildTag("link", parentTag.getNamespace(), null, false);
          linkTag.setAttribute("href", includePath);
          linkTag.setAttribute("rel", "stylesheet");
          final String type = parentTag.getAttributeValue("type");
          if (type != null) {
            linkTag.setAttribute("type", type);
          }
          final String media = parentTag.getAttributeValue("media");
          if (media != null) {
            linkTag.setAttribute("media", media);
          }
          parentTag.replace(linkTag);
        }
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }
    });
  }
@Override
  protected void doReplaceRange(final String includePath, final XmlTagChild first, final XmlTagChild last)