[Plugin Dev]How to handler a cancel event.

Hi all:

      I have trouble in deal with the cancel button event on these following situations.All of these cancel button do not work. Can anybody give me a solution?Thanks.

1.Messages.showInputDialog(project, "title", "name", Messages.getQuestionIcon(), "name", new InputValidator() {

            public boolean checkInput(String input) {

                if (StringUtils.length(input) > 255 || StringUtils.length(input) <= 0) {

                    return false;


                return true;


            public boolean canClose(String s) {

                return true;



2.VirtualFile[] files = FileChooser.chooseFiles(FileChooserDescriptorFactory.createSingleFolderDescriptor(), event.getProject(), null);
        if (files.length > 0) {
            path = files[0].getPath();

                                      Runnable() {
                                          public void run() {
                                              ProgressIndicator progressIndicator =  ProgressManager.getInstance().getProgressIndicator();

                                      }, "title", true, project);
1 comment
Comment actions Permalink

What exactly do you mean by "cancel buttons don't work"? With showInputDialog() and chooseFiles(), the methods will return null if the user presses Cancel. In the ProgressIndicator case, it's your responsibility to call ProgressIndicator.isCanceled() or checkCanceled() and stop the processing.


Please sign in to leave a comment.