Search in sources :

Example 1 with TreeVisitor

use of com.intellij.ide.util.treeView.TreeVisitor in project android by JetBrains.

the class TreeBuilderSpeedSearch method findNodes.

@NotNull
private List<AbstractPsModelNode> findNodes(@NotNull String searchQuery) {
    String pattern = searchQuery.trim();
    List<AbstractPsModelNode> nodes = Lists.newArrayList();
    ActionCallback initialized = myTreeBuilder.getInitialized();
    initialized.doWhenDone(() -> myTreeBuilder.accept(AbstractPsModelNode.class, new TreeVisitor<AbstractPsModelNode>() {

        @Override
        public boolean visit(@NotNull AbstractPsModelNode node) {
            if (isMatchingElement(node, pattern)) {
                nodes.add(node);
            }
            return false;
        }
    }));
    return nodes;
}
Also used : TreeVisitor(com.intellij.ide.util.treeView.TreeVisitor) ActionCallback(com.intellij.openapi.util.ActionCallback) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

TreeVisitor (com.intellij.ide.util.treeView.TreeVisitor)1 ActionCallback (com.intellij.openapi.util.ActionCallback)1 NotNull (org.jetbrains.annotations.NotNull)1