Search in sources :

Example 1 with DownloadRemovalVetoException

use of com.biglybt.pif.download.DownloadRemovalVetoException in project BiglyBT by BiglySoftware.

the class ManagerUtils method moveToArchive.

public static void moveToArchive(final List<Download> downloads, ArchiveCallback _run_when_complete) {
    final ArchiveCallback run_when_complete = _run_when_complete == null ? new ArchiveCallback() : _run_when_complete;
    Utils.getOffOfSWTThread(new AERunnable() {

        @Override
        public void runSupport() {
            try {
                String title = MessageText.getString("archive.info.title");
                String text = MessageText.getString("archive.info.text");
                MessageBoxShell prompter = new MessageBoxShell(title, text, new String[] { MessageText.getString("Button.ok") }, 0);
                String remember_id = "managerutils.archive.info";
                prompter.setRemember(remember_id, true, MessageText.getString("MessageBoxWindow.nomoreprompting"));
                prompter.setAutoCloseInMS(0);
                prompter.open(null);
                prompter.waitUntilClosed();
                for (Download dm : downloads) {
                    try {
                        DownloadStub stub = dm.stubbify();
                        run_when_complete.success(dm, stub);
                    } catch (DownloadRemovalVetoException e) {
                        run_when_complete.failed(dm, e);
                        if (!e.isSilent()) {
                            UIFunctionsManager.getUIFunctions().forceNotify(UIFunctions.STATUSICON_ERROR, MessageText.getString("globalmanager.download.remove.veto"), e.getMessage(), dm.getName(), new Object[] { dm }, -1);
                        }
                    } catch (Throwable e) {
                        run_when_complete.failed(dm, e);
                        Debug.out(e);
                    }
                }
            } finally {
                run_when_complete.completed();
            }
        }
    });
}
Also used : DownloadStub(com.biglybt.pif.download.DownloadStub) DownloadRemovalVetoException(com.biglybt.pif.download.DownloadRemovalVetoException) GlobalManagerDownloadRemovalVetoException(com.biglybt.core.global.GlobalManagerDownloadRemovalVetoException) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) Download(com.biglybt.pif.download.Download)

Aggregations

GlobalManagerDownloadRemovalVetoException (com.biglybt.core.global.GlobalManagerDownloadRemovalVetoException)1 Download (com.biglybt.pif.download.Download)1 DownloadRemovalVetoException (com.biglybt.pif.download.DownloadRemovalVetoException)1 DownloadStub (com.biglybt.pif.download.DownloadStub)1 MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)1