use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class DownloadRemoveRulesPlugin method initialize.
@Override
public void initialize(PluginInterface _plugin_interface) {
plugin_interface = _plugin_interface;
log = plugin_interface.getLogger().getChannel("DLRemRules");
BasicPluginConfigModel config = plugin_interface.getUIManager().createBasicPluginConfigModel("torrents", "download.removerules.name");
config.addLabelParameter2("download.removerules.unauthorised.info");
remove_unauthorised = config.addBooleanParameter2("download.removerules.unauthorised", "download.removerules.unauthorised", false);
remove_unauthorised_seeding_only = config.addBooleanParameter2("download.removerules.unauthorised.seedingonly", "download.removerules.unauthorised.seedingonly", true);
remove_unauthorised_data = config.addBooleanParameter2("download.removerules.unauthorised.data", "download.removerules.unauthorised.data", false);
remove_unauthorised.addEnabledOnSelection(remove_unauthorised_seeding_only);
remove_unauthorised.addEnabledOnSelection(remove_unauthorised_data);
remove_update_torrents = config.addBooleanParameter2("download.removerules.updatetorrents", "download.removerules.updatetorrents", true);
new DelayedEvent("DownloadRemovalRules", INITIAL_DELAY, new AERunnable() {
@Override
public void runSupport() {
plugin_interface.getDownloadManager().addListener(DownloadRemoveRulesPlugin.this);
}
});
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class DownloadRemoveRulesPlugin method removeDownloadDelayed.
protected void removeDownloadDelayed(final Download download, final boolean remove_data) {
monitored_downloads.remove(download);
// we need to delay this because other actions may be being performed
// on the download (e.g. completion may trigger update install)
plugin_interface.getUtilities().createThread("delayedRemoval", new AERunnable() {
@Override
public void runSupport() {
try {
Thread.sleep(DELAYED_REMOVAL_PERIOD);
removeDownload(download, remove_data);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
});
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class NATTraverser method attemptTraversal.
public NATTraversal attemptTraversal(final NATTraversalHandler handler, final InetSocketAddress target, final Map request, boolean sync, final NATTraversalObserver listener) {
final NATTraversal traversal = new NATTraversal() {
private boolean cancelled;
@Override
public void cancel() {
cancelled = true;
}
@Override
public boolean isCancelled() {
return (cancelled);
}
};
if (sync) {
syncTraverse(handler, target, request, listener);
} else {
if (thread_pool.getQueueSize() >= MAX_QUEUE_SIZE) {
Debug.out("NATTraversal queue full");
listener.failed(NATTraversalObserver.FT_QUEUE_FULL);
} else {
thread_pool.run(new AERunnable() {
@Override
public void runSupport() {
if (traversal.isCancelled()) {
listener.failed(NATTraversalObserver.FT_CANCELLED);
} else {
syncTraverse(handler, target, request, listener);
}
}
});
}
}
return (traversal);
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class CertificateTrustWindow method trustCertificate.
@Override
public boolean trustCertificate(final String _resource, final X509Certificate cert) {
final Display display = Utils.getDisplay();
if (display.isDisposed()) {
return (false);
}
TOTorrent torrent = TorrentUtils.getTLSTorrent();
final String resource;
if (torrent != null) {
resource = TorrentUtils.getLocalisedName(torrent) + "\n" + _resource;
} else {
resource = _resource;
}
final trustDialog[] dialog = new trustDialog[1];
try {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
dialog[0] = new trustDialog(display, resource, cert);
}
}, false);
} catch (Throwable e) {
Debug.printStackTrace(e);
return (false);
}
return (dialog[0].getTrusted());
}
use of com.biglybt.core.util.AERunnable in project BiglyBT by BiglySoftware.
the class SimpleTextEntryWindow method setTextLimit.
@Override
public void setTextLimit(int limit) {
textLimit = limit;
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (text_entry_combo != null && !text_entry_combo.isDisposed()) {
text_entry_combo.setTextLimit(textLimit);
}
if (text_entry_text != null && !text_entry_text.isDisposed()) {
text_entry_text.setTextLimit(textLimit);
}
}
});
}
Aggregations