void () { myInstallButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { final Object pyPackage = myPackages.getSelectedValue(); if (pyPackage instanceof RepoPackage repoPackage) { String extraOptions = null; if (myOptionsCheckBox.isEnabled() && myOptionsCheckBox.isSelected()) { extraOptions = myOptionsField.getText(); } String version = null; if (myVersionCheckBox.isEnabled() && myVersionCheckBox.isSelected()) { version = (String) myVersionComboBox.getSelectedItem(); } final PackageManagementService.Listener listener = new PackageManagementService.Listener() { @Override public void operationStarted(final String packageName) { if (!ApplicationManager.getApplication().isDispatchThread()) { ApplicationManager.getApplication().invokeLater(() -> handleInstallationStarted(packageName), ModalityState.stateForComponent(myMainPanel)); } else { handleInstallationStarted(packageName); } } @Override public void operationFinished(final String packageName, @Nullable final PackageManagementService.ErrorDescription errorDescription) { if (!ApplicationManager.getApplication().isDispatchThread()) { ApplicationManager.getApplication().invokeLater(() -> handleInstallationFinished(packageName, errorDescription), ModalityState.stateForComponent(myMainPanel)); } else { handleInstallationFinished(packageName, errorDescription); } } }; myController.installPackage(repoPackage, version, false, extraOptions, listener, myInstallToUser.isSelected()); myInstallButton.setEnabled(false); } PackageManagementUsageCollector.triggerInstallPerformed(myProject, myController); } }); }