Search in sources :

Example 1 with AsyncTreeModel

use of com.intellij.ui.tree.AsyncTreeModel in project intellij-mta by windup.

the class MtaToolWindow method init.

private void init() {
    MtaExplorerTreeStructure treeStructure = new MtaExplorerTreeStructure(modelService, vertxService);
    AsyncTreeModel asyncTreeModelModel = new AsyncTreeModel(treeStructure.getTreeModel(), true, project);
    Tree mtaTree = (this.tree = this.createTree(asyncTreeModelModel, this.modelService.getModel(), treeStructure.getTreeModel(), this.vertxService));
    JScrollPane mtaTreePanel = ScrollPaneFactory.createScrollPane(mtaTree);
    NonOpaquePanel treePanelWrapper = new NonOpaquePanel();
    treePanelWrapper.setContent(mtaTreePanel);
    PopupHandler.installPopupHandler(mtaTree, "org.jboss.tools.intellij.mta.explorer", ActionPlaces.UNKNOWN);
    super.setContent(treePanelWrapper);
}
Also used : NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) AsyncTreeModel(com.intellij.ui.tree.AsyncTreeModel) Tree(com.intellij.ui.treeStructure.Tree)

Example 2 with AsyncTreeModel

use of com.intellij.ui.tree.AsyncTreeModel in project intellij-tekton by redhat-developer.

the class WindowToolFactory method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    try {
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        TektonTreeStructure structure = new TektonTreeStructure(project);
        StructureTreeModel<TektonTreeStructure> model = buildModel(structure, project);
        new MutableTektonModelSynchronizer<>(model, structure, structure);
        Tree tree = new Tree(new AsyncTreeModel(model, project));
        tree.putClientProperty(Constants.STRUCTURE_PROPERTY, structure);
        tree.setCellRenderer(new NodeRenderer());
        ActionManager actionManager = ActionManager.getInstance();
        ActionGroup group = (ActionGroup) actionManager.getAction("com.redhat.devtools.intellij.tektoncd.tree");
        PopupHandler.installPopupHandler(tree, group, ActionPlaces.POPUP, actionManager, new TektonTreePopupMenuListener());
        new TektonTreeDoubleClickListener(tree);
        TknCliFactory.getInstance().getTkn(project).whenComplete((tkn, err) -> {
            HubModel hubModel = new HubModel(project, tkn, null);
            JPanel hubItemsListPanel = new HubItemPanelsBoard(hubModel, getDoSelectAction(project, hubModel)).withRecommended().withInstalled().build(Optional.empty());
            OnePixelSplitter tabPanel = createTabPanel(new JBScrollPane(tree), hubItemsListPanel);
            toolWindow.getContentManager().addContent(contentFactory.createContent(tabPanel, "", false));
            executeOnProjectClosing(project, () -> {
                structure.dispose();
                hubModel.dispose();
            });
        });
    } catch (IllegalAccessException | InvocationTargetException | InstantiationException | NoSuchMethodException e) {
        throw new RuntimeException((e));
    }
}
Also used : JPanel(javax.swing.JPanel) AsyncTreeModel(com.intellij.ui.tree.AsyncTreeModel) TektonTreeStructure(com.redhat.devtools.intellij.tektoncd.tree.TektonTreeStructure) TektonTreeDoubleClickListener(com.redhat.devtools.intellij.tektoncd.listener.TektonTreeDoubleClickListener) HubItemPanelsBoard(com.redhat.devtools.intellij.tektoncd.ui.hub.HubItemPanelsBoard) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) HubModel(com.redhat.devtools.intellij.tektoncd.ui.hub.HubModel) ContentFactory(com.intellij.ui.content.ContentFactory) MutableTektonModelSynchronizer(com.redhat.devtools.intellij.tektoncd.tree.MutableTektonModelSynchronizer) InvocationTargetException(java.lang.reflect.InvocationTargetException) NodeRenderer(com.intellij.ide.util.treeView.NodeRenderer) ActionManager(com.intellij.openapi.actionSystem.ActionManager) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) Tree(com.intellij.ui.treeStructure.Tree) TektonTreePopupMenuListener(com.redhat.devtools.intellij.tektoncd.listener.TektonTreePopupMenuListener) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 3 with AsyncTreeModel

use of com.intellij.ui.tree.AsyncTreeModel in project consulo by consulo.

the class TodoPanel method setupTreeStructure.

private TodoTreeBuilder setupTreeStructure() {
    TodoTreeBuilder todoTreeBuilder = createTreeBuilder(myTree, myProject);
    TodoTreeStructure structure = todoTreeBuilder.getTodoTreeStructure();
    StructureTreeModel structureTreeModel = new StructureTreeModel(structure, TodoTreeBuilder.NODE_DESCRIPTOR_COMPARATOR, this);
    AsyncTreeModel asyncTreeModel = new AsyncTreeModel(structureTreeModel, myProject);
    myTree.setModel(asyncTreeModel);
    asyncTreeModel.addTreeModelListener(new MyExpandListener(todoTreeBuilder));
    todoTreeBuilder.setModel(structureTreeModel);
    Object selectableElement = structure.getFirstSelectableElement();
    if (selectableElement != null) {
        todoTreeBuilder.select(selectableElement);
    }
    return todoTreeBuilder;
}
Also used : AsyncTreeModel(com.intellij.ui.tree.AsyncTreeModel) StructureTreeModel(com.intellij.ui.tree.StructureTreeModel)

Example 4 with AsyncTreeModel

use of com.intellij.ui.tree.AsyncTreeModel in project intellij by bazelbuild.

the class TasksTreeView method createComponent.

@Override
protected Tree createComponent() {
    treeStructureModel = new StructureTreeModel<>(treeStructure, parentDisposable);
    AsyncTreeModel asyncModel = new AsyncTreeModel(treeStructureModel, parentDisposable);
    asyncModel.addTreeModelListener(new TaskNodeAutoExpandingListener());
    tree = new Tree(asyncModel);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setRootVisible(false);
    tree.setCellRenderer(new TaskDurationNodeRenderer());
    // This is required since we use animated icons in tree cell renderers:
    UIUtil.putClientProperty(tree, AnimatedIcon.ANIMATION_IN_RENDERER_ALLOWED, Boolean.TRUE);
    return tree;
}
Also used : AsyncTreeModel(com.intellij.ui.tree.AsyncTreeModel) Tree(com.intellij.ui.treeStructure.Tree) JTree(javax.swing.JTree)

Example 5 with AsyncTreeModel

use of com.intellij.ui.tree.AsyncTreeModel in project intellij-openshift-connector by redhat-developer.

the class WindowToolFactory method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    try {
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        JBPanel<JBPanel> panel = new JBPanel<>();
        panel.setLayout(new BorderLayout());
        ApplicationsTreeStructure structure = new ApplicationsTreeStructure(project);
        StructureTreeModel<ApplicationsTreeStructure> model = buildModel(structure, project);
        new MutableModelSynchronizer<>(model, structure, structure);
        Tree tree = new Tree(new AsyncTreeModel(model, project));
        tree.putClientProperty(Constants.STRUCTURE_PROPERTY, structure);
        tree.setCellRenderer(new NodeRenderer());
        tree.setRootVisible(false);
        PopupHandler.installPopupHandler(tree, "org.jboss.tools.intellij.tree", ActionPlaces.UNKNOWN);
        panel.add(new JBScrollPane(tree), BorderLayout.CENTER);
        toolWindow.getContentManager().addContent(contentFactory.createContent(panel, "", false));
        TreeHelper.addLinkSupport(tree);
    } catch (IllegalAccessException | InvocationTargetException | InstantiationException | NoSuchMethodException e) {
        throw new RuntimeException(e);
    }
}
Also used : AsyncTreeModel(com.intellij.ui.tree.AsyncTreeModel) MutableModelSynchronizer(com.redhat.devtools.intellij.common.tree.MutableModelSynchronizer) ContentFactory(com.intellij.ui.content.ContentFactory) JBPanel(com.intellij.ui.components.JBPanel) InvocationTargetException(java.lang.reflect.InvocationTargetException) ApplicationsTreeStructure(org.jboss.tools.intellij.openshift.tree.application.ApplicationsTreeStructure) NodeRenderer(com.intellij.ide.util.treeView.NodeRenderer) BorderLayout(java.awt.BorderLayout) Tree(com.intellij.ui.treeStructure.Tree) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Aggregations

AsyncTreeModel (com.intellij.ui.tree.AsyncTreeModel)9 Tree (com.intellij.ui.treeStructure.Tree)5 NodeRenderer (com.intellij.ide.util.treeView.NodeRenderer)2 JBScrollPane (com.intellij.ui.components.JBScrollPane)2 ContentFactory (com.intellij.ui.content.ContentFactory)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Nonnull (javax.annotation.Nonnull)2 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)1 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 OnePixelSplitter (com.intellij.ui.OnePixelSplitter)1 JBPanel (com.intellij.ui.components.JBPanel)1 NonOpaquePanel (com.intellij.ui.components.panels.NonOpaquePanel)1 StructureTreeModel (com.intellij.ui.tree.StructureTreeModel)1 SimpleTree (com.intellij.ui.treeStructure.SimpleTree)1 EditSourceOnDoubleClickHandler (com.intellij.util.EditSourceOnDoubleClickHandler)1 InvokerSupplier (com.intellij.util.concurrency.InvokerSupplier)1 MutableModelSynchronizer (com.redhat.devtools.intellij.common.tree.MutableModelSynchronizer)1 TektonTreeDoubleClickListener (com.redhat.devtools.intellij.tektoncd.listener.TektonTreeDoubleClickListener)1 TektonTreePopupMenuListener (com.redhat.devtools.intellij.tektoncd.listener.TektonTreePopupMenuListener)1 MutableTektonModelSynchronizer (com.redhat.devtools.intellij.tektoncd.tree.MutableTektonModelSynchronizer)1