private void stopMonitoringProgress(boolean cancel) {
      try {
        myProgressIndicatorLock.lock();
        if (myProgressCheckingFuture != null) {
          myProgressCheckingFuture.cancel(true);
        }

        if (myProgressIndicator.isRunning()) {
          if (cancel) {
            myProgressIndicator.cancel();
          }
          else {
            myProgressIndicator.stop();
          }
        }

        myProgressCheckingFuture = null;
      }
      finally {
        myProgressIndicatorLock.unlock();
      }
    }
private void stopMonitoringProgress(boolean cancel)