コード例 #1
0
    @Override
    public void actionPerformed(final ActionEvent e) {
        final SelectionInfo<FilePackage, DownloadLink> finalSelection = selection.get();
        if (finalSelection != null) {
            TaskQueue.getQueue().add(new QueueAction<Void, RuntimeException>() {

                @Override
                protected Void run() throws RuntimeException {
                    final List<DownloadLink> nodesToDelete = new ArrayList<DownloadLink>();
                    boolean createNewSelectionInfo = false;
                    switch (includedSelection.getSelectionType()) {
                    case NONE:
                        return null;
                    case UNSELECTED:
                        createNewSelectionInfo = true;
                        for (final DownloadLink child : finalSelection.getUnselectedChildren()) {
                            if (checkLink(child)) {
                                nodesToDelete.add(child);
                            }
                        }
                        break;
                    default:
                        for (final DownloadLink dl : finalSelection.getChildren()) {
                            if (checkLink(dl)) {
                                nodesToDelete.add(dl);
                            } else {
                                createNewSelectionInfo = true;
                            }
                        }
                    }
                    if (nodesToDelete.size() > 0) {
                        final SelectionInfo<FilePackage, DownloadLink> si;
                        if (createNewSelectionInfo) {
                            si = new SelectionInfo<FilePackage, DownloadLink>(null, nodesToDelete);
                        } else {
                            si = finalSelection;
                        }
                        if (si.getChildren().size() > 0) {
                            DownloadTabActionUtils.deleteLinksRequest(si, _GUI._.GenericDeleteFromDownloadlistAction_actionPerformed_ask_(createName()), getDeleteMode(), byPassDialog.isBypassDialog());
                            return null;
                        }
                    }
                    new EDTHelper<Void>() {

                        @Override
                        public Void edtRun() {
                            Toolkit.getDefaultToolkit().beep();
                            Dialog.getInstance().showErrorDialog(_GUI._.GenericDeleteSelectedToolbarAction_actionPerformed_nothing_to_delete_());
                            return null;
                        }

                    }.start(true);
                    return null;
                }
            });
        }
    }
コード例 #2
0
    public void actionPerformed(final ActionEvent e) {
        if (JDGui.getInstance().isCurrentPanel(Panels.LINKGRABBER)) {
            TaskQueue.getQueue().add(new QueueAction<Void, RuntimeException>() {

                @Override
                protected Void run() throws RuntimeException {
                    switch (CFG_GUI.CFG.getStartButtonActionInLinkgrabberContext()) {
                    case ADD_ALL_LINKS_AND_START_DOWNLOADS:
                        ConfirmLinksContextAction.confirmSelection(LinkGrabberTable.getInstance().getSelectionInfo(false, true), true, false, true, null, BooleanStatus.FALSE);

                        break;
                    case START_DOWNLOADS_ONLY:
                        DownloadWatchDog.getInstance().startDownloads();
                        break;
                    }
                    return null;
                }
            });
        } else {
            DownloadWatchDog.getInstance().startDownloads();
        }
    }