void (List<ItemWrapper<?>> result, Map<RunnerAndConfigurationSettings, ItemWrapper<?>> existing, Project project, RunManager manager, RunnerAndConfigurationSettings selectedConfiguration) { if (!EventQueue.isDispatchThread()) { return; } final DataContext dataContext = DataManager.getInstance().getDataContext(); final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext, ActionPlaces.UNKNOWN); final List<ConfigurationFromContext> producers = PreferredProducerFind.getConfigurationsFromContext(context.getLocation(), context, false, true); if (producers == null) return; producers.sort(ConfigurationFromContext.NAME_COMPARATOR); final RunnerAndConfigurationSettings[] preferred = {null}; int i = 2; // selectedConfiguration == null ? 1 : 2; for (final ConfigurationFromContext fromContext : producers) { final RunnerAndConfigurationSettings configuration = fromContext.getConfigurationSettings(); if (existing.containsKey(configuration)) { final ItemWrapper wrapper = existing.get(configuration); if (wrapper.getMnemonic() != 1) { wrapper.setMnemonic(i); i++; } } else { if (selectedConfiguration != null && configuration.equals(selectedConfiguration)) continue; if (preferred[0] == null) { preferred[0] = configuration; } //noinspection unchecked final ItemWrapper wrapper = new ItemWrapper(configuration) { @Override public Icon getIcon() { return RunManagerEx.getInstanceEx(project).getConfigurationIcon(configuration); } @Override public String getText() { return Executor.shortenNameIfNeeded(configuration.getName()) + configuration.getConfiguration().getPresentableType(); } @Override public boolean available(Executor executor) { return ProgramRunner.getRunner(executor.getId(), configuration.getConfiguration()) != null; } @Override public void perform(@NotNull Project project, @NotNull Executor executor, @NotNull DataContext context) { manager.setTemporaryConfiguration(configuration); RunManager.getInstance(project).setSelectedConfiguration(configuration); ExecutionUtil.doRunConfiguration(configuration, executor, null, null, context); } @Override public PopupStep getNextStep(final @NotNull Project project, final @NotNull ChooseRunConfigurationPopup action) { return new ConfigurationActionsStep(project, action, configuration, isDynamic()); } @Override public boolean hasActions() { return true; } }; wrapper.setDynamic(true); wrapper.setMnemonic(i); result.add(wrapper); i++; } } }