Example usage for com.intellij.openapi.ui Messages showDialog

List of usage examples for com.intellij.openapi.ui Messages showDialog

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages showDialog.

Prototype

public static int showDialog(String message,
        @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title, String @NotNull [] options,
        int defaultOptionIndex, int focusedOptionIndex, @Nullable Icon icon,
        @Nullable DialogWrapper.DoNotAskOption doNotAskOption) 

Source Link

Document

Use this method only if you do not know project or component

Usage

From source file:com.intellij.dvcs.branch.DvcsTaskHandler.java

License:Apache License

@Override
public TaskInfo startNewTask(@NotNull final String taskName) {
    List<R> repositories = myRepositoryManager.getRepositories();
    List<R> problems = ContainerUtil.filter(repositories, new Condition<R>() {
        @Override//from   w  w w.j  a v a2 s  .co m
        public boolean value(R repository) {
            return hasBranch(repository, taskName);
        }
    });
    MultiMap<String, String> map = new MultiMap<String, String>();
    if (!problems.isEmpty()) {
        if (ApplicationManager.getApplication().isUnitTestMode() || Messages.showDialog(myProject,
                "<html>The following repositories already have specified " + myBranchType + "<b>" + taskName
                        + "</b>:<br>" + StringUtil.join(problems, "<br>") + ".<br>"
                        + "Do you want to checkout existing " + myBranchType + "?",
                myBranchType + " Already Exists", new String[] { Messages.YES_BUTTON, Messages.NO_BUTTON }, 0,
                Messages.getWarningIcon(),
                new DialogWrapper.PropertyDoNotAskOption("git.checkout.existing.branch")) == 0) {
            checkout(taskName, problems, null);
            fillMap(taskName, problems, map);
        }
    }
    repositories.removeAll(problems);
    if (!repositories.isEmpty()) {
        checkoutAsNewBranch(taskName, repositories);
    }

    fillMap(taskName, repositories, map);
    return new TaskInfo(map);
}

From source file:com.intellij.execution.TerminateRemoteProcessDialog.java

License:Apache License

public static int show(final Project project, final String sessionName, final TerminateOption option) {
    final String message = option.myAlwaysUseDefault && !option.myDetach
            ? ExecutionBundle.message("terminate.process.confirmation.text", sessionName)
            : ExecutionBundle.message("disconnect.process.confirmation.text", sessionName);
    final String okButtonText = option.myAlwaysUseDefault && !option.myDetach
            ? ExecutionBundle.message("button.terminate")
            : ExecutionBundle.message("button.disconnect");
    final String[] options = new String[] { okButtonText, CommonBundle.getCancelButtonText() };
    return Messages.showDialog(project, message,
            ExecutionBundle.message("process.is.running.dialog.title", sessionName), options, 0,
            Messages.getWarningIcon(), option);
}