use of com.redhat.devtools.intellij.tektoncd.listener.TektonTreePopupMenuListener 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));
}
}
Aggregations