Search in sources :

Example 11 with AbstractTreeStructure

use of com.intellij.ide.util.treeView.AbstractTreeStructure in project android by JetBrains.

the class NlPaletteTreeGrid method updateTreeModel.

private void updateTreeModel() {
    AbstractTreeStructure provider = myCategoryList.getModel().getSize() > 1 && myFilter.getPattern().isEmpty() ? new TreeProvider(myProject, myPalette) : new SingleListTreeProvider(myProject, myPalette);
    myTree.setModel(provider);
    myTree.addMouseListener(createMouseListenerForLoadMissingDependency());
    myTree.addListSelectionListener(event -> fireSelectionChanged(myTree.getSelectedElement()));
    myTree.setVisibleSection(myCategoryList.getSelectedValue());
    myTree.setTransferHandler(new MyItemTransferHandler(mySurface, this::getSelectedItem, myIconPreviewFactory));
    setMode(myMode);
}
Also used : AbstractTreeStructure(com.intellij.ide.util.treeView.AbstractTreeStructure)

Example 12 with AbstractTreeStructure

use of com.intellij.ide.util.treeView.AbstractTreeStructure in project intellij-plugins by JetBrains.

the class CfmlStructureViewTest method getTopLevelItems.

private Object[] getTopLevelItems() {
    StructureView structureView = createStructureViewModel();
    final StructureViewModel structureViewModel = structureView.getTreeModel();
    AbstractTreeStructure jsTreeStructure = new SmartTreeStructure(getProject(), structureViewModel);
    Object[] items = jsTreeStructure.getChildElements(jsTreeStructure.getRootElement());
    structureViewModel.dispose();
    Disposer.dispose(structureView);
    return items;
}
Also used : StructureView(com.intellij.ide.structureView.StructureView) StructureViewModel(com.intellij.ide.structureView.StructureViewModel) SmartTreeStructure(com.intellij.ide.util.treeView.smartTree.SmartTreeStructure) AbstractTreeStructure(com.intellij.ide.util.treeView.AbstractTreeStructure)

Example 13 with AbstractTreeStructure

use of com.intellij.ide.util.treeView.AbstractTreeStructure in project intellij-community by JetBrains.

the class ToDoTreeStructureTest method testToDo1.

public void testToDo1() throws Exception {
    AllTodosTreeBuilder all = new AllTodosTreeBuilder(new Tree(), new DefaultTreeModel(new DefaultMutableTreeNode()), myProject);
    all.init();
    AbstractTreeStructure structure = all.getTreeStructure();
    ((TodoTreeStructure) structure).setFlattenPackages(true);
    ProjectViewTestUtil.assertStructureEqual(structure, "Root\n" + " Summary\n" + "  package2 toDoFileCount=1,toDoItemCount=2\n" + "   JavaClass.java\n" + "    Item: (62,78)\n" + "    Item: (145,162)\n", myPrintInfo);
    checkOccurrences(all, new String[] { "Item: (62,78)", "Item: (145,162)" });
    Disposer.dispose(all);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TodoTreeStructure(com.intellij.ide.todo.TodoTreeStructure) AllTodosTreeBuilder(com.intellij.ide.todo.AllTodosTreeBuilder) Tree(com.intellij.ui.treeStructure.Tree) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) AbstractTreeStructure(com.intellij.ide.util.treeView.AbstractTreeStructure)

Example 14 with AbstractTreeStructure

use of com.intellij.ide.util.treeView.AbstractTreeStructure in project intellij-community by JetBrains.

the class ToDoTreeStructureTest method checkOccurrences.

private static void checkOccurrences(final AllTodosTreeBuilder all, final String[] strings) {
    AbstractTreeStructure allTreeStructure = all.getTreeStructure();
    TodoItemNode current = all.getFirstPointerForElement(allTreeStructure.getRootElement());
    for (String string : strings) {
        assertNotNull(current);
        assertEquals(string, current.getTestPresentation());
        current = all.getNextPointer(current);
    }
    assertNull(current);
    current = all.getLastPointerForElement(allTreeStructure.getRootElement());
    for (int i = strings.length - 1; i >= 0; i--) {
        String string = strings[i];
        assertNotNull(current);
        assertEquals(string, current.getTestPresentation());
        current = all.getPreviousPointer(current);
    }
    assertNull(current);
}
Also used : AbstractTreeStructure(com.intellij.ide.util.treeView.AbstractTreeStructure) TodoItemNode(com.intellij.ide.todo.nodes.TodoItemNode)

Aggregations

AbstractTreeStructure (com.intellij.ide.util.treeView.AbstractTreeStructure)14 AllTodosTreeBuilder (com.intellij.ide.todo.AllTodosTreeBuilder)2 SmartTreeStructure (com.intellij.ide.util.treeView.smartTree.SmartTreeStructure)2 Tree (com.intellij.ui.treeStructure.Tree)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 Nullable (org.jetbrains.annotations.Nullable)2 StructureView (com.intellij.ide.structureView.StructureView)1 StructureViewModel (com.intellij.ide.structureView.StructureViewModel)1 CurrentFileTodosTreeBuilder (com.intellij.ide.todo.CurrentFileTodosTreeBuilder)1 TodoTreeStructure (com.intellij.ide.todo.TodoTreeStructure)1 TodoItemNode (com.intellij.ide.todo.nodes.TodoItemNode)1 AbstractTreeBuilder (com.intellij.ide.util.treeView.AbstractTreeBuilder)1 NodeDescriptor (com.intellij.ide.util.treeView.NodeDescriptor)1 BlockTreeBuilder (com.intellij.internal.psiView.formattingblocks.BlockTreeBuilder)1 BlockTreeNode (com.intellij.internal.psiView.formattingblocks.BlockTreeNode)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 ModalityState (com.intellij.openapi.application.ModalityState)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1