本文整理了Java中com.intellij.psi.xml.XmlTag.getContainingFile()
方法的一些代码示例,展示了XmlTag.getContainingFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlTag.getContainingFile()
方法的具体详情如下:
包路径:com.intellij.psi.xml.XmlTag
类名称: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);
}
内容来源于网络,如有侵权,请联系作者删除!