boolean (@NotNull Configuration newConfiguration) { Pair<@NlsSafe String, Boolean> nameAndProject = showInputDialog(newConfiguration.getName()); while (nameAndProject.first != null && (nameAndProject.second ? myProjectState : myIdeState).get(nameAndProject.first) != null) { final int answer = Messages.showYesNoDialog( myProject, SSRBundle.message("overwrite.message"), SSRBundle.message("overwrite.title", nameAndProject.first), SSRBundle.message("button.replace"), Messages.getCancelButton(), Messages.getQuestionIcon() ); if (answer == Messages.YES) { break; } nameAndProject = showInputDialog(nameAndProject.first); } if (nameAndProject.first != null) { newConfiguration.setName(nameAndProject.first); newConfiguration.setUuid(null); myLastSaveWasInProject = nameAndProject.second; (nameAndProject.second ? myProjectState : myIdeState).add(newConfiguration.copy()); return true; } return false; }