HgPromptChoice (@NotNull final String message, final HgPromptChoice @NotNull [] choices, @NotNull final HgPromptChoice defaultChoice) { Matcher localDelMatcher = LOCAL_DELETE_REMOTE_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); Matcher localModifyMatcher = REMOTE_DELETE_LOCAL_MODIFIED_CONFLICT_MESSAGE_PATTERN.matcher(message); String filename; final String modifiedMessage; if (localDelMatcher.matches()) { filename = localDelMatcher.group(1); modifiedMessage = HgBundle.message("hg4idea.delete.modify.file.deleted.locally", filename); } else if (localModifyMatcher.matches()) { filename = localModifyMatcher.group(1); modifiedMessage = HgBundle.message("hg4idea.delete.modify.file.deleted.remotely", filename); } else { modifiedMessage = message; } final int[] chosen = new int[]{-1}; try { EventQueue.invokeAndWait (() -> { String[] choicePresentationArray = new String[choices.length]; for (int i = 0; i < choices.length; ++i) { choicePresentationArray[i] = choices[i].toString(); } chosen[0] = Messages .showDialog(modifiedMessage, HgBundle.message("hg4idea.delete.modify.conflict.title"), choicePresentationArray, defaultChoice.getChosenIndex(), Messages.getQuestionIcon()); }); } catch (InterruptedException | InvocationTargetException e) { LOG.error(e); return defaultChoice; } return chosen[0] >= 0 ? choices[chosen[0]] : HgPromptChoice.ABORT; }