private void addIndicatorDelegate(ProgressIndicator indicator) {
    if (!(indicator instanceof ProgressIndicatorEx)) {
      return;
    }
    ((ProgressIndicatorEx)indicator).addStateDelegate(new DummyProgressIndicator() {
      @Override
      public void cancel() {
        selectFirstMessage();
      }

      @Override
      public void stop() {
        if (!isCanceled()) {
          selectFirstMessage();
        }
      }
    });
  }
private void addIndicatorDelegate(ProgressIndicator indicator)