private static void createNewFolder(FileSystemTree fileSystemTree) { final VirtualFile file = fileSystemTree.getNewFileParent(); if (file == null || !file.isDirectory()) return; final InputValidatorEx validator = new NewFolderValidator(file); final String newFolderName = Messages.showInputDialog(UIBundle.message("create.new.folder.enter.new.folder.name.prompt.text"), UIBundle.message("new.folder.dialog.title"), Messages.getQuestionIcon(), "", validator); if (newFolderName == null) { return; } Exception failReason = ((FileSystemTreeImpl)fileSystemTree).createNewFolder(file, newFolderName); if (failReason != null) { Messages.showMessageDialog(UIBundle.message("create.new.folder.could.not.create.folder.error.message", newFolderName), UIBundle.message("error.dialog.title"), Messages.getErrorIcon()); } }
protected MyDialog(@NotNull AndroidFacet facet, @Nullable InputValidator validator) { super(facet.getModule().getProject()); myValidator = validator; setTitle(AndroidBundle.message("new.typed.resource.dialog.title", myResourcePresentableName)); final List<String> tagNames = getSortedAllowedTagNames(facet); myRootElementField = new TextFieldWithAutoCompletion<String>( facet.getModule().getProject(), new TextFieldWithAutoCompletion.StringsCompletionProvider(tagNames, null), true, null); myRootElementField.setText(myDefaultRootTag); myRootElementFieldWrapper.add(myRootElementField, BorderLayout.CENTER); myRootElementLabel.setLabelFor(myRootElementField); init(); myFileNameField.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void textChanged(DocumentEvent event) { final String text = myFileNameField.getText().trim(); if (myValidator instanceof InputValidatorEx) { setErrorText(((InputValidatorEx) myValidator).getErrorText(text)); } } }); }