本文整理汇总了Java中com.intellij.psi.scope.processor.FilterElementProcessor类的典型用法代码示例。如果您正苦于以下问题:Java FilterElementProcessor类的具体用法?Java FilterElementProcessor怎么用?Java FilterElementProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FilterElementProcessor类属于com.intellij.psi.scope.processor包,在下文中一共展示了FilterElementProcessor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributeDecls
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
@Override
public XmlAttributeDecl[] getAttributeDecls() {
final List<XmlAttributeDecl> result = new ArrayList<XmlAttributeDecl>();
processElements(new FilterElementProcessor(new ClassFilter(XmlAttributeDecl.class), result) {
@Override
public boolean execute(@NotNull final PsiElement element) {
if (element instanceof XmlAttributeDecl) {
if (element.getNextSibling() == null && element.getChildren().length == 1) {
return true;
}
return super.execute(element);
}
return true;
}
}, this);
return result.toArray(new XmlAttributeDecl[result.size()]);
}
示例2: provideNodes
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
@NotNull
@Override
public Collection<Html5SectionTreeElement> provideNodes(@NotNull final TreeElement node) {
if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList();
final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement();
final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument();
if (document == null) return Collections.emptyList();
final List<XmlTag> rootTags = new ArrayList<XmlTag>();
document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document);
final Collection<Html5SectionTreeElement> result = new ArrayList<Html5SectionTreeElement>();
for (XmlTag tag : rootTags) {
result.addAll(Html5SectionsProcessor.processAndGetRootSections(tag));
}
return result;
}
示例3: doBuildDeclarationMap
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
private CachedValue<Map<String, XmlElementDescriptor>> doBuildDeclarationMap() {
return CachedValuesManager.getManager(myElement.getProject()).createCachedValue(new CachedValueProvider<Map<String, XmlElementDescriptor>>() {
public Result<Map<String, XmlElementDescriptor>> compute() {
final List<XmlElementDecl> result = new ArrayList<XmlElementDecl>();
myElement.processElements(new FilterElementProcessor(new ClassFilter(XmlElementDecl.class), result), getDeclaration());
final Map<String, XmlElementDescriptor> ret = new LinkedHashMap<String, XmlElementDescriptor>((int)(result.size() * 1.5));
for (final XmlElementDecl xmlElementDecl : result) {
final String name = xmlElementDecl.getName();
if (name != null) {
if (!ret.containsKey(name)) {
ret.put(name, new XmlElementDescriptorImpl(xmlElementDecl));
}
}
}
return new Result<Map<String, XmlElementDescriptor>>(ret, myDescriptorFile);
}
}, false);
}
示例4: provideNodes
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
@Override
public Collection<Html5SectionTreeElement> provideNodes(final TreeElement node) {
if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList();
final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement();
final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument();
if (document == null) return Collections.emptyList();
final List<XmlTag> rootTags = new ArrayList<XmlTag>();
document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document);
final Collection<Html5SectionTreeElement> result = new ArrayList<Html5SectionTreeElement>();
for (XmlTag tag : rootTags) {
result.addAll(Html5SectionsProcessor.processAndGetRootSections(tag));
}
return result;
}
示例5: provideNodes
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
public Collection<Html5SectionTreeElement> provideNodes(final TreeElement node) {
if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList();
final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement();
final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument();
if (document == null) return Collections.emptyList();
final List<XmlTag> rootTags = new ArrayList<XmlTag>();
document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document);
final Collection<Html5SectionTreeElement> result = new ArrayList<Html5SectionTreeElement>();
for (XmlTag tag : rootTags) {
result.addAll(Html5SectionsProcessor.processAndGetRootSections(tag));
}
return result;
}
示例6: doBuildDeclarationMap
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
private CachedValue<Map<String, XmlElementDescriptor>> doBuildDeclarationMap() {
return CachedValuesManager.getManager(myElement.getProject()).createCachedValue(new CachedValueProvider<Map<String, XmlElementDescriptor>>() {
@Override
public Result<Map<String, XmlElementDescriptor>> compute() {
final List<XmlElementDecl> result = new ArrayList<XmlElementDecl>();
myElement.processElements(new FilterElementProcessor(new ClassFilter(XmlElementDecl.class), result), getDeclaration());
final Map<String, XmlElementDescriptor> ret = new LinkedHashMap<String, XmlElementDescriptor>((int)(result.size() * 1.5));
Set<PsiFile> dependencies = new THashSet<PsiFile>(1);
dependencies.add(myDescriptorFile);
for (final XmlElementDecl xmlElementDecl : result) {
final String name = xmlElementDecl.getName();
if (name != null) {
if (!ret.containsKey(name)) {
ret.put(name, new XmlElementDescriptorImpl(xmlElementDecl));
// if element descriptor was produced from entity reference use proper dependency
PsiElement dependingElement = xmlElementDecl.getUserData(XmlElement.DEPENDING_ELEMENT);
if (dependingElement != null) {
PsiFile dependingElementContainingFile = dependingElement.getContainingFile();
if (dependingElementContainingFile != null) dependencies.add(dependingElementContainingFile);
}
}
}
}
return new Result<Map<String, XmlElementDescriptor>>(ret, dependencies.toArray());
}
}, false);
}
示例7: getChildrenBase
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
@Override
@NotNull
public Collection<StructureViewTreeElement> getChildrenBase() {
if (isHtml5SectionsMode()) {
return Collections.emptyList(); // Html5SectionsNodeProvider will return its structure
}
final XmlFile xmlFile = getElement();
final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument();
if (document == null) {
return Collections.emptyList();
}
final List<XmlTag> rootTags = new SmartList<XmlTag>();
document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document);
if (rootTags.isEmpty()) {
return Collections.emptyList();
}
else if (rootTags.size() == 1) {
final XmlTag rootTag = rootTags.get(0);
if ("html".equalsIgnoreCase(rootTag.getLocalName())) {
final XmlTag[] subTags = rootTag.getSubTags();
if (subTags.length == 1 &&
("head".equalsIgnoreCase(subTags[0].getLocalName()) || "body".equalsIgnoreCase(subTags[0].getLocalName()))) {
return new HtmlTagTreeElement(subTags[0]).getChildrenBase();
}
return new HtmlTagTreeElement(rootTag).getChildrenBase();
}
return Collections.<StructureViewTreeElement>singletonList(new HtmlTagTreeElement(rootTag));
}
else {
final Collection<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>(rootTags.size());
for (XmlTag tag : rootTags) {
result.add(new HtmlTagTreeElement(tag));
}
return result;
}
}
示例8: getAttributeDecls
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
public XmlAttributeDecl[] getAttributeDecls() {
final List<XmlAttributeDecl> result = new ArrayList<XmlAttributeDecl>();
processElements(new FilterElementProcessor(new ClassFilter(XmlAttributeDecl.class), result) {
public boolean execute(@NotNull final PsiElement element) {
if (element instanceof XmlAttributeDecl) {
if (element.getNextSibling() == null && element.getChildren().length == 1) {
return true;
}
return super.execute(element);
}
return true;
}
}, this);
return result.toArray(new XmlAttributeDecl[result.size()]);
}
示例9: doBuildDeclarationMap
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
private CachedValue<Map<String, XmlElementDescriptor>> doBuildDeclarationMap()
{
return CachedValuesManager.getManager(myElement.getProject()).createCachedValue(() ->
{
final List<XmlElementDecl> result = new ArrayList<>();
myElement.processElements(new FilterElementProcessor(new ClassFilter(XmlElementDecl.class), result), getDeclaration());
final Map<String, XmlElementDescriptor> ret = new LinkedHashMap<>((int) (result.size() * 1.5));
Set<PsiFile> dependencies = new THashSet<>(1);
dependencies.add(myDescriptorFile);
for(final XmlElementDecl xmlElementDecl : result)
{
final String name = xmlElementDecl.getName();
if(name != null)
{
if(!ret.containsKey(name))
{
ret.put(name, new XmlElementDescriptorImpl(xmlElementDecl));
// if element descriptor was produced from entity reference use proper dependency
PsiElement dependingElement = xmlElementDecl.getUserData(XmlElement.DEPENDING_ELEMENT);
if(dependingElement != null)
{
PsiFile dependingElementContainingFile = dependingElement.getContainingFile();
if(dependingElementContainingFile != null)
{
dependencies.add(dependingElementContainingFile);
}
}
}
}
}
return new CachedValueProvider.Result<>(ret, dependencies.toArray());
}, false);
}
示例10: getChildrenBase
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
@NotNull
public Collection<StructureViewTreeElement> getChildrenBase() {
if (isHtml5SectionsMode()) {
return Collections.emptyList(); // Html5SectionsNodeProvider will return its structure
}
final XmlFile xmlFile = getElement();
final XmlDocument document = xmlFile == null ? null : xmlFile.getDocument();
if (document == null) return Collections.emptyList();
final List<XmlTag> rootTags = new ArrayList<XmlTag>();
document.processElements(new FilterElementProcessor(XmlTagFilter.INSTANCE, rootTags), document);
if (rootTags.isEmpty()) return Collections.emptyList();
if (rootTags.size() == 1) {
final XmlTag rootTag = rootTags.get(0);
if ("html".equalsIgnoreCase(rootTag.getLocalName())) {
final XmlTag[] subTags = rootTag.getSubTags();
if (subTags.length == 1 &&
("head".equalsIgnoreCase(subTags[0].getLocalName()) || "body".equalsIgnoreCase(subTags[0].getLocalName()))) {
return new HtmlTagTreeElement(subTags[0]).getChildrenBase();
}
return new HtmlTagTreeElement(rootTag).getChildrenBase();
}
return Arrays.<StructureViewTreeElement>asList(new HtmlTagTreeElement(rootTag));
}
else {
final Collection<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>();
for (XmlTag tag : rootTags) {
result.add(new HtmlTagTreeElement(tag));
}
return result;
}
}
示例11: doCollectAttlistDeclarations
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
private static XmlAttlistDecl[] doCollectAttlistDeclarations(XmlElement xmlElement) {
final List<XmlAttlistDecl> result = new ArrayList<XmlAttlistDecl>();
XmlUtil.processXmlElements(xmlElement, new FilterElementProcessor(new ClassFilter(XmlAttlistDecl.class), result), false, false, XmlUtil.getContainingFile(xmlElement));
return result.toArray(new XmlAttlistDecl[result.size()]);
}
示例12: getEnumeratedValues
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
@Override
public XmlElement[] getEnumeratedValues() {
final List<XmlElement> result = new ArrayList<XmlElement>();
processElements(new FilterElementProcessor(new XmlTokenTypeFilter(XmlTokenType.XML_NAME), result), this);
return result.toArray(new XmlElement[result.size()]);
}
示例13: getEnumeratedValues
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
public XmlElement[] getEnumeratedValues() {
final List<XmlElement> result = new ArrayList<XmlElement>();
processElements(new FilterElementProcessor(new XmlTokenTypeFilter(XmlTokenType.XML_NAME), result), this);
return result.toArray(new XmlElement[result.size()]);
}
示例14: doCollectAttlistDeclarations
import com.intellij.psi.scope.processor.FilterElementProcessor; //导入依赖的package包/类
private static XmlAttlistDecl[] doCollectAttlistDeclarations(XmlElement xmlElement)
{
final List<XmlAttlistDecl> result = new ArrayList<>();
XmlUtil.processXmlElements(xmlElement, new FilterElementProcessor(new ClassFilter(XmlAttlistDecl.class), result), false, false, XmlUtil.getContainingFile(xmlElement));
return result.toArray(new XmlAttlistDecl[result.size()]);
}