NullProgressMonitor.java

  1. /*
  2.  * Copyright (C) 2009, Alex Blewitt <alex.blewitt@gmail.com>
  3.  * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
  4.  * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> and others
  5.  *
  6.  * This program and the accompanying materials are made available under the
  7.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  8.  * https://www.eclipse.org/org/documents/edl-v10.php.
  9.  *
  10.  * SPDX-License-Identifier: BSD-3-Clause
  11.  */

  12. package org.eclipse.jgit.lib;

  13. /**
  14.  * A NullProgressMonitor does not report progress anywhere.
  15.  */
  16. public class NullProgressMonitor implements ProgressMonitor {
  17.     /** Immutable instance of a null progress monitor. */
  18.     public static final NullProgressMonitor INSTANCE = new NullProgressMonitor();

  19.     private NullProgressMonitor() {
  20.         // Do not let others instantiate
  21.     }

  22.     /** {@inheritDoc} */
  23.     @Override
  24.     public void start(int totalTasks) {
  25.         // Do not report.
  26.     }

  27.     /** {@inheritDoc} */
  28.     @Override
  29.     public void beginTask(String title, int totalWork) {
  30.         // Do not report.
  31.     }

  32.     /** {@inheritDoc} */
  33.     @Override
  34.     public void update(int completed) {
  35.         // Do not report.
  36.     }

  37.     /** {@inheritDoc} */
  38.     @Override
  39.     public boolean isCancelled() {
  40.         return false;
  41.     }

  42.     /** {@inheritDoc} */
  43.     @Override
  44.     public void endTask() {
  45.         // Do not report.
  46.     }
  47. }