private void updateLibrariesList() {
    LibraryId id = getCompilerLibraryId();

    LibraryDescriptor[] items =
        (LibraryDescriptor[]) LibraryDescriptor.compilersFor(myEditorContext.getProject());
    DefaultComboBoxModel model = new DefaultComboBoxModel(items);
    model.insertElementAt(null, 0);
    myCompilerLibrary.setModel(model);
    myLibraryRenderer.setPrefixLength(lastIndexOfProperItemIn(items) + 1);

    setCompilerLibraryById(id);
  }
  public FacetConfigurationEditor(
      ConfigurationData data,
      FacetEditorContext editorContext,
      FacetValidatorsManager validatorsManager) {
    myData = data;
    myEditorContext = editorContext;
    myValidatorsManager = validatorsManager;

    myDebuggingInfoLevel.setModel(new DefaultComboBoxModel(DebuggingInfoLevel.values()));
    myLibraryRenderer = new LibraryRenderer(myCompilerLibrary);
    myCompilerLibrary.setRenderer(myLibraryRenderer);

    myEnableWarnings.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            updateCheckboxesState();
          }
        });

    myFSCRadioButton.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            updateCompilerSection();
          }
        });

    CompilerPluginsTableModel model = new CompilerPluginsTableModel();
    model.setItems(myPlugins);
    tablePlugins.setModel(model);

    addButton.setAction(myAddPluginAction);
    removeButton.setAction(myRemovePluginAction);
    editButton.setAction(myEditPluginAction);
    moveUpButton.setAction(myMoveUpPluginAction);
    moveDownButton.setAction(myMoveDownPluginAction);

    myAddPluginAction.registerOn(panelPlugins);
    myRemovePluginAction.registerOn(tablePlugins);
    myEditPluginAction.registerOn(tablePlugins);
    myMoveUpPluginAction.registerOn(tablePlugins);
    myMoveDownPluginAction.registerOn(tablePlugins);

    ListSelectionModel selectionModel = tablePlugins.getSelectionModel();
    selectionModel.addListSelectionListener(myAddPluginAction);
    selectionModel.addListSelectionListener(myRemovePluginAction);
    selectionModel.addListSelectionListener(myEditPluginAction);
    selectionModel.addListSelectionListener(myMoveUpPluginAction);
    selectionModel.addListSelectionListener(myMoveDownPluginAction);

    tablePlugins.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
              myEditPluginAction.perform();
            }
          }
        });

    myValidatorsManager.registerValidator(
        new FacetEditorValidator() {
          @Override
          public ValidationResult check() {
            ValidationResult libraryResult =
                myFSCRadioButton.isSelected()
                    ? ValidationResult.OK
                    : checkCompilerLibrary((LibraryDescriptor) myCompilerLibrary.getSelectedItem());

            ValidationResult continuationsResult =
                myEnableContinuations.isSelected()
                    ? checkContinuationsPlugin(getPluginsModel().getItems())
                    : ValidationResult.OK;

            return conjunctionOf(libraryResult, continuationsResult);
          }
        },
        myCompilerLibrary,
        myFSCRadioButton,
        myEnableContinuations,
        tablePlugins);

    myAddPluginAction.update();
    myRemovePluginAction.update();
    myEditPluginAction.update();
    myMoveUpPluginAction.update();
    myMoveDownPluginAction.update();

    myFscSettings.setListener(
        new LinkListener() {
          public void linkSelected(LinkLabel aSource, Object aLinkData) {
            ShowSettingsUtil.getInstance()
                .showSettingsDialog(myEditorContext.getProject(), "Scala Compiler");
          }
        },
        null);
  }