当前位置: 首页>>代码示例>>Java>>正文


Java TreeElement类代码示例

本文整理汇总了Java中com.intellij.ide.util.treeView.smartTree.TreeElement的典型用法代码示例。如果您正苦于以下问题:Java TreeElement类的具体用法?Java TreeElement怎么用?Java TreeElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreeElement类属于com.intellij.ide.util.treeView.smartTree包,在下文中一共展示了TreeElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildModuleStructure

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@NotNull
private List<TreeElement> buildModuleStructure(PsiModule moduleElement) {
    List<TreeElement> treeElements = new ArrayList<>();
    PsiElement rootElement = moduleElement.getSignature();
    if (rootElement == null) {
        rootElement = moduleElement.getBody();
    }

    if (rootElement != null) {
        rootElement.acceptChildren(new PsiElementVisitor() {
            @Override
            public void visitElement(PsiElement element) {
                if (element instanceof PsiStructuredElement) {
                    treeElements.add(new StructureViewElement(element));
                }
            }
        });
    }

    return treeElements;
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:22,代码来源:StructureViewElement.java

示例2: getChildren

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@Override
public TreeElement[] getChildren() {
    if (element instanceof CsvFile) {
        Map<Integer, CsvColumnInfo<PsiElement>> columnInfoMap = createColumnInfoMap((CsvFile) element);
        TreeElement[] children = new TreeElement[columnInfoMap.size()];
        for (Map.Entry<Integer, CsvColumnInfo<PsiElement>> entry : columnInfoMap.entrySet()) {
            CsvColumnInfo<PsiElement> columnInfo = entry.getValue();
            PsiElement psiElement = columnInfo.getHeaderElement();
            if (psiElement == null) {
                psiElement = createEmptyPsiField();
            }
            children[entry.getKey()] = new Header(psiElement, columnInfo);
        }
        return children;
    } else {
        return EMPTY_ARRAY;
    }
}
 
开发者ID:SeeSharpSoft,项目名称:intellij-csv-validator,代码行数:19,代码来源:CsvStructureViewElement.java

示例3: provideNodes

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@NotNull
@Override
public Collection<TreeElement> provideNodes(@NotNull TreeElement parent) {
    if (parent instanceof AbstractTreeElement) {
        AbstractTreeElement element = (AbstractTreeElement) parent;
        PsiElement psiElement = element.getValue();
        List<TreeElement> treeElements = new ArrayList<>();
        for (PsiElement node : psiElement.getChildren()) {
            if (node instanceof FieldNode) {
                treeElements.add(new MessageFieldTreeElement((FieldNode) node));
            }
            if (node instanceof EnumConstantNode) {
                treeElements.add(new EnumConstantTreeElement((EnumConstantNode) node));
            }
            if (node instanceof RpcMethodNode) {
                treeElements.add(new ServiceMethodTreeElement((RpcMethodNode) node));
            }
        }
        return treeElements;
    }
    return Collections.emptyList();
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:23,代码来源:ProtoFieldsNodeProvider.java

示例4: provideNodes

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@NotNull
@Override
public Collection<JavaAnonymousClassTreeElement> provideNodes(@NotNull TreeElement node) {
  if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
    final PsiElement el = ((PsiTreeElementBase)node).getElement();
    if (el != null) {
      for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
        final PsiElement[] elements = provider.getAnonymousElements(el);
        if (elements.length > 0) {
          List<JavaAnonymousClassTreeElement> result = new ArrayList<JavaAnonymousClassTreeElement>(elements.length);
          for (PsiElement element : elements) {
            result.add(new JavaAnonymousClassTreeElement((PsiAnonymousClass)element, new HashSet<PsiClass>()));
          }
          return result;
        }
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaAnonymousClassesNodeProvider.java

示例5: isPsiValid

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
private static boolean isPsiValid(@NotNull StructureViewComposite.StructureViewDescriptor baseStructureViewDescriptor) {
  final StructureViewComponent view = (StructureViewComponent)baseStructureViewDescriptor.structureView;
  if (view.isDisposed()) return false;

  final Object root = view.getTreeStructure().getRootElement();
  if (root instanceof StructureViewComponent.StructureViewTreeElementWrapper) {
    final TreeElement value = ((StructureViewComponent.StructureViewTreeElementWrapper)root).getValue();
    if (value instanceof StructureViewTreeElement) {
      final Object psi = ((StructureViewTreeElement)value).getValue();
      if (psi instanceof PsiElement) {
        return ((PsiElement)psi).isValid();
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TemplateLanguageStructureViewBuilder.java

示例6: findElement

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@Nullable
private static StructureViewTreeElement findElement(StructureViewTreeElement node, PsiElement element, int hopes) {
  final Object value = node.getValue();
  if (value instanceof PsiElement) {
    if (((PsiElement)value).isEquivalentTo(element)) return node;
    if (hopes != 0) {
      for (TreeElement child : node.getChildren()) {
        if (child instanceof StructureViewTreeElement) {
          final StructureViewTreeElement e = findElement((StructureViewTreeElement)child, element, hopes - 1);
          if (e != null) {
            return e;
          }
        }
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GotoClassAction.java

示例7: getChildren

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@Override
@NotNull
public TreeElement[] getChildren() {
  if (!myElement.isValid()) return EMPTY_ARRAY;
  final ArrayList<TreeElement> result = new ArrayList<TreeElement>();
  final DomElementVisitor elementVisitor = new DomElementVisitor() {
    @Override
    public void visitDomElement(final DomElement element) {
      if (element instanceof GenericDomValue) return;
      final DomService.StructureViewMode viewMode = myDescriptor.fun(element);
      switch (viewMode) {
        case SHOW:
          result.add(createChildElement(element));
          break;
        case SHOW_CHILDREN:
          DomUtil.acceptAvailableChildren(element, this);
          break;
        case SKIP:
          break;
      }
    }
  };
  DomUtil.acceptAvailableChildren(myElement, elementVisitor);
  return result.toArray(new TreeElement[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DomStructureTreeElement.java

示例8: provideNodes

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:Html5SectionsNodeProvider.java

示例9: getProperties

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@NotNull
@Override
public IProperty[] getProperties() {
  final List<IProperty> elements = ContainerUtil.mapNotNull(getChildren(), new NullableFunction<TreeElement, IProperty>() {
    @Nullable
    @Override
    public IProperty fun(final TreeElement treeElement) {
      if (treeElement instanceof PropertiesStructureViewElement) {
        PropertiesStructureViewElement propertiesElement = (PropertiesStructureViewElement)treeElement;
        return propertiesElement.getValue();
      }
      else if (treeElement instanceof ResourceBundlePropertyStructureViewElement) {
        return ((ResourceBundlePropertyStructureViewElement)treeElement).getProperties()[0];
      }
      return null;
    }
  });
  return elements.toArray(new IProperty[elements.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PropertiesPrefixGroup.java

示例10: getChildren

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@NotNull
@Override
public TreeElement[] getChildren() {
    if (myElement instanceof RobotPsiFile) {
        return getChildren((RobotPsiFile)myElement);
    }
    else if (myElement instanceof RobotSettingsTable) {
        return TreeElement.EMPTY_ARRAY; //TODO: Show settings in structure view.
    }
    else if (myElement instanceof RobotVariablesTable) {
        return TreeElement.EMPTY_ARRAY; //TODO: Show variables in structure view
    }
    else if (myElement instanceof RobotKeywordsTable) {
        return getChildren((RobotKeywordsTable)myElement);
    }
    else if (myElement instanceof RobotTestCasesTable) {
        return getChildren((RobotTestCasesTable)myElement);
    }
    return TreeElement.EMPTY_ARRAY;
}
 
开发者ID:charlescapps,项目名称:robot-intellij-plugin,代码行数:21,代码来源:RobotStructureViewTreeElement.java

示例11: getChildren

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
/**
 * Populates the structure view. Uses HaskellUtil to get backing information.
 */
@NotNull
@Override
public TreeElement[] getChildren() {
    if (element instanceof HaskellFile) {
        List<PsiNamedElement> elems =
                HaskellUtil.findDefinitionNodes((HaskellFile) element.getContainingFile(),
                        null);
        List<TreeElement> treeElems = ContainerUtil.newArrayListWithCapacity(elems.size());
        for (PsiNamedElement elem : elems) {
            //noinspection ObjectAllocationInLoop
            treeElems.add(new HaskellStructureViewElement(elem));
        }
        return treeElems.toArray(new TreeElement[treeElems.size()]);
    }
    return EMPTY_ARRAY;
}
 
开发者ID:carymrobbins,项目名称:intellij-haskforce,代码行数:20,代码来源:HaskellStructureViewElement.java

示例12: provideNodes

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@Override
public Collection<JavaAnonymousClassTreeElement> provideNodes(TreeElement node) {
  if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
    final PsiElement el = ((PsiTreeElementBase)node).getElement();
    for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
      final PsiElement[] elements = provider.getAnonymousElements(el);
      if (elements != null && elements.length > 0) {
        List<JavaAnonymousClassTreeElement> result = new ArrayList<JavaAnonymousClassTreeElement>(elements.length);
        for (PsiElement element : elements) {
          result.add(new JavaAnonymousClassTreeElement((PsiAnonymousClass)element, new HashSet<PsiClass>()));
        }
        return result;
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:JavaAnonymousClassesNodeProvider.java

示例13: getChildren

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
public TreeElement[] getChildren() {
  if (!myElement.isValid()) return EMPTY_ARRAY;
  final ArrayList<TreeElement> result = new ArrayList<TreeElement>();
  final DomElementVisitor elementVisitor = new DomElementVisitor() {
    public void visitDomElement(final DomElement element) {
      if (element instanceof GenericDomValue) return;
      final DomService.StructureViewMode viewMode = myDescriptor.fun(element);
      switch (viewMode) {
        case SHOW:
          result.add(createChildElement(element));
          break;
        case SHOW_CHILDREN:
          DomUtil.acceptAvailableChildren(element, this);
          break;
        case SKIP:
          break;
      }
    }
  };
  DomUtil.acceptAvailableChildren(myElement, elementVisitor);
  return result.toArray(new TreeElement[result.size()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:DomStructureTreeElement.java

示例14: provideNodes

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:Html5SectionsNodeProvider.java

示例15: getChildren

import com.intellij.ide.util.treeView.smartTree.TreeElement; //导入依赖的package包/类
@Override
public TreeElement[] getChildren() {
    if (element instanceof XQueryFile) {
        XQueryFile file = (XQueryFile) element;
        List<TreeElement> treeElements = new ArrayList<TreeElement>();
        for (XQueryVarDecl variableDeclaration : file.getVariableDeclarations()) {
            treeElements.add(new XQueryStructureViewElement(variableDeclaration));
        }
        for (XQueryFunctionDecl functionDeclaration : file.getFunctionDeclarations()) {
            treeElements.add(new XQueryStructureViewElement(functionDeclaration));
        }
        if (file.getQueryBody() != null) {
            treeElements.add(new XQueryStructureViewElement(file.getQueryBody()));
        }
        return treeElements.toArray(new TreeElement[treeElements.size()]);
    } else {
        return EMPTY_ARRAY;
    }
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:20,代码来源:XQueryStructureViewElement.java


注:本文中的com.intellij.ide.util.treeView.smartTree.TreeElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。