void (@NotNull AnActionButton button) { if (isUnknown()) { return; } Set<Key<?>> activeProviderKeys = getActiveProviderKeys(); DefaultActionGroup actionGroup = new DefaultActionGroup(); for (BeforeRunTaskProvider<BeforeRunTask<?>> provider : getBeforeRunTaskProviders()) { if (provider.createTask(myRunConfiguration) == null || activeProviderKeys.contains(provider.getId()) && provider.isSingleton()) { continue; } actionGroup.add(new AnAction(provider.getName(), null, provider.getIcon()) { @Override public void actionPerformed(@NotNull AnActionEvent e) { BeforeRunTask<?> task = provider.createTask(myRunConfiguration); if (task == null) { return; } provider.configureTask(button.getDataContext(), myRunConfiguration, task) .onSuccess(changed -> { if (!provider.canExecuteTask(myRunConfiguration, task)) { return; } task.setEnabled(true); Set<RunConfiguration> configurationSet = CollectionFactory.createSmallMemoryFootprintSet(); getAllRunBeforeRuns(task, configurationSet); if (configurationSet.contains(myRunConfiguration)) { JOptionPane.showMessageDialog(BeforeRunStepsPanel.this, ExecutionBundle.message("before.launch.panel.cyclic_dependency_warning", myRunConfiguration.getName(), provider.getDescription(task)), ExecutionBundle.message("warning.common.title"), JOptionPane.WARNING_MESSAGE); return; } RunConfigurationOptionUsagesCollector.logAddBeforeRunTask( myRunConfiguration.getProject(), myRunConfiguration.getType().getId(), provider.getClass()); addTask(task); myListener.fireStepsBeforeRunChanged(); }); } }); } DataContext dataContext = SimpleDataContext.builder() .add(CommonDataKeys.PROJECT, myRunConfiguration.getProject()) .add(PlatformCoreDataKeys.CONTEXT_COMPONENT, myPanel) .build(); ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(ExecutionBundle.message("add.new.before.run.task.name"), actionGroup, dataContext, false, false, false, null, -1, Conditions.alwaysTrue()); popup.show(Objects.requireNonNull(button.getPreferredPopupPoint())); }