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

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

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

XmlTag.addSubTag介绍

暂无

代码示例

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

@Override
  protected void run() {
    XmlTag services = rootTag.findFirstSubTag("services");
    XmlElementFactory instance = XmlElementFactory.getInstance(SymfonyCreateService.this.project);
    if(services == null) {
      services = rootTag.addSubTag(instance.createTagFromText("<services/>", rootTag.getLanguage()), false);
    }
    XmlTag tag = instance.createTagFromText(createServiceAsText(ServiceBuilder.OutputType.XML).replace("\r\n", "\n").replace("\n", " "), services.getLanguage());
    textRange[0] = services.addSubTag(tag, false).getTextRange();
  }
}.execute();

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public static void addServices(List<String> items, XmlTag xmlTag) {
  for (String item : items) {
    if(StringUtils.isBlank(item)) {
      item = "?";
    }
    XmlTag tag = XmlElementFactory.getInstance(xmlTag.getProject()).createTagFromText(String.format("<argument type=\"service\" id=\"%s\"/>", item), xmlTag.getLanguage());
    xmlTag.addSubTag(tag, false);
  }
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

transUnit.setAttribute("id", String.valueOf(getIdForNewXlfUnit(body, "trans-unit")));
  transUnit.addSubTag(source, false);
  transUnit.addSubTag(target, false);
  return body.addSubTag(transUnit, false);
};
  transUnit.setAttribute("id", String.valueOf(String.valueOf(getIdForNewXlfUnit(body, "unit"))));
  XmlTag segment = transUnit.addSubTag(instance.createTagFromText("<segment/>"), false);
  segment.addSubTag(source, false);
  segment.addSubTag(target, false);
  return body.addSubTag(transUnit, false);
};

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

ServiceTag serviceTag = new ServiceTag(phpClassFromXmlTag, tag);
  ServiceUtil.decorateServiceTag(serviceTag);
  xmlTag.addSubTag(XmlElementFactory.getInstance(project).createTagFromText(serviceTag.toXmlString()), false);
});

代码示例来源:origin: misakuo/svgtoandroid

private void parseGroup(XmlTag svgTag, XmlTag target) {
  XmlTag groupElement = target.createChildTag("group", target.getNamespace(), null, false);
  //set group's attrs
  Map<String, String> svgGroupAttrs = svgParser.getChildAttrs(svgTag);
  List<String> acceptedAttrs = Arrays.asList("id", "transform");
  for (String key : svgGroupAttrs.keySet()) {
    if (AttrMapper.getAttrName(key) != null && acceptedAttrs.contains(key)) {
      groupElement.setAttribute(AttrMapper.getAttrName(key), svgGroupAttrs.get(key));
    }
  }
  if (svgGroupAttrs.keySet().contains("transform")) {
    Map<String, String> trans = AttrMapper.getTranslateAttrs(svgGroupAttrs.get("transform"));
    for (String key : trans.keySet()) {
      groupElement.setAttribute(key, CommonUtil.formatString(trans.get(key)));
    }
  }
  //add child tags
  //<g> was processed.
  processSubGroups(svgTag, groupElement);
  svgGroupAttrs.remove("id");
  svgGroupAttrs.remove("transform");
  parseShapeNode(svgTag, groupElement, svgGroupAttrs);
  target.addSubTag(groupElement, false);
}

代码示例来源: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();

代码示例来源:origin: misakuo/svgtoandroid

distTag.addSubTag(pathElement, false);

代码示例来源:origin: liias/monkey

private static void configureManifest(Manifest manifest, Module module, ManifestData manifestData) {
 requireNonNull(manifestData, "manifestData is null");
 requireNonNull(manifestData.appType, "appType is null");
 requireNonNull(manifestData.minSdkVersion, "minSdkVersion is null");
 requireNonNull(manifestData.targetDeviceId, "targetDeviceId is null");
 final PsiFile manifestFile = getValidatedPsiFile(manifest);
 if (manifestFile == null) {
  return;
 }
 String applicationId = MonkeyModuleUtil.generateProjectId();
 String entryClassName = WordUtils.capitalize(module.getName()) + "App";
 manifest.getApplication().getId().setValue(applicationId);
 manifest.getApplication().getType().setValue(manifestData.appType);
 manifest.getApplication().getName().setValue("@Strings.AppName");
 // entry is a class which extends Toybox.Application.AppBase
 manifest.getApplication().getEntry().setValue(entryClassName);
 manifest.getApplication().getLauncherIcon().setValue("@Drawables.LauncherIcon");
 JpsMonkeySdkType.SdkVersion sdkVersion = JpsMonkeySdkType.SdkVersion
  .fromVersionString(manifestData.sdk.getVersionString());
 if (hasMinSdkVersionSupport(sdkVersion)) {
  manifest.getApplication().getMinSdkVersion().setValue(manifestData.minSdkVersion);
 }
 Products products = manifest.getApplication().getProducts();
 XmlTag productsRootTag = products.getXmlTag();
 XmlTag productTag = productsRootTag.createChildTag("product", productsRootTag.getNamespace(), "", false);
 productTag = productsRootTag.addSubTag(productTag, true);
 productTag.setAttribute("id", null, manifestData.targetDeviceId);
 productTag.collapseIfEmpty();
 CodeStyleManager.getInstance(manifestFile.getProject()).reformat(manifestFile);
}

相关文章