private void onSelectionChanged() {
    List<ServiceViewItem> selected = getSelectedItems();

    ServiceViewItem newSelection;
    ServiceViewDescriptor newDescriptor;
    if (selected.size() == 1) {
      newSelection = selected.get(0);
      newDescriptor = newSelection.getViewDescriptor();
    }
    else {
      newSelection = null;
      ServiceViewContributor<?> contributor = getTheOnlyRootContributor(selected);
      newDescriptor = contributor == null ? null : contributor.getViewDescriptor(getProject());
    }


    if (newSelection != null && newSelection.equals(myLastSelection)) return;

    ServiceViewDescriptor oldDescriptor = myLastSelection == null ? null : myLastSelection.getViewDescriptor();
    if (Comparing.equal(newDescriptor, oldDescriptor)) return;

    if (oldDescriptor != null && mySelected) {
      oldDescriptor.onNodeUnselected();
    }

    myLastSelection = newSelection;
    myNavBarPanel.updateModel();

    if (!mySelected) return;

    if (newDescriptor != null) {
      newDescriptor.onNodeSelected(ContainerUtil.map(selected, ServiceViewItem::getValue));
    }
    if (newDescriptor != null) {
      myUi.setDetailsComponentVisible(newDescriptor.isContentPartVisible());
    }
    myUi.setDetailsComponent(newDescriptor == null ? null : newDescriptor.getContentComponent());
  }
private void onSelectionChanged()