You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProgressMonitor.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
  3. * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> and others
  4. *
  5. * This program and the accompanying materials are made available under the
  6. * terms of the Eclipse Distribution License v. 1.0 which is available at
  7. * https://www.eclipse.org/org/documents/edl-v10.php.
  8. *
  9. * SPDX-License-Identifier: BSD-3-Clause
  10. */
  11. package org.eclipse.jgit.lib;
  12. /**
  13. * A progress reporting interface.
  14. */
  15. public interface ProgressMonitor {
  16. /** Constant indicating the total work units cannot be predicted. */
  17. int UNKNOWN = 0;
  18. /**
  19. * Advise the monitor of the total number of subtasks.
  20. * <p>
  21. * This should be invoked at most once per progress monitor interface.
  22. *
  23. * @param totalTasks
  24. * the total number of tasks the caller will need to complete
  25. * their processing.
  26. */
  27. void start(int totalTasks);
  28. /**
  29. * Begin processing a single task.
  30. *
  31. * @param title
  32. * title to describe the task. Callers should publish these as
  33. * stable string constants that implementations could match
  34. * against for translation support.
  35. * @param totalWork
  36. * total number of work units the application will perform;
  37. * {@link #UNKNOWN} if it cannot be predicted in advance.
  38. */
  39. void beginTask(String title, int totalWork);
  40. /**
  41. * Denote that some work units have been completed.
  42. * <p>
  43. * This is an incremental update; if invoked once per work unit the correct
  44. * value for our argument is <code>1</code>, to indicate a single unit of
  45. * work has been finished by the caller.
  46. *
  47. * @param completed
  48. * the number of work units completed since the last call.
  49. */
  50. void update(int completed);
  51. /**
  52. * Finish the current task, so the next can begin.
  53. */
  54. void endTask();
  55. /**
  56. * Check for user task cancellation.
  57. *
  58. * @return true if the user asked the process to stop working.
  59. */
  60. boolean isCancelled();
  61. }