Search in sources :

Example 16 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project intellij-community by JetBrains.

the class PyCharmEduInitialConfigurator method patchMainMenu.

private static void patchMainMenu() {
    final CustomActionsSchema schema = new CustomActionsSchema();
    final JTree actionsTree = new Tree();
    Group rootGroup = new Group("root", null, null);
    final DefaultMutableTreeNode root = new DefaultMutableTreeNode(rootGroup);
    DefaultTreeModel model = new DefaultTreeModel(root);
    actionsTree.setModel(model);
    schema.fillActionGroups(root);
    for (int i = 0; i < root.getChildCount(); i++) {
        final DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) root.getChildAt(i);
        if ("Main menu".equals(getItemId(treeNode))) {
            hideActionFromMainMenu(root, schema, treeNode);
        }
        hideActions(schema, root, treeNode, HIDDEN_ACTIONS);
    }
    CustomActionsSchema.getInstance().copyFrom(schema);
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Group(com.intellij.openapi.keymap.impl.ui.Group) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CustomActionsSchema(com.intellij.ide.ui.customization.CustomActionsSchema) Tree(com.intellij.ui.treeStructure.Tree) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ExtensionPoint(com.intellij.openapi.extensions.ExtensionPoint)

Example 17 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project intellij-community by JetBrains.

the class DesignerToolWindow method update.

public void update(GuiEditor designer) {
    clearTreeBuilder();
    myComponentTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode()));
    myComponentTree.setEditor(designer);
    myPropertyInspector.setEditor(designer);
    if (designer == null) {
        myComponentTree.setFormEditor(null);
    } else {
        myComponentTree.setFormEditor(designer.getEditor());
        myComponentTreeBuilder = new ComponentTreeBuilder(myComponentTree, designer);
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) ComponentTreeBuilder(com.intellij.uiDesigner.componentTree.ComponentTreeBuilder)

Example 18 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project intellij-community by JetBrains.

the class InternalCompilerRefServiceView method showHierarchyInfo.

public static void showHierarchyInfo(CompilerReferenceHierarchyTestInfo info, PsiElement element) {
    final InternalCompilerRefServiceView view = createViewTab(element);
    final DefaultMutableTreeNode node = info.asTree();
    node.setUserObject(element);
    ((DefaultTreeModel) view.myTree.getModel()).setRoot(node);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 19 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project intellij-community by JetBrains.

the class InternalCompilerRefServiceView method showFindUsages.

public static void showFindUsages(CompilerReferenceFindUsagesTestInfo info, PsiElement element) {
    final InternalCompilerRefServiceView view = createViewTab(element);
    final DefaultMutableTreeNode node = info.asTree();
    node.setUserObject(element);
    ((DefaultTreeModel) view.myTree.getModel()).setRoot(node);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 20 with DefaultTreeModel

use of javax.swing.tree.DefaultTreeModel in project jdk8u_jdk by JetBrains.

the class bug8023474 method createAndShowGUI.

private static void createAndShowGUI() {
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
    DefaultMutableTreeNode item = new DefaultMutableTreeNode("item");
    DefaultMutableTreeNode subItem = new DefaultMutableTreeNode("subItem");
    root.add(item);
    item.add(subItem);
    DefaultTreeModel model = new DefaultTreeModel(root);
    tree = new JTree(model);
    tree.setCellEditor(new Editor());
    tree.setEditable(true);
    tree.setRowHeight(30);
    tree.setCellRenderer(new CheckboxCellRenderer());
    JFrame frame = new JFrame("bug8023474");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new JScrollPane(tree));
    frame.setSize(400, 300);
    frame.setVisible(true);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) TreeCellEditor(javax.swing.tree.TreeCellEditor)

Aggregations

DefaultTreeModel (javax.swing.tree.DefaultTreeModel)362 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)204 TreePath (javax.swing.tree.TreePath)99 JTree (javax.swing.JTree)30 JScrollPane (javax.swing.JScrollPane)25 Test (org.junit.Test)24 Tree (com.intellij.ui.treeStructure.Tree)23 TreeNode (javax.swing.tree.TreeNode)22 ArrayList (java.util.ArrayList)21 TreeSelectionEvent (javax.swing.event.TreeSelectionEvent)20 TreeSelectionListener (javax.swing.event.TreeSelectionListener)18 MockTreeModelListener (com.facebook.buck.intellij.ideabuck.test.util.MockTreeModelListener)16 MouseEvent (java.awt.event.MouseEvent)16 List (java.util.List)16 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 DefaultTreeCellRenderer (javax.swing.tree.DefaultTreeCellRenderer)14 IOException (java.io.IOException)12 Dimension (java.awt.Dimension)11 ActionEvent (java.awt.event.ActionEvent)11