[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();
        }

3.
progressManager.getInstance().
                runProcessWithProgressSynchronously(new
                                      Runnable() {
                                          public void run() {
                                              ProgressIndicator progressIndicator =  ProgressManager.getInstance().getProgressIndicator();
                                              progressIndicator.setFraction(0.1);
                                              ....
                                              progressIndicator.setFraction(0.8);
                                             ....

                                             ....
                                             ....
                                              progressIndicator.setFraction(1.0);
                                           
                                          }
                                      }, "title", true, project);
1 comment

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.

0

Please sign in to leave a comment.