class IntelliJStackTraceGroup implements StackTraceGroup {

  @Override
  @NotNull
  public StackTraceView createStackView(@NotNull StackTraceModel model) {
    IntelliJStackTraceView view = myViewGenerator.apply(myProject, model);
    myStackTraceViews.add(view);

    view.addListSelectionListener(new ListSelectionListener() {
      @Override
      public void valueChanged(ListSelectionEvent e) {
        // Ignore when a view had its selection cleared, since that shouldn't affect other views
        // in the group (and may have even been externally caused by another one)
        if (((JList)e.getSource()).getSelectedIndex() < 0) {
          return;
        }

        myStackTraceViews.forEach(otherView -> {
          if (otherView != view) {
            otherView.clearSelection();
          }
        });
      }
    });

    return view;
  }

  public  IntelliJStackTraceGroup(@NotNull Project project);
  @VisibleForTesting  IntelliJStackTraceGroup(@NotNull Project project,
                          @NotNull BiFunction<Project, StackTraceModel, IntelliJStackTraceView> viewGenerator);

}