Search in sources :

Example 1 with MutableModelSynchronizer

use of com.redhat.devtools.intellij.common.tree.MutableModelSynchronizer 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

NodeRenderer (com.intellij.ide.util.treeView.NodeRenderer)1 JBPanel (com.intellij.ui.components.JBPanel)1 JBScrollPane (com.intellij.ui.components.JBScrollPane)1 ContentFactory (com.intellij.ui.content.ContentFactory)1 AsyncTreeModel (com.intellij.ui.tree.AsyncTreeModel)1 Tree (com.intellij.ui.treeStructure.Tree)1 MutableModelSynchronizer (com.redhat.devtools.intellij.common.tree.MutableModelSynchronizer)1 BorderLayout (java.awt.BorderLayout)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ApplicationsTreeStructure (org.jboss.tools.intellij.openshift.tree.application.ApplicationsTreeStructure)1