comparison src/org/tmatesoft/hg/core/HgStatusCommand.java @ 215:41a778e3fd31

Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 17 May 2011 00:56:54 +0200
parents d51f1c6aaa28
children 1ec6b327a6ac
comparison
equal deleted inserted replaced
214:4252faa556cd 215:41a778e3fd31
19 import static org.tmatesoft.hg.core.HgStatus.Kind.*; 19 import static org.tmatesoft.hg.core.HgStatus.Kind.*;
20 import static org.tmatesoft.hg.repo.HgInternals.wrongLocalRevision; 20 import static org.tmatesoft.hg.repo.HgInternals.wrongLocalRevision;
21 import static org.tmatesoft.hg.repo.HgRepository.*; 21 import static org.tmatesoft.hg.repo.HgRepository.*;
22 22
23 import java.util.ConcurrentModificationException; 23 import java.util.ConcurrentModificationException;
24 import java.util.concurrent.CancellationException;
24 25
25 import org.tmatesoft.hg.internal.ChangelogHelper; 26 import org.tmatesoft.hg.internal.ChangelogHelper;
26 import org.tmatesoft.hg.repo.HgRepository; 27 import org.tmatesoft.hg.repo.HgRepository;
27 import org.tmatesoft.hg.repo.HgStatusCollector; 28 import org.tmatesoft.hg.repo.HgStatusCollector;
28 import org.tmatesoft.hg.repo.HgStatusInspector; 29 import org.tmatesoft.hg.repo.HgStatusInspector;
34 * Command to obtain file status information, 'hg status' counterpart. 35 * Command to obtain file status information, 'hg status' counterpart.
35 * 36 *
36 * @author Artem Tikhomirov 37 * @author Artem Tikhomirov
37 * @author TMate Software Ltd. 38 * @author TMate Software Ltd.
38 */ 39 */
39 public class HgStatusCommand { 40 public class HgStatusCommand extends HgAbstractCommand<HgStatusCommand> {
40 private final HgRepository repo; 41 private final HgRepository repo;
41 42
42 private int startRevision = TIP; 43 private int startRevision = TIP;
43 private int endRevision = WORKING_COPY; 44 private int endRevision = WORKING_COPY;
44 45
159 * 160 *
160 * @param handler callback to get status information 161 * @param handler callback to get status information
161 * @throws IllegalArgumentException if handler is <code>null</code> 162 * @throws IllegalArgumentException if handler is <code>null</code>
162 * @throws ConcurrentModificationException if this command already runs (i.e. being used from another thread) 163 * @throws ConcurrentModificationException if this command already runs (i.e. being used from another thread)
163 */ 164 */
164 public void execute(Handler statusHandler) { 165 public void execute(Handler statusHandler) throws CancellationException, HgCallbackTargetException {
165 if (statusHandler == null) { 166 if (statusHandler == null) {
166 throw new IllegalArgumentException(); 167 throw new IllegalArgumentException();
167 } 168 }
168 if (mediator.busy()) { 169 if (mediator.busy()) {
169 throw new ConcurrentModificationException(); 170 throw new ConcurrentModificationException();