@Override
  public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
    Component component = toolWindow.getComponent();

    changeListPanel = new GerritChangeListPanel(Lists.<ChangeInfo>newArrayList(), null);

    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);

    ActionToolbar toolbar = createToolbar();
    toolbar.setTargetComponent(changeListPanel);
    panel.setToolbar(toolbar.getComponent());

    myRepositoryChangesBrowser = createRepositoryChangesBrowser(project);

    myDetailsSplitter = new Splitter(true, 0.6f);
    myDetailsSplitter.setShowDividerControls(true);

    changeListPanel.setBorder(
        IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT | SideBorder.BOTTOM));
    myDetailsSplitter.setFirstComponent(changeListPanel);

    myDetailsPanel = new GerritChangeDetailsPanel(project);
    JPanel details = myDetailsPanel.getComponent();
    details.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.RIGHT));
    myDetailsSplitter.setSecondComponent(details);

    Splitter myHorizontalSplitter = new Splitter(false, 0.7f);
    myHorizontalSplitter.setShowDividerControls(true);
    myHorizontalSplitter.setFirstComponent(myDetailsSplitter);
    myHorizontalSplitter.setSecondComponent(myRepositoryChangesBrowser);

    panel.setContent(myHorizontalSplitter);

    component.getParent().add(panel);

    reloadChanges(project, false);

    setupRefreshTask(project);
  }
  public GenerateByPatternDialog(Project project, PatternDescriptor[] descriptors) {
    super(project);
    myProject = project;
    setTitle("Generate by Pattern");
    setOKButtonText("Generate");

    myMap = new MultiMap<>();
    for (PatternDescriptor descriptor : descriptors) {
      myMap.putValue(descriptor.getParentId(), descriptor);
    }
    DefaultMutableTreeNode root = createNode(null);

    myTree = new SimpleTree() {};

    myTree.setRootVisible(false);
    myTree.setCellRenderer(
        new DefaultTreeCellRenderer() {
          @NotNull
          @Override
          public Component getTreeCellRendererComponent(
              @NotNull JTree tree,
              Object value,
              boolean sel,
              boolean expanded,
              boolean leaf,
              int row,
              boolean hasFocus) {
            Component component =
                super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);

            Object object = ((DefaultMutableTreeNode) value).getUserObject();
            if (object instanceof PatternDescriptor) {
              setText(((PatternDescriptor) object).getName());
              setIcon(((PatternDescriptor) object).getIcon());
            }
            return component;
          }
        });

    myTree.setModel(new DefaultTreeModel(root));
    myTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              @Override
              public void valueChanged(@NotNull TreeSelectionEvent e) {
                update();
              }
            });
    myEditor = TemplateEditorUtil.createEditor(true, "");

    mySplitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myTree));
    JPanel details = new JPanel(new BorderLayout());
    details.add(myEditor.getComponent(), BorderLayout.CENTER);
    mySplitter.setSecondComponent(details);
    mySplitter.setHonorComponentsMinimumSize(true);
    mySplitter.setShowDividerControls(true);

    myTree.setSelectionRow(0);

    init();
  }