Java Code Examples for com.intellij.util.ui.tree.TreeUtil#expandAll()
The following examples show how to use
com.intellij.util.ui.tree.TreeUtil#expandAll() .
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: ModulesDependenciesPanel.java From consulo with Apache License 2.0 | 6 votes |
private void buildRightTree(Module module){ final DefaultMutableTreeNode root = (DefaultMutableTreeNode)myRightTreeModel.getRoot(); root.removeAllChildren(); final Set<List<Module>> cycles = GraphAlgorithms.getInstance().findCycles(myModulesGraph, module); int index = 1; for (List<Module> modules : cycles) { final DefaultMutableTreeNode cycle = new DefaultMutableTreeNode( AnalysisScopeBundle.message("module.dependencies.cycle.node.text", Integer.toString(index++).toUpperCase())); root.add(cycle); cycle.add(new DefaultMutableTreeNode(new MyUserObject(false, module))); for (Module moduleInCycle : modules) { cycle.add(new DefaultMutableTreeNode(new MyUserObject(false, moduleInCycle))); } } ((DefaultTreeModel)myRightTree.getModel()).reload(); TreeUtil.expandAll(myRightTree); }
Example 2
Source File: BaseStructureConfigurableNoDaemon.java From consulo with Apache License 2.0 | 6 votes |
protected void addCollapseExpandActions(final List<AnAction> result) { final TreeExpander expander = new TreeExpander() { @Override public void expandAll() { TreeUtil.expandAll(myTree); } @Override public boolean canExpand() { return true; } @Override public void collapseAll() { TreeUtil.collapseAll(myTree, 0); } @Override public boolean canCollapse() { return true; } }; final CommonActionsManager actionsManager = CommonActionsManager.getInstance(); result.add(actionsManager.createExpandAllAction(expander, myTree)); result.add(actionsManager.createCollapseAllAction(expander, myTree)); }
Example 3
Source File: NewProjectPanel.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override protected JComponent createLeftComponent(@Nonnull Disposable parentDisposable) { NewModuleContext context = new NewModuleContext(); NewModuleBuilder.EP_NAME.composite().setupContext(context); myTree = new Tree(new AsyncTreeModel(new StructureTreeModel<>(new NewProjectTreeStructure(context), parentDisposable), parentDisposable)); myTree.setFont(UIUtil.getFont(UIUtil.FontSize.BIGGER, null)); myTree.setOpaque(false); myTree.setBackground(SwingUIDecorator.get(SwingUIDecorator::getSidebarColor)); myTree.setRootVisible(false); myTree.setRowHeight(JBUI.scale(24)); TreeUtil.expandAll(myTree); return ScrollPaneFactory.createScrollPane(myTree, true); }
Example 4
Source File: ModulesDependenciesPanel.java From consulo with Apache License 2.0 | 5 votes |
private static ActionGroup createTreePopupActions(final boolean isRightTree, final Tree tree) { DefaultActionGroup group = new DefaultActionGroup(); final TreeExpander treeExpander = new TreeExpander() { @Override public void expandAll() { TreeUtil.expandAll(tree); } @Override public boolean canExpand() { return isRightTree; } @Override public void collapseAll() { TreeUtil.collapseAll(tree, 3); } @Override public boolean canCollapse() { return true; } }; final CommonActionsManager actionManager = CommonActionsManager.getInstance(); if (isRightTree){ group.add(actionManager.createExpandAllAction(treeExpander, tree)); } group.add(actionManager.createCollapseAllAction(treeExpander, tree)); final ActionManager globalActionManager = ActionManager.getInstance(); group.add(globalActionManager.getAction(IdeActions.ACTION_EDIT_SOURCE)); group.add(AnSeparator.getInstance()); group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_DEPENDENCIES)); group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_BACK_DEPENDENCIES)); //non exists in platform group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_CYCLIC_DEPENDENCIES)); return group; }
Example 5
Source File: UiInspectorAction.java From consulo with Apache License 2.0 | 5 votes |
public void expandPath() { TreeUtil.expandAll(this); int count = getRowCount(); ComponentNode node = new ComponentNode(myComponent); for (int i = 0; i < count; i++) { TreePath row = getPathForRow(i); if (row.getLastPathComponent().equals(node)) { setSelectionPath(row); scrollPathToVisible(getSelectionPath()); break; } } }
Example 6
Source File: PopupTableAdapter.java From consulo with Apache License 2.0 | 5 votes |
@Override public JScrollPane createScrollPane() { if (myTable instanceof TreeTable) { TreeUtil.expandAll(((TreeTable)myTable).getTree()); } JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); if (myTable.getSelectedRow() == -1) { myTable.getSelectionModel().setSelectionInterval(0, 0); } if (myTable.getRowCount() >= 20) { scrollPane.getViewport().setPreferredSize(new Dimension(myTable.getPreferredScrollableViewportSize().width, 300)); } else { scrollPane.getViewport().setPreferredSize(myTable.getPreferredSize()); } if (myBuilder.isAutoselectOnMouseMove()) { myTable.addMouseMotionListener(new MouseMotionAdapter() { boolean myIsEngaged = false; @Override public void mouseMoved(MouseEvent e) { if (myIsEngaged) { int index = myTable.rowAtPoint(e.getPoint()); myTable.getSelectionModel().setSelectionInterval(index, index); } else { myIsEngaged = true; } } }); } return scrollPane; }
Example 7
Source File: ChooseActionsDialog.java From consulo with Apache License 2.0 | 5 votes |
private void filterTreeByShortcut(final ShortcutTextField firstShortcut, final JCheckBox enable2Shortcut, final ShortcutTextField secondShortcut) { final KeyStroke keyStroke = firstShortcut.getKeyStroke(); if (keyStroke != null) { if (!myTreeExpansionMonitor.isFreeze()) myTreeExpansionMonitor.freeze(); myActionsTree.filterTree(new KeyboardShortcut(keyStroke, enable2Shortcut.isSelected() ? secondShortcut.getKeyStroke() : null), myQuicklists); final JTree tree = myActionsTree.getTree(); TreeUtil.expandAll(tree); } }
Example 8
Source File: InspectionResultsView.java From consulo with Apache License 2.0 | 5 votes |
private JComponent createLeftActionsToolbar() { final CommonActionsManager actionsManager = CommonActionsManager.getInstance(); DefaultActionGroup group = new DefaultActionGroup(); group.add(new RerunAction(this)); group.add(new CloseAction()); final TreeExpander treeExpander = new TreeExpander() { @Override public void expandAll() { TreeUtil.expandAll(myTree); } @Override public boolean canExpand() { return true; } @Override public void collapseAll() { TreeUtil.collapseAll(myTree, 0); } @Override public boolean canCollapse() { return true; } }; group.add(actionsManager.createExpandAllAction(treeExpander, myTree)); group.add(actionsManager.createCollapseAllAction(treeExpander, myTree)); group.add(actionsManager.createPrevOccurenceAction(getOccurenceNavigator())); group.add(actionsManager.createNextOccurenceAction(getOccurenceNavigator())); group.add(myGlobalInspectionContext.createToggleAutoscrollAction()); group.add(new ExportHTMLAction(this)); group.add(new ContextHelpAction(HELP_ID)); return createToolbar(group); }
Example 9
Source File: MongoResultPanelTest.java From nosql4idea with Apache License 2.0 | 5 votes |
@Test public void testDisplayTreeWithAnArrayOfStructuredDocument() throws Exception { mongoResultPanel.updateResultTableTree(createCollectionResults("arrayOfDocuments.json", "mycollec")); TreeUtil.expandAll(mongoResultPanel.resultTableView.getTree()); frameFixture.table("resultTreeTable").cellReader(new TableCellReader()) .requireContents(new String[][]{ {"[0]", "{ \"id\" : 0 , \"label\" : \"toto\" , \"visible\" : false , \"doc\" : { \"title\" : \"hello\" , \"nbPages\" : 10 , \"keyWord\" : [ \"toto\" , true , 10]}}"}, {"id", "0"}, {"label", "\"toto\""}, {"visible", "false"}, {"doc", "{ \"title\" : \"hello\" , \"nbPages\" : 10 , \"keyWord\" : [ \"toto\" , true , 10]}"}, {"title", "\"hello\""}, {"nbPages", "10"}, {"keyWord", "[ \"toto\" , true , 10]"}, {"[0]", "\"toto\""}, {"[1]", "true"}, {"[2]", "10"}, {"[1]", "{ \"id\" : 1 , \"label\" : \"tata\" , \"visible\" : true , \"doc\" : { \"title\" : \"ola\" , \"nbPages\" : 1 , \"keyWord\" : [ \"tutu\" , false , 10]}}"}, {"id", "1"}, {"label", "\"tata\""}, {"visible", "true"}, {"doc", "{ \"title\" : \"ola\" , \"nbPages\" : 1 , \"keyWord\" : [ \"tutu\" , false , 10]}"}, {"title", "\"ola\""}, {"nbPages", "1"}, {"keyWord", "[ \"tutu\" , false , 10]"}, {"[0]", "\"tutu\""}, {"[1]", "false"}, {"[2]", "10"}, }); }
Example 10
Source File: GlobalConfigsToolWindowPanel.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
public void expandAll() { ApplicationManager.getApplication().assertIsDispatchThread(); try { TreeUtil.expandAll(myTree); } finally { } }
Example 11
Source File: ExtensionEditor.java From consulo with Apache License 2.0 | 4 votes |
@Override public void moduleStateChanged() { mySplitter.setSecondComponent(null); myTree.setModel(new DefaultTreeModel(new ExtensionCheckedTreeNode(null, myState, this))); TreeUtil.expandAll(myTree); }
Example 12
Source File: DetectedRootsChooserDialog.java From consulo with Apache License 2.0 | 4 votes |
private static CheckboxTreeTable createTreeTable(List<SuggestedChildRootInfo> suggestedRoots) { final CheckedTreeNode root = createRoot(suggestedRoots); CheckboxTreeTable treeTable = new CheckboxTreeTable(root, new CheckboxTree.CheckboxTreeCellRenderer(true) { @Override public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { if (!(value instanceof VirtualFileCheckedTreeNode)) return; VirtualFileCheckedTreeNode node = (VirtualFileCheckedTreeNode)value; VirtualFile file = node.getFile(); String text; SimpleTextAttributes attributes; Icon icon; boolean isValid = true; if (leaf) { VirtualFile ancestor = ((VirtualFileCheckedTreeNode)node.getParent()).getFile(); if (ancestor != null) { text = VfsUtilCore.getRelativePath(file, ancestor, File.separatorChar); if (StringUtil.isEmpty(text)) { text = File.separator; } } else { text = file.getPresentableUrl(); } if (text == null) { isValid = false; text = file.getPresentableUrl(); } attributes = SimpleTextAttributes.REGULAR_ATTRIBUTES; icon = AllIcons.Nodes.TreeClosed; } else { text = file.getPresentableUrl(); if (text == null) { isValid = false; } attributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES; icon = AllIcons.Nodes.TreeClosed; } final ColoredTreeCellRenderer textRenderer = getTextRenderer(); textRenderer.setIcon(icon); if (!isValid) { textRenderer.append("[INVALID] ", SimpleTextAttributes.ERROR_ATTRIBUTES); } if (text != null) { textRenderer.append(text, attributes); } } }, new ColumnInfo[]{ROOT_COLUMN, ROOT_TYPE_COLUMN}); int max = 0; for (SuggestedChildRootInfo info : suggestedRoots) { for (String s : info.getRootTypeNames()) { max = Math.max(max, treeTable.getFontMetrics(treeTable.getFont()).stringWidth(s)); } } final TableColumn column = treeTable.getColumnModel().getColumn(1); int width = max + 20;//add space for combobox button column.setPreferredWidth(width); column.setMaxWidth(width); treeTable.setRootVisible(false); TreeUtil.expandAll(treeTable.getTree()); return treeTable; }
Example 13
Source File: DefaultTreeExpander.java From consulo with Apache License 2.0 | 4 votes |
public void expandAll() { TreeUtil.expandAll(myTree); showSelectionCentered(); }
Example 14
Source File: CoverageSuiteChooserDialog.java From consulo with Apache License 2.0 | 4 votes |
private void updateTree() { ((DefaultTreeModel)mySuitesTree.getModel()).reload(); TreeUtil.expandAll(mySuitesTree); }
Example 15
Source File: ChangesViewManager.java From consulo with Apache License 2.0 | 4 votes |
public void expandAll() { TreeUtil.expandAll(myView); }
Example 16
Source File: SpecificFilesViewDialog.java From consulo with Apache License 2.0 | 4 votes |
public void expandAll() { TreeUtil.expandAll(myView); }
Example 17
Source File: ExtensionEditor.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override protected JComponent createComponentImpl() { JPanel rootPane = new JPanel(new BorderLayout()); mySplitter = new OnePixelSplitter(); myTree = new CheckboxTreeNoPolicy(new ExtensionTreeCellRenderer(), new ExtensionCheckedTreeNode(null, myState, this)) { @Override protected void adjustParentsAndChildren(CheckedTreeNode node, boolean checked) { if (!checked) { changeNodeState(node, false); checkOrUncheckChildren(node, false); } else { // we need collect parents, and enable it in right order // A // - B // -- C // when we enable C, ill be calls like A -> B -> C List<CheckedTreeNode> parents = new ArrayList<>(); TreeNode parent = node.getParent(); while (parent != null) { if (parent instanceof CheckedTreeNode) { parents.add((CheckedTreeNode)parent); } parent = parent.getParent(); } Collections.reverse(parents); for (CheckedTreeNode checkedTreeNode : parents) { checkNode(checkedTreeNode, true); } changeNodeState(node, true); } repaint(); } }; myTree.setRootVisible(false); myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myTree.addTreeSelectionListener(new TreeSelectionListener() { @Override @RequiredUIAccess public void valueChanged(final TreeSelectionEvent e) { final List<MutableModuleExtension> selected = TreeUtil.collectSelectedObjectsOfType(myTree, MutableModuleExtension.class); updateSecondComponent(ContainerUtil.<MutableModuleExtension>getFirstItem(selected)); } }); TreeUtil.expandAll(myTree); mySplitter.setFirstComponent(myTree); rootPane.add(new JBScrollPane(mySplitter), BorderLayout.CENTER); return rootPane; }
Example 18
Source File: RedisPanel.java From nosql4idea with Apache License 2.0 | 4 votes |
void expandAll() { TreeUtil.expandAll(resultTableView.getTree()); }
Example 19
Source File: CommittedChangesTreeBrowser.java From consulo with Apache License 2.0 | 4 votes |
public CommittedChangesTreeBrowser(final Project project, final List<CommittedChangeList> changeLists) { super(new BorderLayout()); myProject = project; myDecorators = new LinkedList<CommittedChangeListDecorator>(); myChangeLists = changeLists; myChangesTree = new ChangesBrowserTree(); myChangesTree.setRootVisible(false); myChangesTree.setShowsRootHandles(true); myChangesTree.setCellRenderer(new CommittedChangeListRenderer(project, myDecorators)); TreeUtil.expandAll(myChangesTree); myChangesTree.getExpandableItemsHandler().setEnabled(false); myDetailsView = new RepositoryChangesBrowser(project, Collections.<CommittedChangeList>emptyList()); myDetailsView.getViewer().setScrollPaneBorder(RIGHT_BORDER); myChangesTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { updateBySelectionChange(); } }); final TreeLinkMouseListener linkMouseListener = new TreeLinkMouseListener(new CommittedChangeListRenderer(project, myDecorators)); linkMouseListener.installOn(myChangesTree); myLeftPanel = new JPanel(new BorderLayout()); initSplitters(); updateBySelectionChange(); ActionManager.getInstance().getAction("CommittedChanges.Details") .registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_QUICK_JAVADOC)), this); myCopyProvider = new TreeCopyProvider(myChangesTree); myTreeExpander = new DefaultTreeExpander(myChangesTree); myDetailsView.addToolbarAction(ActionManager.getInstance().getAction("Vcs.ShowTabbedFileHistory")); myHelpId = ourHelpId; myDetailsView.getDiffAction().registerCustomShortcutSet(CommonShortcuts.getDiff(), myChangesTree); myConnection = myProject.getMessageBus().connect(); myConnection.subscribe(ITEMS_RELOADED, new CommittedChangesReloadListener() { public void itemsReloaded() { } public void emptyRefresh() { updateGrouping(); } }); }
Example 20
Source File: MongoResultPanel.java From nosql4idea with Apache License 2.0 | 4 votes |
void expandAll() { TreeUtil.expandAll(resultTableView.getTree()); }