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)));
}
}
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) {
}
}
}
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);
}
}
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;
}
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);
}
}
Aggregations