2 * Copyright (C) 2007 Robin Rosenberg
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License, version 2, as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17 package org
.spearce
.jgit
.lib
;
19 /** A progress reporting interface. */
20 public interface ProgressMonitor
{
21 /** Constant indicating the total work units cannot be predicted. */
22 public static final int UNKNOWN
= 0;
25 * Advise the monitor of the total number of subtasks.
27 * This should be invoked at most once per progress monitor interface.
30 * the total number of tasks the caller will need to complete
33 void start(int totalTasks
);
36 * Begin processing a single task.
39 * title to describe the task. Callers should publish these as
40 * stable string constants that implementations could match
41 * against for translation support.
43 * total number of work units the application will perform;
44 * {@link #UNKNOWN} if it cannot be predicted in advance.
46 void beginTask(String title
, int totalWork
);
49 * Denote that some work units have been completed.
51 * This is an incremental update; if invoked once per work unit the correct
52 * value for our argument is <code>1</code>, to indicate a single unit of
53 * work has been finished by the caller.
56 * the number of work units completed since the last call.
58 void update(int completed
);
60 /** Finish the current task, so the next can begin. */
64 * Check for user task cancellation.
66 * @return true if the user asked the process to stop working.
68 boolean isCancelled();