use of ch.cyberduck.core.threading.TransferCollectionBackgroundAction in project cyberduck by iterate-ch.
the class TransferController method start.
/**
* @param transfer Transfer
*/
public void start(final Transfer transfer, final TransferOptions options, final TransferCallback callback) {
final ProgressController progress = transferTableModel.getController(transfer);
final Cache<Path> cache = new PathCache(preferences.getInteger("transfer.cache.size"));
final Host source = transfer.getSource();
final Host destination = transfer.getDestination();
final TransferBackgroundAction action = new TransferCollectionBackgroundAction(this, null == source ? SessionPool.DISCONNECTED : SessionPoolFactory.create(this, source, progress), null == destination ? SessionPool.DISCONNECTED : SessionPoolFactory.create(this, destination, progress), this, progress, transfer, options) {
@Override
public void init() {
super.init();
if (preferences.getBoolean("queue.window.open.transfer.start")) {
window.makeKeyAndOrderFront(null);
}
}
@Override
public void finish() {
super.finish();
if (transfer.isComplete()) {
callback.complete(transfer);
}
}
@Override
public void cleanup() {
super.cleanup();
if (transfer.isReset() && transfer.isComplete()) {
if (preferences.getBoolean("queue.window.open.transfer.stop")) {
if (!(collection.numberOfRunningTransfers() > 0)) {
window.orderOut(null);
}
}
}
}
};
if (!collection.contains(transfer)) {
this.add(transfer, action);
} else {
this.background(action);
}
}
Aggregations