From: <Dam...@us...> - 2007-10-14 21:01:44
|
Revision: 1515 http://azsmrc.svn.sourceforge.net/azsmrc/?rev=1515&view=rev Author: Damokles Date: 2007-10-14 14:01:47 -0700 (Sun, 14 Oct 2007) Log Message: ----------- fix to enable the setting of dl speed to -1 (DnD) requested by paczesiowa Modified Paths: -------------- trunk/azsmrc/lbms/azsmrc/remote/client/swtgui/DownloadManagerShell.java Modified: trunk/azsmrc/lbms/azsmrc/remote/client/swtgui/DownloadManagerShell.java =================================================================== --- trunk/azsmrc/lbms/azsmrc/remote/client/swtgui/DownloadManagerShell.java 2007-10-11 22:19:16 UTC (rev 1514) +++ trunk/azsmrc/lbms/azsmrc/remote/client/swtgui/DownloadManagerShell.java 2007-10-14 21:01:47 UTC (rev 1515) @@ -140,43 +140,34 @@ private final DownloadListener dlL = new DownloadListener() { - public void stateChanged( + public void stateChanged ( Download download, int old_state, int new_state) { try { - semaphore - .acquire(); + semaphore.acquire(); // Changing // from // Downloading // to // Seeding if (new_state == Download.ST_SEEDING - && downloadsMap - .containsKey(download - .getHash())) { - downloadsMap - .remove(download - .getHash()); + && downloadsMap.containsKey(download.getHash())) { + downloadsMap.remove(download.getHash()); SeedContainer sc = new SeedContainer( download, seedsTable, SWT.NULL); - seedsMap - .put( - download - .getHash(), - sc); + seedsMap.put( + download.getHash(), + sc); redrawTables = true; } } catch (InterruptedException e) { - e - .printStackTrace(); + e.printStackTrace(); } finally { - semaphore - .release(); + semaphore.release(); } // Other // changes @@ -184,17 +175,16 @@ // here } - public void positionChanged( + public void positionChanged ( Download download, int oldPosition, int newPosition) { - logger - .debug("Position changed " - + download - + " " - + oldPosition - + " -> " - + newPosition); + logger.debug("Position changed " + + download + + " " + + oldPosition + + " -> " + + newPosition); redrawTables = true; } @@ -238,13 +228,12 @@ private int upSpeed = 0; private int downSpeed = 0; - private static Logger logger = Logger - .getLogger("lbms.azsmrc.DownloadManagerShell"); ; + private static Logger logger = Logger.getLogger("lbms.azsmrc.DownloadManagerShell"); ; private final Set<String> openPluginViews = new HashSet<String>(); private int drag_drop_line_start = -1; - public void open() { + public void open () { if (DOWNLOAD_MANAGER_SHELL != null && !DOWNLOAD_MANAGER_SHELL.isDisposed()) { DOWNLOAD_MANAGER_SHELL.setVisible(true); @@ -259,8 +248,7 @@ DOWNLOAD_MANAGER_SHELL = new Shell(RCMain.getRCMain().getDisplay()); - DOWNLOAD_MANAGER_SHELL.setImage(ImageRepository - .getImage("TrayIcon_Blue")); + DOWNLOAD_MANAGER_SHELL.setImage(ImageRepository.getImage("TrayIcon_Blue")); // Grid Layout GridLayout gridLayout = new GridLayout(); @@ -312,17 +300,16 @@ menuLogin = new MenuItem(fileSubmenu, SWT.PUSH); menuLogin.setText(I18N.translate(PFX + "menu.main.connect")); menuLogin.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ConnectionDialog.open(RCMain.getRCMain().getDisplay()); } }); // QuickConnect menuQuickconnect = new MenuItem(fileSubmenu, SWT.PUSH); - menuQuickconnect - .setText(I18N.translate(PFX + "menu.main.quickconnect")); + menuQuickconnect.setText(I18N.translate(PFX + "menu.main.quickconnect")); menuQuickconnect.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { Properties properties = RCMain.getRCMain().getProperties(); if (properties.containsKey("lastConnection")) { try { @@ -333,17 +320,14 @@ initializeConnection(); } else if (login.hasUsername() && login.hasHost()) { InputShell is = new InputShell( - I18N - .translate(PFX - + "menu.main.quickconnect.inputshell.title"), - I18N - .translate(PFX - + "menu.main.quickconnect.inputshell.text1") + I18N.translate(PFX + + "menu.main.quickconnect.inputshell.title"), + I18N.translate(PFX + + "menu.main.quickconnect.inputshell.text1") + " " + login.getUsername() - + I18N - .translate(PFX - + "menu.main.quickconnect.inputshell.text2") + + I18N.translate(PFX + + "menu.main.quickconnect.inputshell.text2") + " " + login.getHost()); is.setIsPassword(true); String pw = is.open(); @@ -353,8 +337,7 @@ initializeConnection(); } } else { - ConnectionDialog.open(RCMain.getRCMain() - .getDisplay()); + ConnectionDialog.open(RCMain.getRCMain().getDisplay()); } } catch (MalformedURLException e1) { ConnectionDialog.open(RCMain.getRCMain().getDisplay()); @@ -368,7 +351,7 @@ menuLogout = new MenuItem(fileSubmenu, SWT.PUSH); menuLogout.setText(I18N.translate(PFX + "menu.main.logout")); menuLogout.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { RCMain.getRCMain().disconnect(); setGUItoLoggedOut(); } @@ -382,9 +365,9 @@ exitItem.setText(I18N.translate(PFX + "menu.main.exit") + "\tCtrl+Q"); exitItem.setAccelerator(SWT.CTRL + 'Q'); exitItem.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - boolean confirmExit = RCMain.getRCMain().getProperties() - .getPropertyAsBoolean("confirm.exit"); + public void handleEvent (Event e) { + boolean confirmExit = RCMain.getRCMain().getProperties().getPropertyAsBoolean( + "confirm.exit"); if (confirmExit) { MessageBox messageBox = new MessageBox( DOWNLOAD_MANAGER_SHELL, SWT.ICON_QUESTION | SWT.OK @@ -413,7 +396,7 @@ menuAddByFile = new MenuItem(remoteSubmenu, SWT.PUSH); menuAddByFile.setText(I18N.translate(PFX + "menu.remote.addbyfile")); menuAddByFile.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { OpenByFileDialog.open(); } }); @@ -422,7 +405,7 @@ menuAddbyURL = new MenuItem(remoteSubmenu, SWT.PUSH); menuAddbyURL.setText(I18N.translate(PFX + "menu.remote.addbyurl")); menuAddbyURL.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { OpenByURLDialog.open(); } }); @@ -435,7 +418,7 @@ menuServerDetails.setText(I18N.translate(PFX + "menu.remote.serverdetails")); menuServerDetails.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ServerDetailsTab.open(tabFolder); } }); @@ -443,7 +426,7 @@ menuServerUpdate.setText(I18N.translate(PFX + "menu.remote.serverupdates")); menuServerUpdate.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ServerUpdateDialog.open(); } }); @@ -456,7 +439,7 @@ menuRestartAzureus.setText(I18N.translate(PFX + "menu.remote.restartserver")); menuRestartAzureus.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { MessageBox messageBox = new MessageBox(DOWNLOAD_MANAGER_SHELL, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL); messageBox.setText(I18N.translate(PFX @@ -479,7 +462,7 @@ menuMyShares = new MenuItem(toolSubmenu, SWT.PUSH); menuMyShares.setText(I18N.translate(PFX + "menu.tools.mytracker")); menuMyShares.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { MyTracker.open(tabFolder); } }); @@ -488,7 +471,7 @@ menuCreateTorrent.setText(I18N.translate(PFX + "menu.tools.createTorrent")); menuCreateTorrent.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { CreateTorrentDialog.open(); } }); @@ -498,7 +481,7 @@ + "\tCtrl+C"); menuConsole.setAccelerator(SWT.CTRL + 'C'); menuConsole.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ConsoleTab.open(tabFolder, true); } }); @@ -506,7 +489,7 @@ MenuItem menuPrefs = new MenuItem(toolSubmenu, SWT.PUSH); menuPrefs.setText(I18N.translate(PFX + "menu.tools.preferences")); menuPrefs.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { PreferencesTab.open(tabFolder); } }); @@ -514,7 +497,7 @@ MenuItem menuHistory = new MenuItem(toolSubmenu, SWT.PUSH); menuHistory.setText(I18N.translate(PFX + "menu.tools.history")); menuHistory.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { DownloadHistoryTab.open(tabFolder); } }); @@ -524,10 +507,10 @@ MenuItem menuUpdate = new MenuItem(toolSubmenu, SWT.PUSH); menuUpdate.setText(I18N.translate(PFX + "menu.tools.update")); menuUpdate.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { RCMain.getRCMain().getUpdater().checkForUpdates( - RCMain.getRCMain().getProperties() - .getPropertyAsBoolean("update.beta")); + RCMain.getRCMain().getProperties().getPropertyAsBoolean( + "update.beta")); RCMain.getRCMain().getProperties().setProperty( "update.lastcheck", System.currentTimeMillis()); RCMain.getRCMain().saveConfig(); @@ -536,16 +519,16 @@ // -----Plugin Submenu - String[] pluginIDs = RCMain.getRCMain().getPluginManagerImpl() - .getUIManager().getViewIDs(ViewID.MAIN); + String[] pluginIDs = RCMain.getRCMain().getPluginManagerImpl().getUIManager().getViewIDs( + ViewID.MAIN); for (final String pluginID : pluginIDs) { logger.debug("Adding Plugin Item: " + pluginID); MenuItem pluginMenuItem = new MenuItem(pluginSubmenu, SWT.PUSH); pluginMenuItem.setText(pluginID); pluginMenuItem.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - RCMain.getRCMain().getPluginManagerImpl().getUIManager() - .openMainView(pluginID); + public void handleEvent (Event e) { + RCMain.getRCMain().getPluginManagerImpl().getUIManager().openMainView( + pluginID); } }); } @@ -556,7 +539,7 @@ menuAbout.setText(I18N.translate(PFX + "menu.help.about")); menuAbout.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ReadmeTab.open(tabFolder); } }); @@ -574,7 +557,7 @@ login.setImage(ImageRepository.getImage("connect")); login.setToolTipText(I18N.translate(PFX + "toolbar.login.tooltiptext")); login.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ConnectionDialog.open(RCMain.getRCMain().getDisplay()); } }); @@ -584,7 +567,7 @@ quickconnect.setToolTipText(I18N.translate(PFX + "toolbar.quickconnect.tooltiptext")); quickconnect.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { Properties properties = RCMain.getRCMain().getProperties(); if (properties.containsKey("lastConnection")) { try { @@ -595,17 +578,14 @@ initializeConnection(); } else if (login.hasUsername() && login.hasHost()) { InputShell is = new InputShell( - I18N - .translate(PFX - + "toolbar.quickconnect.inputshell.title"), - I18N - .translate(PFX - + "toolbar.quickconnect.inputshell.text1") + I18N.translate(PFX + + "toolbar.quickconnect.inputshell.title"), + I18N.translate(PFX + + "toolbar.quickconnect.inputshell.text1") + " " + login.getUsername() - + I18N - .translate(PFX - + "toolbar.quickconnect.inputshell.text2") + + I18N.translate(PFX + + "toolbar.quickconnect.inputshell.text2") + " " + login.getHost()); is.setIsPassword(true); String pw = is.open(); @@ -615,8 +595,7 @@ initializeConnection(); } } else { - ConnectionDialog.open(RCMain.getRCMain() - .getDisplay()); + ConnectionDialog.open(RCMain.getRCMain().getDisplay()); } } catch (MalformedURLException e1) { ConnectionDialog.open(RCMain.getRCMain().getDisplay()); @@ -628,10 +607,9 @@ logout = new ToolItem(bar, SWT.PUSH); logout.setImage(ImageRepository.getImage("logout")); - logout.setToolTipText(I18N - .translate(PFX + "toolbar.logout.tooltiptext")); + logout.setToolTipText(I18N.translate(PFX + "toolbar.logout.tooltiptext")); logout.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { RCMain.getRCMain().disconnect(); setGUItoLoggedOut(); } @@ -642,7 +620,7 @@ refresh.setToolTipText(I18N.translate(PFX + "toolbar.refresh.tooltiptext")); refresh.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { if (RCMain.getRCMain().connected()) { RCMain.getRCMain().getClient().getDownloadManager().update( true); @@ -658,7 +636,7 @@ addTorrent_by_file.setToolTipText(I18N.translate(PFX + "toolbar.openbyfile.tooltiptext")); addTorrent_by_file.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { OpenByFileDialog.open(); } }); @@ -668,7 +646,7 @@ addTorrent_by_url.setToolTipText(I18N.translate(PFX + "toolbar.openbyurl.tooltiptext")); addTorrent_by_url.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { OpenByURLDialog.open(); } }); @@ -680,15 +658,14 @@ top.setImage(ImageRepository.getImage("top")); top.setToolTipText(I18N.translate(PFX + "toolbar.top.tooltiptext")); top.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { if (downloadsTable.isFocusControl()) { TableItem[] items = downloadsTable.getSelection(); if (items.length == 0 || items.length > 1) { return; } Container container = (Container) items[0].getData(); - int current_position = container.getDownload() - .getPosition(); + int current_position = container.getDownload().getPosition(); if ((current_position - 1) > 0) { container.getDownload().moveTo(1); } @@ -698,8 +675,7 @@ return; } Container container = (Container) items[0].getData(); - int current_position = container.getDownload() - .getPosition(); + int current_position = container.getDownload().getPosition(); if ((current_position - 1) > 0) { container.getDownload().moveTo(1); } @@ -711,15 +687,14 @@ up.setImage(ImageRepository.getImage("up")); up.setToolTipText(I18N.translate(PFX + "toolbar.up.tooltiptext")); up.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { if (downloadsTable.isFocusControl()) { TableItem[] items = downloadsTable.getSelection(); if (items.length == 0 || items.length > 1) { return; } Container container = (Container) items[0].getData(); - int current_position = container.getDownload() - .getPosition(); + int current_position = container.getDownload().getPosition(); if ((current_position - 1) > 0) { container.getDownload().moveUp(); } @@ -729,8 +704,7 @@ return; } Container container = (Container) items[0].getData(); - int current_position = container.getDownload() - .getPosition(); + int current_position = container.getDownload().getPosition(); if ((current_position - 1) > 0) { container.getDownload().moveUp(); } @@ -743,16 +717,14 @@ down.setImage(ImageRepository.getImage("down")); down.setToolTipText(I18N.translate(PFX + "toolbar.down.tooltiptext")); down.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { if (downloadsTable.isFocusControl()) { TableItem[] items = downloadsTable.getSelection(); if (items.length == 0 || items.length > 1) { return; } - DownloadContainer container = (DownloadContainer) items[0] - .getData(); - int current_position = container.getDownload() - .getPosition(); + DownloadContainer container = (DownloadContainer) items[0].getData(); + int current_position = container.getDownload().getPosition(); if ((current_position + 1) != (downloadsMap.size() + 1)) { container.getDownload().moveDown(); } @@ -762,8 +734,7 @@ return; } Container container = (Container) items[0].getData(); - int current_position = container.getDownload() - .getPosition(); + int current_position = container.getDownload().getPosition(); if ((current_position + 1) != (seedsMap.size() + 1)) { container.getDownload().moveDown(); } @@ -776,18 +747,16 @@ bottom = new ToolItem(bar, SWT.PUSH); bottom.setImage(ImageRepository.getImage("bottom")); - bottom.setToolTipText(I18N - .translate(PFX + "toolbar.bottom.tooltiptext")); + bottom.setToolTipText(I18N.translate(PFX + "toolbar.bottom.tooltiptext")); bottom.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { if (downloadsTable.isFocusControl()) { TableItem[] items = downloadsTable.getSelection(); if (items.length == 0 || items.length > 1) { return; } Container container = (Container) items[0].getData(); - int current_position = container.getDownload() - .getPosition(); + int current_position = container.getDownload().getPosition(); if (current_position != downloadsMap.size()) { container.getDownload().moveTo(downloadsMap.size()); } @@ -797,8 +766,7 @@ return; } Container container = (Container) items[0].getData(); - int current_position = container.getDownload() - .getPosition(); + int current_position = container.getDownload().getPosition(); if (current_position != seedsMap.size()) { container.getDownload().moveTo(seedsMap.size()); } @@ -817,7 +785,7 @@ queueTorrent.setToolTipText(I18N.translate(PFX + "toolbar.queuetorrent.tooltiptext")); queueTorrent.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { TableItem[] items; if (downloadsTable.isFocusControl()) { items = downloadsTable.getSelection(); @@ -849,7 +817,7 @@ stopTorrent.setToolTipText(I18N.translate(PFX + "toolbar.stoptorrents.tooltiptext")); stopTorrent.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { TableItem[] items; if (downloadsTable.isFocusControl()) { items = downloadsTable.getSelection(); @@ -880,7 +848,7 @@ removeTorrent.setToolTipText(I18N.translate(PFX + "toolbar.removetorrents.tooltiptext")); removeTorrent.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { TableItem[] items; if (downloadsTable.isFocusControl()) { items = downloadsTable.getSelection(); @@ -898,8 +866,7 @@ if (seedsMap.containsKey(container.getDownload().getHash())) { seedsMap.remove(container.getDownload().getHash()); redrawTables(); - } else if (downloadsMap.containsKey(container.getDownload() - .getHash())) { + } else if (downloadsMap.containsKey(container.getDownload().getHash())) { downloadsMap.remove(container.getDownload().getHash()); redrawTables(); } @@ -935,47 +902,44 @@ pauseDownloads_1min.addSelectionListener(new SelectionAdapter() { @Override - public void widgetSelected(SelectionEvent e) { - RCMain.getRCMain().getClient().getDownloadManager() - .pauseDownloads(60); + public void widgetSelected (SelectionEvent e) { + RCMain.getRCMain().getClient().getDownloadManager().pauseDownloads( + 60); } }); pauseDownloads_5min.addSelectionListener(new SelectionAdapter() { @Override - public void widgetSelected(SelectionEvent e) { - RCMain.getRCMain().getClient().getDownloadManager() - .pauseDownloads(300); + public void widgetSelected (SelectionEvent e) { + RCMain.getRCMain().getClient().getDownloadManager().pauseDownloads( + 300); } }); - pauseDownloads_UserSpecified - .addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - try { - InputShell is = new InputShell( - I18N - .translate("rcmain." - + "traymenu.quickmenu.pauseUserSpecified.inputShell.title"), - I18N - .translate("rcmain." - + "traymenu.quickmenu.pauseUserSpecified.inputShell.message")); - String str_minutes = is.open(); - int mins = Integer.parseInt(str_minutes); - RCMain.getRCMain().getClient().getDownloadManager() - .pauseDownloads(mins * 60); - logger.info("Pausing all downloads for " + mins - * 60 + " seconds (" + mins + " minutes)"); - } catch (Exception ex) { - } + pauseDownloads_UserSpecified.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected (SelectionEvent e) { + try { + InputShell is = new InputShell( + I18N.translate("rcmain." + + "traymenu.quickmenu.pauseUserSpecified.inputShell.title"), + I18N.translate("rcmain." + + "traymenu.quickmenu.pauseUserSpecified.inputShell.message")); + String str_minutes = is.open(); + int mins = Integer.parseInt(str_minutes); + RCMain.getRCMain().getClient().getDownloadManager().pauseDownloads( + mins * 60); + logger.info("Pausing all downloads for " + mins * 60 + + " seconds (" + mins + " minutes)"); + } catch (Exception ex) { + } - } - }); + } + }); // main pause listener pauseAll.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { + public void handleEvent (Event event) { if (event.detail == SWT.ARROW) { Rectangle rect = pauseAll.getBounds(); Point pt = new Point(rect.x, rect.y + rect.height); @@ -983,8 +947,7 @@ tbmenu.setLocation(pt.x, pt.y); tbmenu.setVisible(true); } else { - RCMain.getRCMain().getClient().getDownloadManager() - .pauseDownloads(); + RCMain.getRCMain().getClient().getDownloadManager().pauseDownloads(); } } }); @@ -994,9 +957,8 @@ resumeAll.setToolTipText(I18N.translate(PFX + "toolbar.resumeall.tooltiptext")); resumeAll.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - RCMain.getRCMain().getClient().getDownloadManager() - .resumeDownloads(); + public void handleEvent (Event e) { + RCMain.getRCMain().getClient().getDownloadManager().resumeDownloads(); } }); @@ -1008,7 +970,7 @@ preferences.setToolTipText(I18N.translate(PFX + "toolbar.openprefs.tooltiptext")); preferences.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { PreferencesTab.open(tabFolder); } }); @@ -1018,9 +980,8 @@ manage_users.setToolTipText(I18N.translate(PFX + "toolbar.manageusers.tooltiptext")); manage_users.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - User user = RCMain.getRCMain().getClient().getUserManager() - .getActiveUser(); + public void handleEvent (Event e) { + User user = RCMain.getRCMain().getClient().getUserManager().getActiveUser(); if (user == null) { manage_users.setEnabled(false); return; @@ -1038,7 +999,7 @@ console.setToolTipText(I18N.translate(PFX + "toolbar.openconsole.tooltiptext")); console.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ConsoleTab.open(tabFolder, true); } }); @@ -1048,7 +1009,7 @@ information.setToolTipText(I18N.translate(PFX + "toolbar.about.tooltiptext")); information.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { ReadmeTab.open(tabFolder); } }); @@ -1061,7 +1022,7 @@ // ------------------- Listeners for the shell ---------------------\\ final GlobalStatsListener sul = new GlobalStatsListener() { - public void updateStats(final int d, final int u, int s, int sq, + public void updateStats (final int d, final int u, int s, int sq, int dl, int dlq) { upSpeed = u; downSpeed = d; @@ -1073,7 +1034,7 @@ final ConnectionListener cl = new ConnectionListener() { - public void connectionState(final int state) { + public void connectionState (final int state) { setConnectionStatusBar(state); if (state > 0) { if (RCMain.getRCMain().getClient().isSSLEncrypted()) { @@ -1091,64 +1052,39 @@ new SWTSafeRunnable() { @Override - public void runSafe() { - String userLoggedIn = RCMain.getRCMain() - .getClient().getUsername(); + public void runSafe () { + String userLoggedIn = RCMain.getRCMain().getClient().getUsername(); if (myTorrents != null || !myTorrents.isDisposed()) { if (bSingleUserMode) { - if (RCMain - .getRCMain() - .getProperties() - .getPropertyAsBoolean( - "mainwindow.showHost")) { - myTorrents - .setText(I18N - .translate(PFX - + "mytorrents.tabtitle.all.text1") - + " " - + RCMain - .getRCMain() - .getClient() - .getServer() - .getHost()); + if (RCMain.getRCMain().getProperties().getPropertyAsBoolean( + "mainwindow.showHost")) { + myTorrents.setText(I18N.translate(PFX + + "mytorrents.tabtitle.all.text1") + + " " + + RCMain.getRCMain().getClient().getServer().getHost()); } else { - myTorrents - .setText(I18N - .translate(PFX - + "mytorrents.tabtitle.all.text2")); + myTorrents.setText(I18N.translate(PFX + + "mytorrents.tabtitle.all.text2")); } } else if (userLoggedIn != null) { - if (RCMain - .getRCMain() - .getProperties() - .getPropertyAsBoolean( - "mainwindow.showHost")) { - myTorrents - .setText(userLoggedIn - + I18N - .translate(PFX - + "mytorrents.tabtitle.user") - + ": " - + RCMain - .getRCMain() - .getClient() - .getServer() - .getHost()); + if (RCMain.getRCMain().getProperties().getPropertyAsBoolean( + "mainwindow.showHost")) { + myTorrents.setText(userLoggedIn + + I18N.translate(PFX + + "mytorrents.tabtitle.user") + + ": " + + RCMain.getRCMain().getClient().getServer().getHost()); } else { - myTorrents - .setText(userLoggedIn - + I18N - .translate(PFX - + "mytorrents.tabtitle.user")); + myTorrents.setText(userLoggedIn + + I18N.translate(PFX + + "mytorrents.tabtitle.user")); } } else { - myTorrents - .setText(I18N - .translate(PFX - + "mytorrents.tabtitle.fallback")); + myTorrents.setText(I18N.translate(PFX + + "mytorrents.tabtitle.fallback")); } } @@ -1165,12 +1101,12 @@ final DownloadManagerListener dml = new DownloadManagerListener() { - public void downloadAdded(final Download download) { + public void downloadAdded (final Download download) { try { if (DOWNLOAD_MANAGER_SHELL == null || DOWNLOAD_MANAGER_SHELL.isDisposed()) { - RCMain.getRCMain().getClient().getDownloadManager() - .removeListener(this); + RCMain.getRCMain().getClient().getDownloadManager().removeListener( + this); return; } @@ -1178,19 +1114,16 @@ RCMain.getRCMain().getDisplay().syncExec( new SWTSafeRunnable() { @Override - public void runSafe() { + public void runSafe () { if (download.getState() == Download.ST_SEEDING || download.isComplete()) { - if (!seedsMap.containsKey(download - .getHash())) { + if (!seedsMap.containsKey(download.getHash())) { SeedContainer sc = new SeedContainer( download); - seedsMap - .put(download.getHash(), sc); + seedsMap.put(download.getHash(), sc); } } else { - if (!downloadsMap.containsKey(download - .getHash())) { + if (!downloadsMap.containsKey(download.getHash())) { DownloadContainer dc = new DownloadContainer( download); downloadsMap.put( @@ -1208,7 +1141,7 @@ download.addDownloadListener(dlL); } - public void downloadRemoved(Download download) { + public void downloadRemoved (Download download) { if (downloadsMap.containsKey(download.getHash())) { downloadsMap.remove(download.getHash()); redrawTables(); @@ -1223,14 +1156,12 @@ final ClientUpdateListener cul = new ClientUpdateListener() { - public void update(long updateSwitches) { + public void update (long updateSwitches) { if ((updateSwitches & Constants.UPDATE_LIST_TRANSFERS) != 0) { - Download[] downloads = RCMain.getRCMain().getClient() - .getDownloadManager().getSortedDownloads(); + Download[] downloads = RCMain.getRCMain().getClient().getDownloadManager().getSortedDownloads(); for (int i = 0; i < downloads.length; i++) { if (!downloadsMap.containsKey(downloads[i].getHash()) - && !seedsMap - .containsKey(downloads[i].getHash())) { + && !seedsMap.containsKey(downloads[i].getHash())) { if (downloads[i].getState() == Download.ST_SEEDING || downloads[i].isComplete()) { SeedContainer sc = new SeedContainer( @@ -1247,30 +1178,23 @@ } else { // is present in one of the maps.. so find it and // update it - if (downloadsMap - .containsKey(downloads[i].getHash())) { + if (downloadsMap.containsKey(downloads[i].getHash())) { if (downloads[i].getState() == Download.ST_SEEDING) { - downloadsMap.get(downloads[i].getHash()) - .removeFromTable(); + downloadsMap.get(downloads[i].getHash()).removeFromTable(); downloadsMap.remove(downloads[i].getHash()); - if (!seedsMap.containsKey(downloads[i] - .getHash())) { + if (!seedsMap.containsKey(downloads[i].getHash())) { SeedContainer sc = new SeedContainer( downloads[i], seedsTable, SWT.NULL); - seedsMap - .put(downloads[i].getHash(), sc); + seedsMap.put(downloads[i].getHash(), sc); } } - DownloadContainer dc = downloadsMap - .get(downloads[i].getHash()); + DownloadContainer dc = downloadsMap.get(downloads[i].getHash()); if (dc != null) { dc.update(false); } - } else if (seedsMap.containsKey(downloads[i] - .getHash())) { - SeedContainer sc = seedsMap.get(downloads[i] - .getHash()); + } else if (seedsMap.containsKey(downloads[i].getHash())) { + SeedContainer sc = seedsMap.get(downloads[i].getHash()); sc.update(false); } redrawTables = true; @@ -1292,28 +1216,25 @@ final ParameterListener pl = new ParameterListener() { - public void azParameter(String key, String value, int type) { - if (key - .equalsIgnoreCase(RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC)) { + public void azParameter (String key, String value, int type) { + if (key.equalsIgnoreCase(RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC)) { azureusUpload = value; refreshStatusBar(); } - if (key - .equalsIgnoreCase(RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC)) { + if (key.equalsIgnoreCase(RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC)) { azureusDownload = value; refreshStatusBar(); } } - public void pluginParameter(String key, String value, int type) { + public void pluginParameter (String key, String value, int type) { if (key.equalsIgnoreCase("singleUserMode")) { bSingleUserMode = Boolean.parseBoolean(value); if (bSingleUserMode) { setStatusBarText( - I18N - .translate("rcmain.mainwindow.statusbar.connectedSingleUser"), + I18N.translate("rcmain.mainwindow.statusbar.connectedSingleUser"), SWT.COLOR_DARK_GREEN); } @@ -1321,7 +1242,7 @@ } - public void coreParameter(String key, String value, int type) { + public void coreParameter (String key, String value, int type) { } }; @@ -1341,8 +1262,7 @@ // Set the tabs to the OS color scheme Display display = RCMain.getRCMain().getDisplay(); - tabFolder.setSelectionForeground(display - .getSystemColor(SWT.COLOR_TITLE_FOREGROUND)); + tabFolder.setSelectionForeground(display.getSystemColor(SWT.COLOR_TITLE_FOREGROUND)); tabFolder.setSelectionBackground(new Color[] { display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND), display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT) }, @@ -1353,14 +1273,14 @@ myTorrents.setToolTipText("Click here to resort the tables"); tabFolder.addMouseListener(new MouseListener() { - public void mouseDoubleClick(MouseEvent arg0) { + public void mouseDoubleClick (MouseEvent arg0) { } - public void mouseDown(MouseEvent arg0) { + public void mouseDown (MouseEvent arg0) { } - public void mouseUp(MouseEvent arg0) { + public void mouseUp (MouseEvent arg0) { CTabItem tab = tabFolder.getSelection(); if (tab.equals(myTorrents)) { redrawTables(); @@ -1394,16 +1314,14 @@ createTableColumns(downloadsTable, DownloadContainer.getColumns()); downloadsTable.addListener(SWT.SetData, new Listener() { - public void handleEvent(Event event) { + public void handleEvent (Event event) { downloadsArray = downloadsMap.values().toArray(emptyArray); if (downloadsArray.length == 0) { return; } - Comparator<Container> data = (Comparator<Container>) downloadsTable - .getData("comparator"); + Comparator<Container> data = (Comparator<Container>) downloadsTable.getData("comparator"); - if (!Boolean.parseBoolean((String) downloadsTable - .getData("sort"))) { + if (!Boolean.parseBoolean((String) downloadsTable.getData("sort"))) { data = Collections.reverseOrder(data); } @@ -1436,7 +1354,7 @@ // Selection listener for the table downloadsTable.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { TableItem[] items = downloadsTable.getSelection(); if (items == null) { return; @@ -1482,7 +1400,7 @@ downloadsTable.addMouseListener(new MouseAdapter() { @Override - public void mouseDown(MouseEvent e) { + public void mouseDown (MouseEvent e) { if (e.button == 1) { if (downloadsTable.getItem(new Point(e.x, e.y)) == null) { downloadsTable.deselectAll(); @@ -1496,7 +1414,7 @@ downloadsTable.addMouseListener(new MouseAdapter() { @Override - public void mouseDoubleClick(MouseEvent e) { + public void mouseDoubleClick (MouseEvent e) { if (e.button == 1) { if (downloadsTable.getItem(new Point(e.x, e.y)) == null) { downloadsTable.deselectAll(); @@ -1536,14 +1454,13 @@ seedsTable.addListener(SWT.SetData, new Listener() { - public void handleEvent(Event event) { + public void handleEvent (Event event) { seedsArray = seedsMap.values().toArray(emptyArray); if (seedsArray.length == 0) { return; } - Comparator<Container> data = (Comparator<Container>) seedsTable - .getData("comparator"); + Comparator<Container> data = (Comparator<Container>) seedsTable.getData("comparator"); if (!Boolean.parseBoolean((String) seedsTable.getData("sort"))) { data = Collections.reverseOrder(data); @@ -1572,7 +1489,7 @@ seedsTable.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { TableItem[] items = seedsTable.getSelection(); if (items == null) { return; @@ -1613,7 +1530,7 @@ seedsTable.addMouseListener(new MouseAdapter() { @Override - public void mouseDown(MouseEvent e) { + public void mouseDown (MouseEvent e) { if (e.button == 1) { if (seedsTable.getItem(new Point(e.x, e.y)) == null) { seedsTable.deselectAll(); @@ -1627,7 +1544,7 @@ seedsTable.addMouseListener(new MouseAdapter() { @Override - public void mouseDoubleClick(MouseEvent e) { + public void mouseDoubleClick (MouseEvent e) { if (e.button == 1) { if (seedsTable.getItem(new Point(e.x, e.y)) == null) { seedsTable.deselectAll(); @@ -1700,7 +1617,7 @@ connectionStatusIcon = new CLabelPadding(statusbarComp, borderFlag); connectionStatusIcon.addListener(SWT.MouseDoubleClick, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (RCMain.getRCMain().connected()) { ServerDetailsTab.open(tabFolder); } @@ -1712,7 +1629,7 @@ sslStatusIcon.setImage(ImageRepository.getImage("ssl_disabled")); sslStatusIcon.setEnabled(false); sslStatusIcon.addListener(SWT.MouseDoubleClick, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (RCMain.getRCMain().connected()) { ServerDetailsTab.open(tabFolder); } @@ -1725,17 +1642,15 @@ // Double click listener for down and up Listener speedUpdate = new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { Client client = RCMain.getRCMain().getClient(); client.transactionStart(); - client - .sendGetAzParameter( - RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, - RemoteConstants.PARAMETER_INT); - client - .sendGetAzParameter( - RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, - RemoteConstants.PARAMETER_INT); + client.sendGetAzParameter( + RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, + RemoteConstants.PARAMETER_INT); + client.sendGetAzParameter( + RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, + RemoteConstants.PARAMETER_INT); client.transactionCommit(); } }; @@ -1746,7 +1661,7 @@ // menus final Menu menuUpSpeed = new Menu(DOWNLOAD_MANAGER_SHELL, SWT.POP_UP); menuUpSpeed.addListener(SWT.Show, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { MenuItem[] items = menuUpSpeed.getItems(); for (int i = 0; i < items.length; i++) { items[i].dispose(); @@ -1767,13 +1682,10 @@ MenuItem item = new MenuItem(menuUpSpeed, SWT.RADIO); item.setText("Unlimited"); item.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - RCMain - .getRCMain() - .getClient() - .sendSetAzParameter( - RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, - "0", RemoteConstants.PARAMETER_INT); + public void handleEvent (Event e) { + RCMain.getRCMain().getClient().sendSetAzParameter( + RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, + "0", RemoteConstants.PARAMETER_INT); azureusUpload = "0"; refreshStatusBar(); } @@ -1783,23 +1695,18 @@ } final SelectionListener speedChangeListener = new SelectionListener() { - public void widgetSelected(SelectionEvent e) { + public void widgetSelected (SelectionEvent e) { if (((MenuItem) e.widget).getSelection()) { - String value = String.valueOf(((MenuItem) e.widget) - .getData("speed")); - RCMain - .getRCMain() - .getClient() - .sendSetAzParameter( - RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, - value, - RemoteConstants.PARAMETER_INT); + String value = String.valueOf(((MenuItem) e.widget).getData("speed")); + RCMain.getRCMain().getClient().sendSetAzParameter( + RemoteConstants.CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC, + value, RemoteConstants.PARAMETER_INT); azureusUpload = value; refreshStatusBar(); } } - public void widgetDefaultSelected(SelectionEvent arg0) { + public void widgetDefaultSelected (SelectionEvent arg0) { } }; @@ -1817,9 +1724,8 @@ if (iAboveBelow[j] >= 5) { item = new MenuItem(menuUpSpeed, SWT.RADIO, (j == 0) ? 1 : menuUpSpeed.getItemCount()); - item.setText(DisplayFormatters - .formatByteCountToKiBEtcPerSec( - iAboveBelow[j] * 1024, true)); + item.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec( + iAboveBelow[j] * 1024, true)); item.setData("speed", new Long(iAboveBelow[j])); item.addSelectionListener(speedChangeListener); @@ -1839,7 +1745,7 @@ final Menu menuDownSpeed = new Menu(DOWNLOAD_MANAGER_SHELL, SWT.POP_UP); menuDownSpeed.addListener(SWT.Show, new Listener() { - public void handleEvent(Event e) { + public void handleEvent (Event e) { MenuItem[] items = menuDownSpeed.getItems(); for (int i = 0; i < items.length; i++) { items[i].dispose(); @@ -1852,20 +1758,17 @@ downLimit = Integer.valueOf(azureusDownload); } final boolean unlim = (downLimit == 0); - if (downLimit == 0) { + if (unlim) { downLimit = 275; } MenuItem item = new MenuItem(menuDownSpeed, SWT.RADIO); item.setText("Unlimited"); item.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event e) { - RCMain - .getRCMain() - .getClient() - .sendSetAzParameter( - RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, - "0", RemoteConstants.PARAMETER_INT); + public void handleEvent (Event e) { + RCMain.getRCMain().getClient().sendSetAzParameter( + RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, + "0", RemoteConstants.PARAMETER_INT); azureusDownload = "0"; refreshStatusBar(); } @@ -1874,24 +1777,19 @@ item.setSelection(true); } final SelectionListener speedChangeListener = new SelectionListener() { - public void widgetSelected(SelectionEvent e) { + public void widgetSelected (SelectionEvent e) { if (((MenuItem) e.widget).getSelection()) { - String value = String.valueOf(((MenuItem) e.widget) - .getData("speed")); - RCMain - .getRCMain() - .getClient() - .sendSetAzParameter( - RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, - value, - RemoteConstants.PARAMETER_INT); + String value = String.valueOf(((MenuItem) e.widget).getData("speed")); + RCMain.getRCMain().getClient().sendSetAzParameter( + RemoteConstants.CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC, + value, RemoteConstants.PARAMETER_INT); azureusDownload = value; refreshStatusBar(); } } - public void widgetDefaultSelected(SelectionEvent arg0) { + public void widgetDefaultSelected (SelectionEvent arg0) { } }; @@ -1908,9 +1806,8 @@ if (iAboveBelow[j] >= 5) { item = new MenuItem(menuDownSpeed, SWT.RADIO, (j == 0) ? 1 : menuDownSpeed.getItemCount()); - item.setText(DisplayFormatters - .formatByteCountToKiBEtcPerSec( - iAboveBelow[j] * 1024, true)); + item.setText(DisplayFormatters.formatByteCountToKiBEtcPerSec( + iAboveBelow[j] * 1024, true)); item.setData("speed", new Long(iAboveBelow[j])); item.addSelectionListener(speedChangeListener); item.setSelection(!unlim @@ -1930,17 +1827,17 @@ DOWNLOAD_MANAGER_SHELL.addShellListener(new ShellListener() { - public void shellActivated(ShellEvent arg0) { + public void shellActivated (ShellEvent arg0) { } - public void shellClosed(ShellEvent event) { + public void shellClosed (ShellEvent event) { logger.warn("Closing Shell!!!"); // Check to see the configs that we are coming in with - boolean sendMainWindowToTray = RCMain.getRCMain() - .getProperties().getPropertyAsBoolean("tray.exit"); - boolean confirmExit = RCMain.getRCMain().getProperties() - .getPropertyAsBoolean("confirm.exit"); + boolean sendMainWindowToTray = RCMain.getRCMain().getProperties().getPropertyAsBoolean( + "tray.exit"); + boolean confirmExit = RCMain.getRCMain().getProperties().getPropertyAsBoolean( + "confirm.exit"); // -----First we need to save everything for the user---\\ @@ -1950,8 +1847,7 @@ int position_x = DOWNLOAD_MANAGER_SHELL.getLocation().x; int position_y = DOWNLOAD_MANAGER_SHELL.getLocation().y; - ExtendedProperties properties = RCMain.getRCMain() - .getProperties(); + ExtendedProperties properties = RCMain.getRCMain().getProperties(); if (!sash.isDisposed()) { int[] weights = sash.getWeights(); @@ -2023,8 +1919,7 @@ DOWNLOAD_MANAGER_SHELL, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL); messageBox.setText("Confirm Exit"); - messageBox - .setMessage("Are you sure you wish to exit AzSMRC entirely?"); + messageBox.setMessage("Are you sure you wish to exit AzSMRC entirely?"); int response = messageBox.open(); switch (response) { case SWT.OK: @@ -2049,8 +1944,8 @@ RCMain.getRCMain().getClient().removeGlobalStatsListener( sul); RCMain.getRCMain().getClient().removeConnectionListener(cl); - RCMain.getRCMain().getClient().getDownloadManager() - .removeListener(dml); + RCMain.getRCMain().getClient().getDownloadManager().removeListener( + dml); RCMain.getRCMain().getClient().removeClientUpdateListener( cul); RCMain.getRCMain().getClient().removeParameterListener(pl); @@ -2063,17 +1958,16 @@ } } - public void shellDeactivated(ShellEvent arg0) { + public void shellDeactivated (ShellEvent arg0) { } - public void shellDeiconified(ShellEvent arg0) { + public void shellDeiconified (ShellEvent arg0) { RCMain.getRCMain().updateTimer(true); - RCMain.getRCMain().getClient().getDownloadManager() - .update(true); + RCMain.getRCMain().getClient().getDownloadManager().update(true); } - public void shellIconified(ShellEvent arg0) { + public void shellIconified (ShellEvent arg0) { if (RCMain.getRCMain().getProperties().getPropertyAsBoolean( "tray.minimize")) { DOWNLOAD_MANAGER_SHELL.setVisible(false); @@ -2114,8 +2008,8 @@ if (RCMain.getRCMain().getRunTime() - properties.getPropertyAsLong("lastDonationQuestion") > DONATION_INTERVAL) { - properties.setProperty("lastDonationQuestion", RCMain.getRCMain() - .getRunTime()); + properties.setProperty("lastDonationQuestion", + RCMain.getRCMain().getRunTime()); // TODO MARC Popup donation tab } @@ -2147,7 +2041,7 @@ // addView(ViewID.MAIN, "MyID", Eventlistener); } - public void close_shell() { + public void close_shell () { if (DOWNLOAD_MANAGER_SHELL != null && !DOWNLOAD_MANAGER_SHELL.isDisposed()) { DOWNLOAD_MANAGER_SHELL.close(); @@ -2155,15 +2049,15 @@ } - public Shell getShell() { + public Shell getShell () { return DOWNLOAD_MANAGER_SHELL; } - public boolean isCollapsed() { + public boolean isCollapsed () { return COLLAPSED; } - public void setCollapsed(boolean state) { + public void setCollapsed (boolean state) { COLLAPSED = state; } @@ -2172,71 +2066,60 @@ * @param connection -- int -- 0 for no connection, 1 for connecting, 2 for * connected */ - public void setConnectionStatusBar(final int connection) { + public void setConnectionStatusBar (final int connection) { Display display = RCMain.getRCMain().getDisplay(); if (display == null) { return; } display.syncExec(new SWTSafeRunnable() { @Override - public void runSafe() { + public void runSafe () { if (connectionStatusIcon == null || connectionStatusIcon.isDisposed()) { return; } if (connection == 0) { - connectionStatusIcon.setImage(ImageRepository - .getImage("connect_no")); - connectionStatusIcon - .setToolTipText("Not Connected to server"); + connectionStatusIcon.setImage(ImageRepository.getImage("connect_no")); + connectionStatusIcon.setToolTipText("Not Connected to server"); } else if (connection == 1) { - connectionStatusIcon.setImage(ImageRepository - .getImage("connect_creating")); - connectionStatusIcon - .setToolTipText("Attempting to connect to server"); + connectionStatusIcon.setImage(ImageRepository.getImage("connect_creating")); + connectionStatusIcon.setToolTipText("Attempting to connect to server"); } else if (connection == 2) { - connectionStatusIcon.setImage(ImageRepository - .getImage("connect_established")); - connectionStatusIcon - .setToolTipText("Connected to server\nDouble-Click for Server Details"); + connectionStatusIcon.setImage(ImageRepository.getImage("connect_established")); + connectionStatusIcon.setToolTipText("Connected to server\nDouble-Click for Server Details"); } } }); } - public void setSSLStatusBar(final boolean benabled, final boolean buse_ssl) { + public void setSSLStatusBar (final boolean benabled, final boolean buse_ssl) { Display display = RCMain.getRCMain().getDisplay(); if (display == null || display.isDisposed()) { return; } display.asyncExec(new SWTSafeRunnable() { @Override - public void runSafe() { + public void runSafe () { if (benabled) { if (buse_ssl) { sslStatusIcon.setEnabled(true); - sslStatusIcon.setImage(ImageRepository - .getImage("ssl_enabled")); - sslStatusIcon - .setToolTipText("SSL Enabled\nDouble-Click for Server Details"); + sslStatusIcon.setImage(ImageRepository.getImage("ssl_enabled")); + sslStatusIcon.setToolTipText("SSL Enabled\nDouble-Click for Server Details"); } else { sslStatusIcon.setEnabled(true); - sslStatusIcon.setImage(ImageRepository - .getImage("ssl_disabled")); - sslStatusIcon - .setToolTipText("SSL Disabled\nDouble-Click for Server Details"); + sslStatusIcon.setImage(ImageRepository.getImage("ssl_disabled")); + sslStatusIcon.setToolTipText("SSL Disabled\nDouble-Click for Server Details"); } } else { - sslStatusIcon.setImage(ImageRepository - .getImage("ssl_disabled")); + sslStatusIcon.setImage(ImageRepository.getImage("ssl_disabled")); sslStatusIcon.setEnabled(false); } } }); } - public void setTorrentMoveButtons(final boolean bTop, final boolean bUp, + public void setTorrentMoveButtons (final boolean bTop, final boolean bUp, final boolean bDown, final boolean bBottom) { Display display = RCMain.getRCMain().getDisplay(); if (display == null || display.isDisposed()) { @@ -2244,7 +2127,7 @@ } display.asyncExec(new SWTSafeRunnable() { @Override - public void runSafe() { + public void runSafe () { if (top.isEnabled() != bTop) { top.setEnabled(bTop); } @@ -2261,16 +2144,15 @@ }); } - public void setUserButton() { + public void setUserButton () { Display display = RCMain.getRCMain().getDisplay(); if (display == null || display.isDisposed()) { return; } display.asyncExec(new SWTSafeRunnable() { @Override - public void runSafe() { - User user = RCMain.getRCMain().getClient().getUserManager() - .getActiveUser(); + public void runSafe () { + User user = RCMain.getRCMain().getClient().getUserManager().getActiveUser(); if (user != null) { manage_users.setEnabled(true); } @@ -2278,14 +2160,14 @@ }); } - public void setLogInOutButtons(final boolean bLoggedIn) { + public void setLogInOutButtons (final boolean bLoggedIn) { Display display = RCMain.getRCMain().getDisplay(); if (display == null || display.isDisposed()) { return; } display.asyncExec(new SWTSafeRunnable() { @Override - public void runSafe() { + public void runSafe () { if (bLoggedIn) { login.setEnabled(false); menuLogin.setEnabled(false); @@ -2337,7 +2219,7 @@ }); } - public void redrawColumnsonTables() { + public void redrawColumnsonTables () { // setRequestedItems(); TableColumn[] columns = downloadsTable.getColumns(); for (TableColumn column : columns) { @@ -2369,14 +2251,14 @@ redrawTables(); } - private void addDownloadManagerMenu(final Table table) { + private void addDownloadManagerMenu (final Table table) { final Menu menu = new Menu(table); final MenuItem queue = new MenuItem(menu, SWT.PUSH); queue.setText("Queue"); queue.setImage(ImageRepository.getImage("menu_queue")); queue.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (table != null || !table.isDisposed()) { TableItem[] items = table.getSelection(); RCMain.getRCMain().getClient().transactionStart(); @@ -2392,7 +2274,7 @@ final MenuItem forceStart = new MenuItem(menu, SWT.CHECK); forceStart.setText("Force Start"); forceStart.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (table != null || !table.isDisposed()) { TableItem[] items = table.getSelection(); RCMain.getRCMain().getClient().transactionStart(); @@ -2410,7 +2292,7 @@ stop.setText("Stop"); stop.setImage(ImageRepository.getImage("menu_stop")); stop.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (table != null || !table.isDisposed()) { TableItem[] items = table.getSelection(); RCMain.getRCMain().getClient().transactionStart(); @@ -2427,7 +2309,7 @@ remove.setText("Remove"); remove.setImage(ImageRepository.getImage("menu_remove")); remove.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (table != null || !table.isDisposed()) { TableItem[] items = table.getSelection(); RCMain.getRCMain().getClient().transactionStart(); @@ -2444,13 +2326,10 @@ } container.getDownload().remove(); - if (seedsMap.containsKey(container.getDownload() - .getHash())) { + if (seedsMap.containsKey(container.getDownload().getHash())) { seedsMap.remove(container.getDownload().getHash()); - } else if (downloadsMap.containsKey(container - .getDownload().getHash())) { - downloadsMap.remove(container.getDownload() - .getHash()); + } else if (downloadsMap.containsKey(container.getDownload().getHash())) { + downloadsMap.remove(container.getDownload().getHash()); } redrawTables(); @@ -2470,7 +2349,7 @@ SWT.PUSH); downloadDeleteTorrent.setText("Delete Torrent File"); downloadDeleteTorrent.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (table != null || !table.isDisposed()) { TableItem[] items = table.getSelection(); RCMain.getRCMain().getClient().transactionStart(); @@ -2488,13 +2367,10 @@ } container.getDownload().remove(true, false); - if (seedsMap.containsKey(container.getDownload() - .getHash())) { + if (seedsMap.containsKey(container.getDownload().getHash())) { seedsMap.remove(container.getDownload().getHash()); - } else if (downloadsMap.containsKey(container - .getDownload().getHash())) { - downloadsMap.remove(container.getDownload() - .getHash()); + } else if (downloadsMap.containsKey(container.getDownload().getHash())) { + downloadsMap.remove(container.getDownload().getHash()); } redrawTables(); } @@ -2508,14 +2384,13 @@ SWT.PUSH); downloadDeleteData.setText("Delete Data"); downloadDeleteData.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event arg0) { + public void handleEvent (Event arg0) { if (table != null || !table.isDisposed()) { TableItem[] items = table.getSelection(); String names = ""; // Pull the names for the dialog for (TableItem item : items) { - names += ((Container) item.getData()).getDownload() - .getName() + names += ((Container) item.getData()).getDownload().getName() + "\n"; } @@ -2523,9... [truncated message content] |