Ejemplo n.º 1
0
  @Override
  public Collection<AbstractTreeNode> modify(
      AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings) {
    List<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();

    for (AbstractTreeNode child : children) {
      Object childValue = child.getValue();

      if (childValue instanceof JetFile) {
        JetFile file = (JetFile) childValue;
        List<JetDeclaration> declarations = file.getDeclarations();

        JetClassOrObject mainClass = JetIconProvider.getMainClass(file);
        if (mainClass != null && (!settings.isShowMembers() || declarations.size() == 1)) {
          result.add(new JetClassOrObjectTreeNode(file.getProject(), mainClass, settings));
        } else {
          result.add(new JetFileTreeNode(file.getProject(), file, settings));
        }
      } else {
        result.add(child);
      }
    }

    return result;
  }