use of com.redhat.devtools.intellij.tektoncd.ui.hub.HubModel 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.redhat.devtools.intellij.tektoncd.ui.hub.HubModel in project intellij-tekton by redhat-developer.
the class TektonHubAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent anActionEvent, TreePath path, Object selected, Tkn tkncli) {
ActionMessage telemetry = TelemetryService.instance().action(NAME_PREFIX_CRUD + "tekton hub");
ExecHelper.submit(() -> {
ParentableNode element = getElement(selected);
Project project = getEventProject(anActionEvent);
HubModel model = new HubModel(project, tkncli, element);
telemetry.send();
UIHelper.executeInUI(() -> {
HubDialog wizard = new HubDialog(project, model);
wizard.setModal(false);
wizard.show();
return wizard;
});
});
}
Aggregations