public void update() { try { if (download.getFd() == null) { if (download.getNConnections() == 0) { name = download.getAuxInfoFilename(); } else { name = download.getAuxInfoFilename() + " - starting..."; } size = "?"; } else { name = download.getFd().getSubpath(); size = TextUtils.formatByteSize(download.getFd().getSize()); } percentComplete = download.getPercentComplete(); numberOfConnections = download.getNConnections(); speed = download.getBandwidth().getCPSHumanReadable(); complete = download.isComplete(); state = download.getState(); if (download.getBandwidth().hasGoodAverage()) { eta = formatETA(download.getETAInMinutes()); } else { eta = "?"; } } catch (IOException e) { if (T.t) { T.error("Exception while updating downloadwrapper: " + e); } } }
public void EVENT_openfile(ActionEvent e) { int selection[] = table.getSelectedRows(); if (selection == null || selection.length == 0) { return; } if (selection.length > 1) { OptionDialog.showErrorDialog(ui.getMainWindow(), "You can only open one folder or file"); return; } Download d = rows.get(selection[0]).download; if (d.isComplete() == true) { String path = ui.getCore().getSettings().getInternal().getDownloadfolder() + "\\" + d.getAuxInfoFilename(); try { Desktop.getDesktop().open(new File(path)); } catch (IOException ex) { OptionDialog.showErrorDialog( ui.getMainWindow(), "This type of file hasn't been associated with any program"); } catch (IllegalArgumentException ex) { OptionDialog.showErrorDialog( ui.getMainWindow(), "This type of file hasn't been associated with any program"); } catch (UnsupportedOperationException ex) { OptionDialog.showErrorDialog( ui.getMainWindow(), "This operation is not supported on this architecture"); } } else { OptionDialog.showErrorDialog(ui.getMainWindow(), "File hasn't been downloaded yet"); } }