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