Java 类com.intellij.openapi.ui.NonEmptyInputValidator 实例源码

项目:Dependency-Injection-Graph    文件:SetPackageFilter.java   
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    Project project = anActionEvent.getProject();

    if (project != null) {

        String packageName = Messages.showInputDialog(
                Strings.MESSAGE_ASK_PACKAGE_NAME_TO_FILTER,
                Strings.TITLE_ASK_PACKAGE_NAME_TO_FILTER,
                Messages.getQuestionIcon(),
                PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME),
                new NonEmptyInputValidator());

        if (!TextUtils.isEmpty(packageName)) {
            PropertiesManager.putData(project, PropertyKeys.PACKAGE_NAME, packageName);
        }
    }
}
项目:idea-php-spryker-plugin    文件:ClientPluginAction.java   
@NotNull
@Override
protected PsiElement[] invokeDialog(Project project, PsiDirectory psiDirectory) {
    HashMap<String,String> classConfig = new HashMap<>();

    String controllerName = Messages.showInputDialog(
            "Set Plugin Name",
            "Input Plugin Name",
            Messages.getQuestionIcon(),
            "",
            new NonEmptyInputValidator()
    );

    if (StringUtils.isBlank(controllerName)) {
        PsiElement[] psiElements = new PsiElement[1];

        return psiElements;
    }

    classConfig.put(SprykerConstants.CLASS_NAME, controllerName);

    return this.createClassType(project, psiDirectory, classConfig);
}
项目:idea-php-spryker-plugin    文件:ZedControllerAction.java   
@NotNull
@Override
protected PsiElement[] invokeDialog(Project project, PsiDirectory psiDirectory) {
    HashMap<String,String> classConfig = new HashMap<>();

    String controllerName = Messages.showInputDialog(
            "Set Controller Name",
            "Input Controller Name",
            Messages.getQuestionIcon(),
            "",
            new NonEmptyInputValidator()
    );

    if (StringUtils.isBlank(controllerName)) {
        PsiElement[] psiElements = new PsiElement[1];

        return psiElements;
    }

    classConfig.put(SprykerConstants.CLASS_NAME, controllerName);

    return this.createClassType(project, psiDirectory, classConfig);
}
项目:idea-php-spryker-plugin    文件:ZedPluginAction.java   
@NotNull
@Override
protected PsiElement[] invokeDialog(Project project, PsiDirectory psiDirectory) {
    HashMap<String,String> classConfig = new HashMap<>();

    String controllerName = Messages.showInputDialog(
            "Set Plugin Name",
            "Input Plugin Name",
            Messages.getQuestionIcon(),
            "",
            new NonEmptyInputValidator()
    );

    if (StringUtils.isBlank(controllerName)) {
        PsiElement[] psiElements = new PsiElement[1];

        return psiElements;
    }

    classConfig.put(SprykerConstants.CLASS_NAME, controllerName);

    return this.createClassType(project, psiDirectory, classConfig);
}
项目:idea-php-spryker-plugin    文件:YvesPluginAction.java   
@NotNull
@Override
protected PsiElement[] invokeDialog(Project project, PsiDirectory psiDirectory) {
    HashMap<String,String> classConfig = new HashMap<>();

    String controllerName = Messages.showInputDialog(
            "Set Plugin Name",
            "Input Plugin Name",
            Messages.getQuestionIcon(),
            "",
            new NonEmptyInputValidator()
    );

    if (StringUtils.isBlank(controllerName)) {
        PsiElement[] psiElements = new PsiElement[1];

        return psiElements;
    }

    classConfig.put(SprykerConstants.CLASS_NAME, controllerName);

    return this.createClassType(project, psiDirectory, classConfig);
}
项目:idea-php-spryker-plugin    文件:YvesControllerAction.java   
@NotNull
@Override
protected PsiElement[] invokeDialog(Project project, PsiDirectory psiDirectory) {
    HashMap<String,String> classConfig = new HashMap<>();

    String controllerName = Messages.showInputDialog(
            "Set Controller Name",
            "Input Controller Name",
            Messages.getQuestionIcon(),
            "",
            new NonEmptyInputValidator()
    );

    if (StringUtils.isBlank(controllerName)) {
        PsiElement[] psiElements = new PsiElement[1];

        return psiElements;
    }

    classConfig.put(SprykerConstants.CLASS_NAME, controllerName);

    return this.createClassType(project, psiDirectory, classConfig);
}
项目:intellij-ce-playground    文件:BaseLibrariesConfigurable.java   
@Override
public void actionPerformed(final AnActionEvent e) {
  final Object o = getSelectedObject();
  if (o instanceof LibraryEx) {
    final LibraryEx selected = (LibraryEx)o;
    final String newName = Messages.showInputDialog("Enter library name:", "Copy Library", null, selected.getName() + "2", new NonEmptyInputValidator());
    if (newName == null) return;

    BaseLibrariesConfigurable configurable = BaseLibrariesConfigurable.this;
    final LibraryEx library = (LibraryEx)myContext.getLibrary(selected.getName(), myLevel);
    LOG.assertTrue(library != null);

    final LibrariesModifiableModel libsModel = configurable.getModelProvider().getModifiableModel();
    final Library lib = libsModel.createLibrary(newName, library.getKind());
    final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx)libsModel.getLibraryEditor(lib).getModel();
    LibraryEditingUtil.copyLibrary(library, Collections.<String, String>emptyMap(), model);
  }
}
项目:intellij.xliff    文件:CreateXLIFFTranslationAction.java   
@Override
protected void doAction(AnActionEvent e) {
    final Editor editor = e.getData(CommonDataKeys.EDITOR);
    final String selectedText = editor.getSelectionModel().getSelectedText();
    final Project project = e.getProject();
    final Pair<String, Boolean> userInputPair = Messages.showInputDialogWithCheckBox("Translation key",
                                                    "Translation key", "Preserve space?",
                                                    preserveSpaces, true, Messages.getQuestionIcon(), "", new NonEmptyInputValidator());

    preserveSpaces = userInputPair.getSecond();
    if (selectedFile != null) {
        try {
            updateTranslationDocument(userInputPair, selectedText);
            replaceSelectedTextWithViewHelper(userInputPair.getFirst(), project, editor);
        } catch (IOException | InvalidXliffFileException e1) {
            e1.printStackTrace();
            myNotificationGroup.createNotification(e1.getMessage(), NotificationType.ERROR)
                    .notify(project);
        }

    }
}
项目:tools-idea    文件:BaseLibrariesConfigurable.java   
@Override
public void actionPerformed(final AnActionEvent e) {
  final Object o = getSelectedObject();
  if (o instanceof LibraryEx) {
    final LibraryEx selected = (LibraryEx)o;
    final String newName = Messages.showInputDialog("Enter library name:", "Copy Library", null, selected.getName() + "2", new NonEmptyInputValidator());
    if (newName == null) return;

    BaseLibrariesConfigurable configurable = BaseLibrariesConfigurable.this;
    final LibraryEx library = (LibraryEx)myContext.getLibrary(selected.getName(), myLevel);
    LOG.assertTrue(library != null);

    final LibrariesModifiableModel libsModel = configurable.getModelProvider().getModifiableModel();
    final Library lib = libsModel.createLibrary(newName, library.getKind());
    final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx)libsModel.getLibraryEditor(lib).getModel();
    LibraryEditingUtil.copyLibrary(library, Collections.<String, String>emptyMap(), model);
  }
}
项目:consulo    文件:BaseLibrariesConfigurable.java   
@Override
public void actionPerformed(final AnActionEvent e) {
  final Object o = getSelectedObject();
  if (o instanceof LibraryEx) {
    final LibraryEx selected = (LibraryEx)o;
    final String newName = Messages.showInputDialog("Enter library name:", "Copy Library", null, selected.getName() + "2", new NonEmptyInputValidator());
    if (newName == null) return;

    BaseLibrariesConfigurable configurable = BaseLibrariesConfigurable.this;
    final LibraryEx library = (LibraryEx)myContext.getLibrary(selected.getName(), myLevel);
    LOG.assertTrue(library != null);

    final LibrariesModifiableModel libsModel = configurable.getModelProvider().getModifiableModel();
    final Library lib = libsModel.createLibrary(newName, library.getKind());
    final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx)libsModel.getLibraryEditor(lib).getModel();
    LibraryEditingUtil.copyLibrary(library, Collections.<String, String>emptyMap(), model);
  }
}
项目:Dependency-Injection-Graph    文件:GenerateDependencyInjectionGraph.java   
private void setPackageName(Project project) {
    String packageName = Messages.showInputDialog(
            Strings.MESSAGE_ASK_PACKAGE_NAME_TO_FILTER,
            Strings.TITLE_ASK_PACKAGE_NAME_TO_FILTER,
            Messages.getQuestionIcon(),
            PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME),
            new NonEmptyInputValidator());

    if (!TextUtils.isEmpty(packageName)) {
        this.packageName = packageName;
        PropertiesManager.putData(project, PropertyKeys.PACKAGE_NAME, packageName);
    }
}
项目:idea-php-spryker-plugin    文件:AbstractBundleAction.java   
@NotNull
@Override
protected PsiElement[] invokeDialog(Project project, PsiDirectory psiDirectory) {
    HashMap<String,String> classConfig = new HashMap<>();
    PsiElement[] psiElements = new PsiElement[1];

    String bundleName = Messages.showInputDialog(
            "Set Bundle Name",
            "Input Bundle Name",
            Messages.getQuestionIcon(),
            "",
            new NonEmptyInputValidator()
    );

    if (StringUtils.isBlank(bundleName)) {
        return psiElements;
    }

    this.project = project;

    if (psiDirectory.findSubdirectory(bundleName) != null) {
        Messages.showErrorDialog(project, "Bundle " + bundleName + " already exists!", "Error");
        return psiElements;
    }

    try {
        PsiDirectory bundleDirectory = this.createSubdirectory(psiDirectory, bundleName);
        String projectName = this.matchProjectName(psiDirectory);
        classConfig.put(SprykerConstants.BUNDLE_NAME, bundleName);
        classConfig.put(SprykerConstants.PROJECT_NAME, projectName);

        psiElements = this.createBundleClasses(project, bundleDirectory, classConfig, psiElements);
    } catch (Exception exception) {
        exception.printStackTrace();
        Messages.showErrorDialog(project, "Error:" + exception.getMessage(), "Error");
    }

    return psiElements;
}
项目:intellij-ce-playground    文件:PutLabelAction.java   
@Override
protected void showDialog(Project p, IdeaGateway gw, VirtualFile f, AnActionEvent e) {
  String labelName = Messages.showInputDialog(p, message("put.label.name"), message("put.label.dialog.title"),null,
                                              "", new NonEmptyInputValidator());
  if (labelName == null) return;
  LocalHistory.getInstance().putUserLabel(p, labelName);
}
项目:intellij-ce-playground    文件:ConfigurationManager.java   
public static @Nullable String showSaveTemplateAsDialog(@NotNull String initial, @NotNull Project project) {
  return Messages.showInputDialog(
    project,
    SSRBundle.message("template.name.button"),
    SSRBundle.message("save.template.description.button"),
    AllIcons.General.QuestionDialog,
    initial,
    new NonEmptyInputValidator()
  );
}
项目:tools-idea    文件:PutLabelAction.java   
@Override
protected void showDialog(Project p, IdeaGateway gw, VirtualFile f, AnActionEvent e) {
  String labelName = Messages.showInputDialog(p, message("put.label.name"), message("put.label.dialog.title"),null,
                                              "", new NonEmptyInputValidator());
  if (labelName == null) return;
  LocalHistory.getInstance().putUserLabel(p, labelName);
}
项目:MavenHelper    文件:ApplicationSettingsForm.java   
public static Goal showDialog(final ApplicationSettings settings1) {
    String[] goalsAsStrings = settings1.getAllGoalsAsStringArray();
    Goal o = null;
    String s = Messages.showEditableChooseDialog("Command line:", "New Goal", getQuestionIcon(), goalsAsStrings,
            "", new NonEmptyInputValidator());
    if (StringUtils.isNotBlank(s)) {
        o = new Goal(s);
    }
    return o;
}
项目:consulo    文件:PutLabelAction.java   
@Override
protected void showDialog(Project p, IdeaGateway gw, VirtualFile f, AnActionEvent e) {
  String labelName = Messages.showInputDialog(p, message("put.label.name"), message("put.label.dialog.title"),null,
                                              "", new NonEmptyInputValidator());
  if (labelName == null) return;
  LocalHistory.getInstance().putUserLabel(p, labelName);
}