if (selectedItems != null && selectedItems.length != 0) { int result = JOptionPane.showConfirmDialog(AppleJuiceDialog. getApp(), downloadAbbrechen, dialogTitel, JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { ArrayList indizesAbbrechen = new ArrayList(); for (int i = 0; i < selectedItems.length; i++) { if (selectedItems[i].getClass() == DownloadMainNode.class) { DownloadDO downloadDO = ( (DownloadMainNode) selectedItems[i]).getDownloadDO(); indizesAbbrechen.add(new Integer(downloadDO. getId())); } } int size = indizesAbbrechen.size(); if (size > 0) { final int[] abbrechen = new int[size]; for (int i = 0; i < size; i++) { abbrechen[i] = ( (Integer) indizesAbbrechen.get( i)).intValue(); } new Thread(){ public void run(){ ApplejuiceFassade.getInstance().cancelDownload( abbrechen); SoundPlayer.getInstance().playSound(SoundPlayer. ABGEBROCHEN); } }.start();
if (selectedItems != null && selectedItems.length == 1) { Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard(); StringBuffer toCopy = new StringBuffer(); toCopy.append("ajfsp: if (selectedItems[0].getClass() == DownloadMainNode.class && ( (DownloadMainNode) selectedItems[0]).getType() == DownloadMainNode.ROOT_NODE) { DownloadDO downloadDO = ((DownloadMainNode)selectedItems[0]).getDownloadDO(); toCopy.append(downloadDO.getFilename()+ "|" + downloadDO.getHash() + "|" + downloadDO.getGroesse() + "/"); StringSelection contents = new StringSelection(toCopy.toString()); cb.setContents(contents, null); } else if (selectedItems[0].getClass() == DownloadSourceDO.class) { DownloadSourceDO downloadSourceDO = (DownloadSourceDO) selectedItems[0]; HashMap downloads = ApplejuiceFassade.getInstance().getDownloadsSnapshot(); MapSetStringKey key = new MapSetStringKey(downloadSourceDO.getDownloadId()); DownloadDO downloadDO = (DownloadDO)downloads.get(key); if (downloadDO!=null){ toCopy.append(downloadSourceDO.getFilename() + "|" + downloadDO.getHash() + "|" + downloadDO.getGroesse() + "/"); StringSelection contents = new StringSelection( toCopy.toString()); cb.setContents(contents, null);
            public void actionPerformed(ActionEvent ae) {                Object[] selectedItems = getSelectedDownloadItems();                if (selectedItems != null && selectedItems.length != 0) {                    int result = JOptionPane.showConfirmDialog(AppleJuiceDialog.                        getApp(),                        downloadAbbrechen, dialogTitel,                        JOptionPane.YES_NO_OPTION);                    if (result == JOptionPane.YES_OPTION) {                        ArrayList indizesAbbrechen = new ArrayList();                        for (int i = 0; i < selectedItems.length; i++) {                            if (selectedItems[i].getClass() == DownloadMainNode.class) {                                DownloadDO downloadDO = ( (DownloadMainNode)                                    selectedItems[i]).getDownloadDO();                                indizesAbbrechen.add(new Integer(downloadDO.                                    getId()));                            }                        }                        int size = indizesAbbrechen.size();                        if (size > 0) {                            final int[] abbrechen = new int[size];                            for (int i = 0; i < size; i++) {                                abbrechen[i] = ( (Integer) indizesAbbrechen.get(                                    i)).intValue();                            }                            new Thread(){                                public void run(){                                    ApplejuiceFassade.getInstance().cancelDownload(                                        abbrechen);                                    SoundPlayer.getInstance().playSound(SoundPlayer.                                        ABGEBROCHEN);                                }                            }.start();                        }                    }                }            }