Lines 55-60
Link Here
|
55 |
private long initialEstimate; |
55 |
private long initialEstimate; |
56 |
private long timeStarted; |
56 |
private long timeStarted; |
57 |
private long timeLastProgress; |
57 |
private long timeLastProgress; |
|
|
58 |
private long timeSleepy = 0; |
58 |
private String lastMessage; |
59 |
private String lastMessage; |
59 |
private final Cancellable cancelable; |
60 |
private final Cancellable cancelable; |
60 |
private final Action viewAction; |
61 |
private final Action viewAction; |
Lines 134-139
Link Here
|
134 |
return initialDelay; |
135 |
return initialDelay; |
135 |
} |
136 |
} |
136 |
|
137 |
|
|
|
138 |
public synchronized void toSilent(String message) { |
139 |
if (state != STATE_RUNNING && state != STATE_REQUEST_STOP) { |
140 |
assert false : "cannot switch to silent mode when not running"; |
141 |
} |
142 |
timeLastProgress = System.currentTimeMillis(); |
143 |
timeSleepy = timeLastProgress; |
144 |
if (message != null) { |
145 |
lastMessage = message; |
146 |
} |
147 |
controller.toSilent(this, message); |
148 |
} |
149 |
|
150 |
public boolean isInSleepMode() { |
151 |
return timeSleepy == timeLastProgress; |
152 |
} |
153 |
|
137 |
public synchronized void toIndeterminate() { |
154 |
public synchronized void toIndeterminate() { |
138 |
if (state != STATE_RUNNING && state != STATE_REQUEST_STOP) { |
155 |
if (state != STATE_RUNNING && state != STATE_REQUEST_STOP) { |
139 |
assert false : "cannot switch to indeterminate mode when not running"; |
156 |
assert false : "cannot switch to indeterminate mode when not running"; |
Lines 273-282
Link Here
|
273 |
|
290 |
|
274 |
// XXX - called from UI, threading |
291 |
// XXX - called from UI, threading |
275 |
public synchronized void requestExplicitSelection() { |
292 |
public synchronized void requestExplicitSelection() { |
276 |
timeLastProgress = System.currentTimeMillis(); |
293 |
if (!isInSleepMode()) { |
277 |
controller.explicitSelection(this, currentUnit, |
294 |
timeLastProgress = System.currentTimeMillis(); |
278 |
totalUnits > 0 ? getPercentageDone() : -1, |
295 |
} |
279 |
(initialEstimate == -1 ? -1 : calculateFinishEstimate())); |
296 |
controller.explicitSelection(this); |
280 |
} |
297 |
} |
281 |
|
298 |
|
282 |
public synchronized void requestDisplayNameChange(String newDisplayName) { |
299 |
public synchronized void requestDisplayNameChange(String newDisplayName) { |
Lines 292-298
Link Here
|
292 |
|
309 |
|
293 |
// XXX - called from UI, threading |
310 |
// XXX - called from UI, threading |
294 |
public synchronized ProgressEvent requestStateSnapshot() { |
311 |
public synchronized ProgressEvent requestStateSnapshot() { |
295 |
timeLastProgress = System.currentTimeMillis(); |
312 |
if (!isInSleepMode()) { |
|
|
313 |
timeLastProgress = System.currentTimeMillis(); |
314 |
} |
296 |
return controller.snapshot(this, lastMessage, currentUnit, |
315 |
return controller.snapshot(this, lastMessage, currentUnit, |
297 |
totalUnits > 0 ? getPercentageDone() : -1, |
316 |
totalUnits > 0 ? getPercentageDone() : -1, |
298 |
(initialEstimate == -1 ? -1 : calculateFinishEstimate())); |
317 |
(initialEstimate == -1 ? -1 : calculateFinishEstimate())); |
Lines 374-379
Link Here
|
374 |
public long getTimeStampStarted() { |
393 |
public long getTimeStampStarted() { |
375 |
return timeStarted; |
394 |
return timeStarted; |
376 |
} |
395 |
} |
|
|
396 |
|
377 |
|
397 |
|
378 |
|
398 |
|
379 |
} |
399 |
} |