void (final boolean isLocal, @NlsContexts.DialogTitle String title, final PackageSet set) { NamedScopesHolder holder = isLocal ? myLocalScopesManager : mySharedScopesManager; final String newName = Messages.showInputDialog(myTree, IdeBundle.message("add.scope.name.label"), title, Messages.getInformationIcon(), createUniqueName(), new InputValidator() { @Override public boolean checkInput(String inputString) { for (NamedScope scope : holder.getPredefinedScopes()) { if (Comparing.strEqual(scope.getScopeId(), inputString.trim())) { return false; } } return inputString.trim().length() > 0; } @Override public boolean canClose(String inputString) { return checkInput(inputString); } }); if (newName != null) { addNewScope(holder.createScope(newName, set), isLocal); } }