Search in sources :

Example 16 with AERunnable

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);
        }
    });
}
Also used : AERunnable(com.biglybt.core.util.AERunnable) DelayedEvent(com.biglybt.core.util.DelayedEvent) BasicPluginConfigModel(com.biglybt.pif.ui.model.BasicPluginConfigModel)

Example 17 with AERunnable

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);
            }
        }
    });
}
Also used : AERunnable(com.biglybt.core.util.AERunnable)

Example 18 with AERunnable

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);
}
Also used : AERunnable(com.biglybt.core.util.AERunnable)

Example 19 with AERunnable

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());
}
Also used : AERunnable(com.biglybt.core.util.AERunnable) TOTorrent(com.biglybt.core.torrent.TOTorrent)

Example 20 with AERunnable

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);
            }
        }
    });
}
Also used : AERunnable(com.biglybt.core.util.AERunnable)

Aggregations

AERunnable (com.biglybt.core.util.AERunnable)92 GridLayout (org.eclipse.swt.layout.GridLayout)12 DownloadManager (com.biglybt.core.download.DownloadManager)11 Image (org.eclipse.swt.graphics.Image)10 ArrayList (java.util.ArrayList)9 GridData (org.eclipse.swt.layout.GridData)9 CoreRunningListener (com.biglybt.core.CoreRunningListener)7 File (java.io.File)7 PEPeer (com.biglybt.core.peer.PEPeer)6 Shell (org.eclipse.swt.widgets.Shell)6 Core (com.biglybt.core.Core)5 ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)5 Point (org.eclipse.swt.graphics.Point)5 PEPeerManager (com.biglybt.core.peer.PEPeerManager)4 Subscription (com.biglybt.core.subs.Subscription)3 TableColumnCore (com.biglybt.ui.common.table.TableColumnCore)3 UISWTViewEvent (com.biglybt.ui.swt.pif.UISWTViewEvent)3 MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)3 MouseAdapter (org.eclipse.swt.events.MouseAdapter)3 MouseEvent (org.eclipse.swt.events.MouseEvent)3