Search in sources :

Example 26 with PluginInterface

use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.

the class Handler method getProxy.

private URL getProxy(URL u) throws IOException {
    PluginInterface pi = CoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID("azwebtorrent");
    if (pi == null) {
        installPlugin();
        throw (new IOException("'WebTorrent Support Plugin' is required - go to 'Tools->Plugins->Installation Wizard' to install."));
    }
    IPCInterface ipc = pi.getIPC();
    try {
        URL url = (URL) ipc.invoke("getProxyURL", new Object[] { u });
        return (url);
    } catch (IPCException ipce) {
        Throwable e = ipce;
        if (e.getCause() != null) {
            e = e.getCause();
        }
        throw (new IOException("Communication error with WebTorrent Support Plugin: " + Debug.getNestedExceptionMessage(e)));
    }
}
Also used : PluginInterface(com.biglybt.pif.PluginInterface) IPCException(com.biglybt.pif.ipc.IPCException) IOException(java.io.IOException) IPCInterface(com.biglybt.pif.ipc.IPCInterface) URL(java.net.URL)

Example 27 with PluginInterface

use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.

the class AENameServiceJava9 method checkI2PInstall.

private static void checkI2PInstall(final String host_name) {
    synchronized (AENameServiceJava9.class) {
        if (i2p_checked) {
            return;
        }
        try {
            Core core = CoreFactory.getSingleton();
            if (core != null) {
                i2p_checked = true;
                PluginInterface pi = core.getPluginManager().getDefaultPluginInterface();
                pi.addListener(new PluginAdapter() {

                    @Override
                    public void initializationComplete() {
                        if (I2PHelpers.isI2PInstalled()) {
                            return;
                        }
                        final boolean[] install_outcome = { false };
                        String enable_i2p_reason = MessageText.getString("azneti2phelper.install.reason.dns", new String[] { host_name });
                        I2PHelpers.installI2PHelper(enable_i2p_reason, "azneti2phelper.install.dns.resolve", install_outcome, new Runnable() {

                            @Override
                            public void run() {
                                if (!install_outcome[0]) {
                                }
                            }
                        });
                    }
                });
            }
        } catch (Throwable e) {
        }
    }
}
Also used : PluginAdapter(com.biglybt.pif.PluginAdapter) PluginInterface(com.biglybt.pif.PluginInterface) Core(com.biglybt.core.Core)

Example 28 with PluginInterface

use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.

the class UtilitiesImpl method callWithPluginThreadContext.

public static <T extends Exception> void callWithPluginThreadContext(PluginInterface pi, runnableWithException<T> target) throws T {
    PluginInterface existing = tls.get();
    try {
        tls.set(pi);
        target.run();
    } finally {
        tls.set(existing);
    }
}
Also used : PluginInterface(com.biglybt.pif.PluginInterface)

Example 29 with PluginInterface

use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.

the class MenuManagerImpl method addMenuItem.

@Override
public MenuItem addMenuItem(String menuID, String resource_key) {
    PluginInterface pi = ui_manager.getPluginInterface();
    MenuItemImpl item = new MenuItemImpl(pi, menuID, resource_key);
    MenuItemManager.getInstance().addMenuItem(item);
    return item;
}
Also used : PluginInterface(com.biglybt.pif.PluginInterface)

Example 30 with PluginInterface

use of com.biglybt.pif.PluginInterface in project BiglyBT by BiglySoftware.

the class PlayUtils method playURL.

public static boolean playURL(URL url, String name) {
    try {
        PluginInterface pi = CoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID("azemp");
        if (pi == null || pi.getPluginState().isDisabled()) {
            return (false);
        }
        Class<?> ewp_class = pi.getPlugin().getClass().getClassLoader().loadClass("com.azureus.plugins.azemp.ui.swt.emp.EmbeddedPlayerWindowSWT");
        if (ewp_class != null) {
            Method ow = ewp_class.getMethod("openWindow", URL.class, String.class);
            if (ow != null) {
                ow.invoke(null, url, name);
                return (true);
            }
        }
        return (false);
    } catch (Throwable e) {
        Debug.out(e);
        return (false);
    }
}
Also used : PluginInterface(com.biglybt.pif.PluginInterface) Method(java.lang.reflect.Method)

Aggregations

PluginInterface (com.biglybt.pif.PluginInterface)120 URL (java.net.URL)15 IPCInterface (com.biglybt.pif.ipc.IPCInterface)14 UIManager (com.biglybt.pif.ui.UIManager)13 PluginManager (com.biglybt.pif.PluginManager)12 HashMap (java.util.HashMap)12 List (java.util.List)12 Download (com.biglybt.pif.download.Download)10 MenuItemListener (com.biglybt.pif.ui.menus.MenuItemListener)10 File (java.io.File)10 Map (java.util.Map)10 DownloadManager (com.biglybt.core.download.DownloadManager)9 UIFunctions (com.biglybt.ui.UIFunctions)9 ArrayList (java.util.ArrayList)9 PluginException (com.biglybt.pif.PluginException)8 MenuItem (com.biglybt.pif.ui.menus.MenuItem)8 MenuManager (com.biglybt.pif.ui.menus.MenuManager)8 DHTPlugin (com.biglybt.plugin.dht.DHTPlugin)8 DHT (com.biglybt.core.dht.DHT)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7