public void setProviders(
      List<FrameworkSupportInModuleProvider> providers,
      Set<String> associated,
      Set<String> preselected) {
    myProviders = providers;

    myAssociatedFrameworks = createNodes(myProviders, associated, preselected);
    for (FrameworkSupportNodeBase node : myRoots) {
      if (preselected.contains(node.getId())) {
        node.setChecked(true);
      }
    }
    setAssociatedFrameworks();

    myFrameworksTree.setRoots(myRoots);
    myFrameworksTree.setSelectionRow(0);
  }
  private void onSelectionChanged() {
    if (!myFrameworksTree.isProcessingMouseEventOnCheckbox()) {
      updateOptionsPanel();
    }

    final FrameworkSupportNodeBase selectedNode = getSelectedNode();
    if (!Comparing.equal(selectedNode, myLastSelectedNode)) {
      applyLibraryOptionsForSelected();

      myLastSelectedNode = selectedNode;
    }
  }
  public AddSupportForFrameworksPanel(
      final List<FrameworkSupportInModuleProvider> providers,
      final FrameworkSupportModelBase model,
      boolean vertical,
      @Nullable JPanel associatedFrameworksPanel) {
    myModel = model;
    myAssociatedFrameworksPanel = associatedFrameworksPanel;
    myLibrariesContainer = model.getLibrariesContainer();

    myLabel.setVisible(!vertical);
    Splitter splitter =
        vertical ? new Splitter(true, 0.6f, 0.2f, 0.8f) : new Splitter(false, 0.3f, 0.3f, 0.7f);
    splitter.setHonorComponentsMinimumSize(false);
    myFrameworksTree =
        new FrameworksTree(model) {
          @Override
          protected void onNodeStateChanged(CheckedTreeNode node) {
            if (!(node instanceof FrameworkSupportNode)) return;

            final FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode) node;
            if (frameworkSupportNode == getSelectedNode()) {
              updateOptionsPanel();
            }
            final FrameworkSupportInModuleConfigurable configurable =
                frameworkSupportNode.getConfigurable();
            configurable.onFrameworkSelectionChanged(node.isChecked());
            myModel.onFrameworkSelectionChanged(frameworkSupportNode);
            onFrameworkStateChanged();
          }
        };
    model.addFrameworkVersionListener(
        new FrameworkVersionListener() {
          @Override
          public void versionChanged(FrameworkVersion version) {
            ((DefaultTreeModel) myFrameworksTree.getModel()).nodeChanged(getSelectedNode());
          }
        },
        this);

    myFrameworksTree.addTreeSelectionListener(
        new TreeSelectionListener() {
          public void valueChanged(TreeSelectionEvent e) {
            onSelectionChanged();
          }
        });

    JPanel treePanel = new JPanel(new BorderLayout());
    treePanel.add(ScrollPaneFactory.createScrollPane(myFrameworksTree), BorderLayout.CENTER);
    treePanel.setMinimumSize(new Dimension(200, 300));

    splitter.setFirstComponent(treePanel);
    myOptionsPanel = new JPanel(new CardLayout());
    JPanel emptyCard = new JPanel();
    emptyCard.setPreferredSize(new Dimension(400, 100));
    myOptionsPanel.add(EMPTY_CARD, emptyCard);

    splitter.setSecondComponent(myOptionsPanel);
    myFrameworksPanel.add(splitter, BorderLayout.CENTER);

    setProviders(providers);
  }
 @Nullable
 public FrameworkSupportNodeBase getSelectedNode() {
   final FrameworkSupportNodeBase[] nodes =
       myFrameworksTree.getSelectedNodes(FrameworkSupportNodeBase.class, null);
   return nodes.length == 1 ? nodes[0] : null;
 }