void (@NotNull AnActionEvent e, final Executor executor, @NlsContexts.PopupTitle String popupTitle, boolean canCreate) { final RemoteServer<?> server = getServer(); final ServerType<? extends ServerConfiguration> serverType = server.getType(); final DeploymentConfigurationManager configurationManager = DeploymentConfigurationManager.getInstance(myProject); final List<Object> runConfigsAndTypes = new LinkedList<>(); final List<RunnerAndConfigurationSettings> runConfigs = ContainerUtil.filter(configurationManager.getDeploymentConfigurations(serverType), settings -> { DeployToServerRunConfiguration<?, ?> configuration = (DeployToServerRunConfiguration<?, ?>)settings.getConfiguration(); return StringUtil.equals(server.getName(), configuration.getServerName()); }); runConfigsAndTypes.addAll(runConfigs); if (canCreate) { runConfigsAndTypes.addAll(server.getType().getSingletonDeploymentSourceTypes()); if (server.getType().mayHaveProjectSpecificDeploymentSources()) { runConfigsAndTypes.add(null); } } ListPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<>(popupTitle, runConfigsAndTypes) { @Override public Icon getIconFor(Object runConfigOrSourceType) { return runConfigOrSourceType != null ? serverType.getIcon() : null; } @NotNull @Override public String getTextFor(Object runConfigOrSourceType) { if (runConfigOrSourceType instanceof RunnerAndConfigurationSettings) { return ((RunnerAndConfigurationSettings)runConfigOrSourceType).getName(); } if (runConfigOrSourceType instanceof SingletonDeploymentSourceType) { String displayName = ((SingletonDeploymentSourceType)runConfigOrSourceType).getPresentableName(); return CloudBundle.message("create.new.deployment.configuration.for.singleton.type", displayName); } return CloudBundle.message("create.new.deployment.configuration.generic"); } @Override public PopupStep<?> onChosen(Object selectedRunConfigOrSourceType, boolean finalChoice) { return doFinalStep(() -> { if (selectedRunConfigOrSourceType instanceof RunnerAndConfigurationSettings) { ProgramRunnerUtil.executeConfiguration((RunnerAndConfigurationSettings)selectedRunConfigOrSourceType, executor); } else if (selectedRunConfigOrSourceType instanceof SingletonDeploymentSourceType sourceType) { configurationManager.createAndRunConfiguration(serverType, RemoteServerNode.this.getValue(), sourceType); } else { assert selectedRunConfigOrSourceType == null; configurationManager.createAndRunConfiguration(serverType, RemoteServerNode.this.getValue(), null); } }); } }); if (e.getInputEvent() instanceof MouseEvent) { popup.show(new RelativePoint((MouseEvent)e.getInputEvent())); } else { popup.showInBestPositionFor(e.getDataContext()); } }