void (@NotNull Component component, @NotNull Point point) { List<PopupItem> remotes = getPopupItems(); if (remotes.size() <= 1) { return; } ListPopup popup = new ListPopupImpl(myProject, new BaseListPopupStep<>(null, remotes) { @Override public PopupStep onChosen(@NotNull PopupItem selectedValue, boolean finalChoice) { return doFinalStep(() -> { if (selectedValue.isDefineRemote()) { showDefineRemoteDialog(); } else { myRemoteRenderer.updateLinkText(selectedValue.getPresentable()); myEventFromRemoteChooser = true; if (!myTargetEditor.isShowing()) { if (!myBranchWasUpdatedManually) { String defaultPushTargetBranch = getDefaultPushTargetBranch(); if (defaultPushTargetBranch != null) { myTargetEditor.setText(defaultPushTargetBranch); } } if (myFireOnChangeAction != null) { //fireOnChange only when editing completed myFireOnChangeAction.run(); } } myEventFromRemoteChooser = false; } }); } @Override public @Nullable ListSeparator getSeparatorAbove(PopupItem value) { return value.isDefineRemote() ? new ListSeparator() : null; } }) { @Override public void cancel(InputEvent e) { super.cancel(e); if (myTargetEditor.isShowing()) { //repaint and force move focus to target editor component GitPushTargetPanel.this.repaint(); IdeFocusManager.getInstance(myProject).requestFocus(myTargetEditor, true); } } }; popup.show(new RelativePoint(component, point)); }