本文整理汇总了Java中com.intellij.xml.XmlNSDescriptor.getRootElementsDescriptors方法的典型用法代码示例。如果您正苦于以下问题:Java XmlNSDescriptor.getRootElementsDescriptors方法的具体用法?Java XmlNSDescriptor.getRootElementsDescriptors怎么用?Java XmlNSDescriptor.getRootElementsDescriptors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.xml.XmlNSDescriptor
的用法示例。
在下文中一共展示了XmlNSDescriptor.getRootElementsDescriptors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addHtmlSpecificCompletions
import com.intellij.xml.XmlNSDescriptor; //导入方法依赖的package包/类
public static void addHtmlSpecificCompletions(final XmlElementDescriptor descriptor,
final XmlTag element,
final List<XmlElementDescriptor> variants) {
// add html block completions for tags with optional ends!
String name = descriptor.getName(element);
if (name != null && isOptionalEndForHtmlTag(name)) {
PsiElement parent = element.getParent();
if (parent != null) {
// we need grand parent since completion already uses parent's descriptor
parent = parent.getParent();
}
if (parent instanceof HtmlTag) {
final XmlElementDescriptor parentDescriptor = ((HtmlTag)parent).getDescriptor();
if (parentDescriptor != descriptor && parentDescriptor != null) {
for (final XmlElementDescriptor elementsDescriptor : parentDescriptor.getElementsDescriptors((XmlTag)parent)) {
if (isHtmlBlockTag(elementsDescriptor.getName())) {
variants.add(elementsDescriptor);
}
}
}
} else if (parent instanceof HtmlDocumentImpl) {
final XmlNSDescriptor nsDescriptor = descriptor.getNSDescriptor();
for (XmlElementDescriptor elementDescriptor : nsDescriptor.getRootElementsDescriptors((XmlDocument)parent)) {
if (isHtmlBlockTag(elementDescriptor.getName()) && !variants.contains(elementDescriptor)) {
variants.add(elementDescriptor);
}
}
}
}
}
示例2: getNSDescriptorFromMetaData
import com.intellij.xml.XmlNSDescriptor; //导入方法依赖的package包/类
@Nullable
private XmlNSDescriptor getNSDescriptorFromMetaData(@Nullable PsiMetaOwner metaOwner, boolean nonEmpty) {
if (metaOwner == null) return null;
XmlNSDescriptor descriptor = (XmlNSDescriptor)metaOwner.getMetaData();
if (descriptor == null) return null;
if (nonEmpty && descriptor.getRootElementsDescriptors(this).length == 0) {
return null;
}
return descriptor;
}
示例3: getVariants
import com.intellij.xml.XmlNSDescriptor; //导入方法依赖的package包/类
@Override
@NotNull
public Object[] getVariants() {
final XmlNSDescriptor rootTagNSDescriptor = DtdResolveUtil.getNsDescriptor(myElement);
return rootTagNSDescriptor != null ?
rootTagNSDescriptor.getRootElementsDescriptors(((XmlFile)getRealFile()).getDocument()):
ArrayUtil.EMPTY_OBJECT_ARRAY;
}
示例4: processSchema
import com.intellij.xml.XmlNSDescriptor; //导入方法依赖的package包/类
@Nullable
private <T> T processSchema(String schema, SchemaProcessor<T> processor) {
VirtualFile file = MavenSchemaProvider.getSchemaFile(schema);
PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
if (!(psiFile instanceof XmlFile)) return null;
XmlFile xmlFile = (XmlFile)psiFile;
XmlDocument document = xmlFile.getDocument();
XmlNSDescriptor desc = (XmlNSDescriptor)document.getMetaData();
XmlElementDescriptor[] descriptors = desc.getRootElementsDescriptors(document);
return doProcessSchema(descriptors, null, processor, new THashSet<XmlElementDescriptor>());
}