Methods Summary |
---|
public static void | asyncPause()
new AEThread( "asyncPause", true )
{
public void
runSupport()
{
AzureusCoreFactory.getSingleton().getGlobalManager().pauseDownloads();
}
}.start();
|
public static void | asyncResume()
new AEThread( "asyncResume", true )
{
public void
runSupport()
{
AzureusCoreFactory.getSingleton().getGlobalManager().resumeDownloads();
}
}.start();
|
public static void | asyncStartAll()
new AEThread( "asyncStartAll", true )
{
public void
runSupport()
{
AzureusCoreFactory.getSingleton().getGlobalManager().startAllDownloads();
}
}.start();
|
public static void | asyncStop(org.gudy.azureus2.core3.download.DownloadManager dm, int stateAfterStopped)
new AEThread( "asyncStop", true )
{
public void
runSupport()
{
dm.stopIt( stateAfterStopped, false, false );
}
}.start();
|
public static void | asyncStopAll()
new AEThread( "asyncStopAll", true )
{
public void
runSupport()
{
AzureusCoreFactory.getSingleton().getGlobalManager().stopAllDownloads();
}
}.start();
|
public static void | asyncStopDelete(org.gudy.azureus2.core3.download.DownloadManager dm, int stateAfterStopped, boolean bDeleteTorrent, boolean bDeleteData, AERunnable deleteFailed)
new AEThread("asyncStop", true) {
public void runSupport() {
try {
dm.getGlobalManager().removeDownloadManager(dm, bDeleteTorrent,
bDeleteData);
} catch (GlobalManagerDownloadRemovalVetoException f) {
if (!f.isSilent()) {
Alerts.showErrorMessageBoxUsingResourceString(new Object[] {
dm
}, "globalmanager.download.remove.veto", f);
}
if (deleteFailed != null) {
deleteFailed.runSupport();
}
} catch (Exception ex) {
Debug.printStackTrace(ex);
if (deleteFailed != null) {
deleteFailed.runSupport();
}
}
}
}.start();
|
public static void | host(com.aelitis.azureus.core.AzureusCore azureus_core, org.gudy.azureus2.core3.download.DownloadManager dm, org.eclipse.swt.widgets.Composite panel)
if(dm == null)
return;
TOTorrent torrent = dm.getTorrent();
if (torrent != null) {
try {
azureus_core.getTrackerHost().hostTorrent(torrent, true, false );
} catch (TRHostException e) {
MessageBox mb = new MessageBox(panel.getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText(MessageText.getString("MyTorrentsView.menu.host.error.title"));
mb.setMessage(MessageText.getString("MyTorrentsView.menu.host.error.message").concat("\n").concat(e.toString()));
mb.open();
}
}
|
public static boolean | isForceStartable(org.gudy.azureus2.core3.download.DownloadManager dm)
if(dm == null){
return false;
}
int state = dm.getState();
if ( state != DownloadManager.STATE_STOPPED && state != DownloadManager.STATE_QUEUED &&
state != DownloadManager.STATE_SEEDING && state != DownloadManager.STATE_DOWNLOADING){
return( false );
}
return( true );
|
public static boolean | isStartable(org.gudy.azureus2.core3.download.DownloadManager dm)
if(dm == null)
return false;
int state = dm.getState();
if (state != DownloadManager.STATE_STOPPED) {
return false;
}
return true;
|
public static boolean | isStopable(org.gudy.azureus2.core3.download.DownloadManager dm)
if(dm == null)
return false;
int state = dm.getState();
if ( state == DownloadManager.STATE_STOPPED ||
state == DownloadManager.STATE_STOPPING ) {
return false;
}
return true;
|
public static boolean | isStopped(org.gudy.azureus2.core3.download.DownloadManager dm)
if(dm == null)
return false;
int state = dm.getState();
if ( state == DownloadManager.STATE_STOPPED ||
state == DownloadManager.STATE_ERROR ) {
return true;
}
return false;
|
public static void | open(org.gudy.azureus2.core3.download.DownloadManager dm)Opens the parent folder of dm's path
if (dm != null)
open(dm.getSaveLocation());
|
public static void | open(java.io.File f)
while (f != null && !f.exists())
f = f.getParentFile();
if (f == null)
return;
PlatformManager mgr = PlatformManagerFactory.getPlatformManager();
if (mgr.hasCapability(PlatformManagerCapabilities.ShowFileInBrowser)) {
try {
PlatformManagerFactory.getPlatformManager().showFile(f.toString());
return;
} catch (PlatformManagerException e) {
Debug.printStackTrace(e);
}
}
if (f.isDirectory()) {
Utils.launch(f.toString()); // default launcher
} else {
Utils.launch(f.getParent().toString());
}
|
public static void | publish(com.aelitis.azureus.core.AzureusCore azureus_core, org.gudy.azureus2.core3.download.DownloadManager dm, org.eclipse.swt.widgets.Composite panel)
if(dm == null)
return;
TOTorrent torrent = dm.getTorrent();
if (torrent != null) {
try {
azureus_core.getTrackerHost().publishTorrent(torrent);
} catch (TRHostException e) {
MessageBox mb = new MessageBox(panel.getShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText(MessageText.getString("MyTorrentsView.menu.host.error.title"));
mb.setMessage(MessageText.getString("MyTorrentsView.menu.host.error.message").concat("\n").concat(e.toString()));
mb.open();
}
}
|
public static void | queue(org.gudy.azureus2.core3.download.DownloadManager dm, org.eclipse.swt.widgets.Composite panel)
if (dm != null) {
if (dm.getState() == DownloadManager.STATE_STOPPED){
dm.setStateQueued();
/* parg - removed this - why would we want to effectively stop + restart
* torrents that are running? This is what happens if the code is left in.
* e.g. select two torrents, one stopped and one downloading, then hit "queue"
}else if ( dm.getState() == DownloadManager.STATE_DOWNLOADING ||
dm.getState() == DownloadManager.STATE_SEEDING) {
stop(dm,panel,DownloadManager.STATE_QUEUED);
*/
}
}
|
public static void | remove(org.gudy.azureus2.core3.download.DownloadManager dm, org.eclipse.swt.widgets.Shell shell, boolean bDeleteTorrent, boolean bDeleteData)
remove(dm, shell, bDeleteTorrent, bDeleteData, null);
|
public static void | remove(org.gudy.azureus2.core3.download.DownloadManager dm, org.eclipse.swt.widgets.Shell shell, boolean bDeleteTorrent, boolean bDeleteData, AERunnable deleteFailed)
if (!dm.getDownloadState().getFlag(DownloadManagerState.FLAG_LOW_NOISE)) {
if (COConfigurationManager.getBooleanParameter("confirm_torrent_removal")) {
String title = MessageText.getString("deletedata.title");
String text = MessageText.getString("deletetorrent.message1")
+ dm.getDisplayName() + " :\n" + dm.getTorrentFileName()
+ MessageText.getString("deletetorrent.message2");
MessageBoxShell mb = new MessageBoxShell(shell, title, text,
new String[] {
MessageText.getString("Button.yes"),
MessageText.getString("Button.no"),
}, 1);
mb.setRelatedObject(dm);
mb.setLeftImage(SWT.ICON_WARNING);
int result = mb.open();
if (result != 0) {
if (deleteFailed != null) {
deleteFailed.runSupport();
}
return;
}
}
boolean confirmDataDelete = COConfigurationManager.getBooleanParameter(
"Confirm Data Delete");
if (confirmDataDelete && bDeleteData) {
String path = dm.getSaveLocation().toString();
String title = MessageText.getString("deletedata.title");
String text = MessageText.getString("deletedata.message1")
+ dm.getDisplayName() + " :\n" + path
+ MessageText.getString("deletedata.message2");
MessageBoxShell mb = new MessageBoxShell(shell, title, text,
new String[] {
MessageText.getString("Button.yes"),
MessageText.getString("Button.no"),
}, 1);
mb.setRelatedObject(dm);
mb.setLeftImage(SWT.ICON_WARNING);
int result = mb.open();
if (result != 0) {
if (deleteFailed != null) {
deleteFailed.runSupport();
}
return;
}
}
}
asyncStopDelete(dm, DownloadManager.STATE_STOPPED, bDeleteTorrent,
bDeleteData, deleteFailed);
|
public static void | run(org.gudy.azureus2.core3.download.DownloadManager dm)
if(dm != null) {
Utils.launch(dm.getSaveLocation().toString());
}
|
public static void | start(org.gudy.azureus2.core3.download.DownloadManager dm)
if (dm != null && dm.getState() == DownloadManager.STATE_STOPPED) {
dm.setStateWaiting();
}
|
public static void | stop(org.gudy.azureus2.core3.download.DownloadManager dm, org.eclipse.swt.widgets.Shell shell)
stop(dm, shell, DownloadManager.STATE_STOPPED);
|
public static void | stop(org.gudy.azureus2.core3.download.DownloadManager dm, org.eclipse.swt.widgets.Shell shell, int stateAfterStopped)
if (dm == null) {
return;
}
int state = dm.getState();
if (state == DownloadManager.STATE_STOPPED
|| state == DownloadManager.STATE_STOPPING
|| state == stateAfterStopped) {
return;
}
boolean stopme = true;
if (state == DownloadManager.STATE_SEEDING) {
if (dm.getStats().getShareRatio() >= 0
&& dm.getStats().getShareRatio() < 1000
&& COConfigurationManager.getBooleanParameter("Alert on close", false)) {
if (shell == null) {
shell = Utils.findAnyShell();
}
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
| SWT.YES | SWT.NO);
mb.setText(MessageText.getString("seedmore.title"));
mb.setMessage(MessageText.getString("seedmore.shareratio")
+ (dm.getStats().getShareRatio() / 10) + "%.\n"
+ MessageText.getString("seedmore.uploadmore"));
int action = mb.open();
stopme = action == SWT.YES;
} else if (dm.getDownloadState().isOurContent()
&& dm.getStats().getAvailability() < 2) {
TRTrackerScraperResponse scrape = dm.getTrackerScrapeResponse();
int numSeeds = scrape.getSeeds();
long seedingStartedOn = dm.getStats().getTimeStartedSeeding();
if ((numSeeds > 0) &&
(seedingStartedOn > 0) &&
(scrape.getScrapeStartTime() > seedingStartedOn))
numSeeds--;
if (numSeeds == 0) {
stopme = Utils.execSWTThreadWithBool("stopSeeding",
new AERunnableBoolean() {
public boolean runSupport() {
String title = MessageText.getString("Content.alert.notuploaded.title");
String text = MessageText.getString("Content.alert.notuploaded.text",
new String[] {
dm.getDisplayName(),
MessageText.getString("Content.alert.notuploaded.stop")
});
MessageBoxShell mb = new MessageBoxShell(Utils.findAnyShell(),
title, text, new String[] {
MessageText.getString("Content.alert.notuploaded.button.stop"),
MessageText.getString("Content.alert.notuploaded.button.continue")
}, 1, null, null, false, 0);
mb.setRelatedObject(dm);
return mb.open() == 0;
}
});
}
}
}
if (stopme) {
asyncStop(dm, stateAfterStopped);
}
|