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

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

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

XmlTag.getContainingFile介绍

暂无

代码示例

代码示例来源:origin: mustfun/mybatis-plus

@Override
  public String apply(Mapper mapper) {
    VirtualFile vf = mapper.getXmlTag().getContainingFile().getVirtualFile();
    if (null == vf) {
      return "";
    }
    return vf.getCanonicalPath();
  }
};

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

/**
  * Returns {@code true} if the inspected tag is part of an appengine-web.xml config file, is a
  * runtime tag, and the value is a deprecated Java runtime.
  */
 private boolean isAppEngineWebXmlDeprecatedRuntimeTag(XmlTag tag) {
  if (tag != null && tag.getContainingFile() instanceof XmlFile) {
   XmlFile xmlFile = (XmlFile) tag.getContainingFile();
   boolean isAppEngineWebXml =
     xmlFile.getRootTag() != null
       && AppEngineUtil.APP_ENGINE_WEB_XML_NAME.equals(xmlFile.getName())
       && AppEngineUtil.APP_ENGINE_WEB_XML_ROOT_TAG_NAME.equals(
         xmlFile.getRootTag().getName());

   if (isAppEngineWebXml) {
    return APP_ENGINE_WEB_XML_RUNTIME_TAG_NAME.equals(tag.getName())
      && deprecatedRuntimes.contains(tag.getValue().getText());
   }
  }

  return false;
 }
}

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

private static PsiFile getValidatedPsiFile(DomElement domElement) {
 final XmlTag rootTag = domElement.getXmlTag();
 if (rootTag == null) {
  return null;
 }
 final PsiFile psiFile = rootTag.getContainingFile();
 if (psiFile == null) {
  return null;
 }
 final VirtualFile virtualFile = psiFile.getVirtualFile();
 if (virtualFile == null ||
  !ReadonlyStatusHandler.ensureFilesWritable(psiFile.getProject(), virtualFile)) {
  return null;
 }
 return psiFile;
}

代码示例来源:origin: mustfun/mybatis-plus

private void setupTag(PsiMethod method, Mapper mapper) {
  GroupTwo target = getTarget(mapper, method);
  target.getId().setStringValue(method.getName());
  target.setValue(" ");
  XmlTag tag = target.getXmlTag();
  int offset = tag.getTextOffset() + tag.getTextLength() - tag.getName().length() + 1;
  EditorService editorService = EditorService.getInstance(method.getProject());
  editorService.format(tag.getContainingFile(), tag);
  editorService.scrollTo(tag, offset);
}

相关文章