@Override
 public void cancelTask(@NotNull DumbModeTask task) {
   if (ApplicationManager.getApplication().isInternal()) LOG.info("cancel " + task);
   ProgressIndicatorEx indicator = myProgresses.get(task);
   if (indicator != null) {
     indicator.cancel();
   }
 }
 @Override
 protected void cancelRequest() {
   myOriginal.cancel();
 }
 public MyInlineProgressIndicator(
     final boolean compact, @NotNull TaskInfo task, @NotNull ProgressIndicatorEx original) {
   super(compact, task);
   myOriginal = original;
   original.addStateDelegate(this);
 }
Exemple #4
0
  private void addIndicatorDelegate() {
    ProgressIndicator indicator = myIndicator;
    if (!(indicator instanceof ProgressIndicatorEx)) return;
    ((ProgressIndicatorEx) indicator)
        .addStateDelegate(
            new ProgressIndicatorBase() {

              public void cancel() {
                super.cancel();
                closeUI();
                stopAppIconProgress();
              }

              public void stop() {
                super.stop();
                if (!isCanceled()) {
                  closeUI();
                }
                stopAppIconProgress();
              }

              private void stopAppIconProgress() {
                UIUtil.invokeLaterIfNeeded(
                    new Runnable() {
                      public void run() {
                        AppIcon appIcon = AppIcon.getInstance();
                        if (appIcon.hideProgress(myProject, APP_ICON_ID)) {
                          if (myErrorCount > 0) {
                            appIcon.setErrorBadge(myProject, String.valueOf(myErrorCount));
                            appIcon.requestAttention(myProject, true);
                          } else if (!myCompilationStartedAutomatically) {
                            appIcon.setOkBadge(myProject, true);
                            appIcon.requestAttention(myProject, false);
                          }
                        }
                      }
                    });
              }

              public void setText(final String text) {
                super.setText(text);
                updateProgressText();
              }

              public void setText2(final String text) {
                super.setText2(text);
                updateProgressText();
              }

              public void setFraction(final double fraction) {
                super.setFraction(fraction);
                updateProgressText();
                UIUtil.invokeLaterIfNeeded(
                    new Runnable() {
                      public void run() {
                        AppIcon.getInstance()
                            .setProgress(
                                myProject,
                                APP_ICON_ID,
                                AppIconScheme.Progress.BUILD,
                                fraction,
                                true);
                      }
                    });
              }

              protected void onProgressChange() {
                prepareMessageView();
              }
            });
  }