String (final Project project, final PropertiesFile propFile, final String key) { String newName; int index = 0; do { index++; newName = key + index; } while(propFile.findPropertyByKey(newName) != null); InputValidator validator = new InputValidator() { @Override public boolean checkInput(String inputString) { return inputString.length() > 0 && propFile.findPropertyByKey(inputString) == null; } @Override public boolean canClose(String inputString) { return checkInput(inputString); } }; return Messages.showInputDialog(project, UIDesignerBundle.message("edit.text.unique.key.prompt"), UIDesignerBundle.message("edit.text.multiple.usages.title"), Messages.getQuestionIcon(), newName, validator); }