Java Code Examples for com.intellij.util.ui.tree.TreeUtil#expand()

The following examples show how to use com.intellij.util.ui.tree.TreeUtil#expand() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonTreeTableView.java    From nosql4idea with Apache License 2.0 6 votes vote down vote up
public JsonTreeTableView(TreeNode rootNode, ColumnInfo[] columnInfos) {
    super(new ListTreeTableModelOnColumns(rootNode, columnInfos));
    this.columns = columnInfos;

    final TreeTableTree tree = getTree();

    tree.setShowsRootHandles(true);
    tree.setRootVisible(false);
    UIUtil.setLineStyleAngled(tree);
    setTreeCellRenderer(new KeyCellRenderer());

    TreeUtil.expand(tree, 2);

    new TreeTableSpeedSearch(this, new Convertor<TreePath, String>() {
        @Override
        public String convert(final TreePath path) {
            final NoSqlTreeNode node = (NoSqlTreeNode) path.getLastPathComponent();
            NodeDescriptor descriptor = node.getDescriptor();
            return descriptor.getFormattedKey();
        }
    });
}
 
Example 2
Source File: NoSqlExplorerPanel.java    From nosql4idea with Apache License 2.0 6 votes vote down vote up
public void reloadAllServerConfigurations() {
    this.databaseVendorClientManager.cleanUpServers();
    databaseTree.setRootVisible(false);

    List<ServerConfiguration> serverConfigurations = getServerConfigurations();
    if (serverConfigurations.size() == 0) {
        databaseTree.setModel(null);
        return;
    }

    final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
    databaseTree.setModel(new DefaultTreeModel(rootNode));

    for (ServerConfiguration serverConfiguration : serverConfigurations) {
        DatabaseServer mongoServer = new DatabaseServer(serverConfiguration);
        this.databaseVendorClientManager.registerServer(mongoServer);
        DefaultMutableTreeNode serverNode = new DefaultMutableTreeNode(mongoServer);
        rootNode.add(serverNode);
        if (serverConfiguration.isConnectOnIdeStartup()) {
            this.reloadServerConfiguration(serverNode, false);
        }
    }

    TreeUtil.expand(databaseTree, 2);
}
 
Example 3
Source File: BaseToolsPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void reset() {
  List<ToolsGroup<T>> groups = getToolsGroups();

  for (ToolsGroup group : groups) {
    insertNewGroup((ToolsGroup)group.copy());
  }

  if ((getTreeRoot()).getChildCount() > 0) {
    myTree.setSelectionInterval(0, 0);
  }
  else {
    myTree.getSelectionModel().clearSelection();
  }
  (getModel()).nodeStructureChanged(null);

  TreeUtil.expand(myTree, 5);

  myIsModified = false;

  update();
}
 
Example 4
Source File: StructureViewComponent.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void restoreState() {
  TreeState state = myFileEditor == null ? null : myFileEditor.getUserData(STRUCTURE_VIEW_STATE_KEY);
  if (state == null) {
    if (!Boolean.TRUE.equals(UIUtil.getClientProperty(myTree, STRUCTURE_VIEW_STATE_RESTORED_KEY))) {
      TreeUtil.expand(getTree(), getMinimumExpandDepth(myTreeModel));
    }
  }
  else {
    UIUtil.putClientProperty(myTree, STRUCTURE_VIEW_STATE_RESTORED_KEY, true);
    state.applyTo(myTree);
    if (myFileEditor != null) {
      myFileEditor.putUserData(STRUCTURE_VIEW_STATE_KEY, null);
    }
  }
}
 
Example 5
Source File: StructureViewComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void setActionActive(String name, boolean state) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  storeState();
  StructureViewFactoryEx.getInstanceEx(myProject).setActiveAction(name, state);
  ourSettingsModificationCount.incrementAndGet();

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    waitForRebuildAndExpand();
  }
  else {
    rebuild();
    TreeUtil.expand(getTree(), getMinimumExpandDepth(myTreeModel));
  }
}
 
Example 6
Source File: SpecificFilesViewDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void collapseAll() {
  TreeUtil.collapseAll(myView, 1);
  TreeUtil.expand(myView, 0);
}
 
Example 7
Source File: ChangesViewManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void collapseAll() {
  TreeUtil.collapseAll(myView, 2);
  TreeUtil.expand(myView, 1);
}