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);
}
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));
}
}
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;
}
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;
}
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);
}
}
Aggregations