com.intellij.psi.xml.XmlTag.delete()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中com.intellij.psi.xml.XmlTag.delete()方法的一些代码示例,展示了XmlTag.delete()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlTag.delete()方法的具体详情如下:
包路径:com.intellij.psi.xml.XmlTag
类名称:XmlTag
方法名:delete

XmlTag.delete介绍

暂无

代码示例

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

/** Deletes the supplied version {@link XmlTag}. */
void stripVersion(XmlTag versionTag) {
 try {
  versionTag.delete();
 } catch (IncorrectOperationException ioe) {
  logger.warn("Failed to delete version tag for CloudBomInspection quickfix");
 }
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

@Override
  protected void run() throws Throwable {
    final XmlTag hybrisconfig = xmlFile.getRootTag();
    if (hybrisconfig == null) {
      return;
    }
    for (XmlTag extensions : hybrisconfig.getSubTags()) {
      if (!extensions.getName().equals("extensions")) {
        continue;
      }
      for (XmlTag extension : extensions.getSubTags()) {
        if (!extension.getName().equals("extension")) {
          continue;
        }
        if (result.getExtensionsToRemove().contains(extension.getAttributeValue("name"))) {
          extension.delete();
        }
      }
      for (String newExtension : result.getExtensionsToAdd()) {
        final XmlTag newTag = extensions.createChildTag("extension", null, null, false);
        final String name = newExtension.substring(newExtension.lastIndexOf("/") + 1);
        final String dir = "${HYBRIS_BIN_DIR}" + newExtension.substring(newExtension.indexOf("/custom"));
        newTag.setAttribute("dir", dir);
        newTag.setAttribute("name", name);
        extensions.addSubTag(newTag, false);
      }
    }
    FileDocumentManager.getInstance().saveAllDocuments();
  }
}.execute();

相关文章