void () { myMessageLabel.setIcon(null); myConfigureButton.setVisible(true); final LibraryDownloadSettings settings = mySettings.getDownloadSettings(); myDownloadRadioButton.setVisible(settings != null); myUseFromProviderRadioButton.setVisible(myLibraryProvider != null); if (!myUseFromProviderRadioButton.isVisible() && myUseFromProviderRadioButton.isSelected()) { if (myDownloadRadioButton.isVisible()) { myDownloadRadioButton.setSelected(true); } else { myUseLibraryRadioButton.setSelected(true); } } if (!myDownloadRadioButton.isVisible() && myDownloadRadioButton.isSelected() && myUseLibraryRadioButton.isVisible()) { myUseLibraryRadioButton.setSelected(true); } String message = ""; boolean showConfigurePanel = true; switch (myButtonEnumModel.getSelected()) { case DOWNLOAD -> message = getDownloadFilesMessage(); case USE_FROM_PROVIDER -> { if (myLibraryProvider != null) { message = JavaUiBundle.message("library.options.panel.update.state.library.from.0.will.be.used", myLibraryProvider.getPresentableName()); } myConfigureButton.setVisible(false); } case USE_LIBRARY -> { final Object item = myExistingLibraryComboBox.getSelectedItem(); if (item == null) { myMessageLabel.setIcon(AllIcons.General.BalloonError); message = JavaUiBundle.message("library.options.panel.update.state.error.library.is.not.specified"); myConfigureButton.setVisible(false); } else if (item instanceof NewLibraryEditor) { final LibraryEditor libraryEditor = (LibraryEditor)item; message = JavaUiBundle.message("label.library.will.be.created.description.text", mySettings.getNewLibraryLevel(), libraryEditor.getName(), libraryEditor.getFiles(OrderRootType.CLASSES).length); } else { message = JavaUiBundle.message("label.existing.library.will.be.used", ((ExistingLibraryEditor)item).getName()); } } default -> showConfigurePanel = false; } if (myLibraryProvider != null) { myUseFromProviderRadioButton.setText(JavaUiBundle.message("radio.button.use.library.from.0", myLibraryProvider.getPresentableName())); } //show the longest message on the hidden card to ensure that dialog won't jump if user selects another option if (mySettings.getDownloadSettings() != null) { myHiddenLabel.setText(getDownloadFilesMessage()); } else { myHiddenLabel.setText(JavaUiBundle.message("label.library.will.be.created.description.text", mySettings.getNewLibraryLevel(), "name", 10)); } ((CardLayout)myConfigurationPanel.getLayout()).show(myConfigurationPanel, showConfigurePanel ? "configure" : "empty"); myMessageLabel.setText(XmlStringUtil.wrapInHtml(message)); }