Add a progress monitor inteface and some simple implementions of it
[egit/charleso.git] / org.spearce.jgit / src / org / spearce / jgit / lib / ProgressMonitor.java
blob47ae9eafc0a639044ce12ed2d3529c006824a793
1 /*******************************************************************************
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
9 * Contributors:
10 * IBM Corporation - initial API and implementation
11 *******************************************************************************/
12 package org.spearce.jgit.lib;
14 /**
15 * A progress monitor. A ripoff of IProgressMonitor.
17 public interface ProgressMonitor {
18 /**
19 * Set task name
21 * @param message
23 void setTask(String message);
25 /**
26 * @return taskname
28 String getTask();
30 /**
31 * Set the total expected amount of work
33 * @param work
35 void setTotalWork(int work);
37 /**
38 * @return amount worked so far
40 int getWorked();
42 /**
43 * @param work
45 void worked(int work);
47 /**
48 * @return total expected amount of work
50 int getTotal();
52 /**
53 * Indicate the task is completed.
55 void done();
57 /**
58 * @return true if done.
60 boolean isDone();
62 /**
63 * @return true if cancel has been requested.
65 boolean isCancelled();
67 /**
68 * Request the task to be cancelled
70 * @param cancelled
72 void setCancelled(boolean cancelled);
74 /**
75 * Begin a task
77 * @param task
78 * @param total
80 void beginTask(String task, int total);