use of com.biglybt.pif.update.UpdateCheckInstance in project BiglyBT by BiglySoftware.
the class BetaWizard method onClose.
@Override
public void onClose() {
super.onClose();
if (finished) {
COConfigurationManager.setParameter("Beta Programme Enabled", beta_enabled);
if (!beta_enabled && Constants.IS_CVS_VERSION) {
MessageBoxShell mb = new MessageBoxShell(SWT.ICON_INFORMATION | SWT.OK, MessageText.getString("beta.wizard.disable.title"), MessageText.getString("beta.wizard.disable.text"));
mb.open(null);
} else if (beta_enabled && !beta_was_enabled) {
UpdateMonitor.getSingleton(CoreFactory.getSingleton()).performCheck(true, false, false, new UpdateCheckInstanceListener() {
@Override
public void cancelled(UpdateCheckInstance instance) {
}
@Override
public void complete(UpdateCheckInstance instance) {
}
});
}
}
}
use of com.biglybt.pif.update.UpdateCheckInstance in project BiglyBT by BiglySoftware.
the class PlayerInstaller method cancel.
public void cancel() {
UpdateCheckInstance to_cancel = null;
synchronized (this) {
cancelled = true;
to_cancel = instance;
}
if (to_cancel != null) {
to_cancel.cancel();
}
}
use of com.biglybt.pif.update.UpdateCheckInstance in project BiglyBT by BiglySoftware.
the class PlayerInstaller method install.
public boolean install() {
try {
installer = CoreFactory.getSingleton().getPluginManager().getPluginInstaller();
StandardPlugin sp = installer.getStandardPlugin("azemp");
Map<Integer, Object> properties = new HashMap<>();
properties.put(UpdateCheckInstance.PT_UI_STYLE, UpdateCheckInstance.PT_UI_STYLE_NONE);
properties.put(UpdateCheckInstance.PT_UI_DISABLE_ON_SUCCESS_SLIDEY, true);
final AESemaphore sem = new AESemaphore("emp install");
final boolean[] result = new boolean[1];
instance = installer.install(new InstallablePlugin[] { sp }, false, properties, new PluginInstallationListener() {
@Override
public void completed() {
result[0] = true;
if (listener != null) {
listener.finished();
}
sem.release();
}
@Override
public void cancelled() {
result[0] = false;
if (listener != null) {
listener.finished();
}
sem.release();
}
@Override
public void failed(PluginException e) {
result[0] = false;
if (listener != null) {
listener.finished();
}
sem.release();
}
});
boolean kill_it;
synchronized (this) {
kill_it = cancelled;
}
if (kill_it) {
instance.cancel();
return (false);
}
instance.addListener(new UpdateCheckInstanceListener() {
@Override
public void cancelled(UpdateCheckInstance instance) {
}
@Override
public void complete(UpdateCheckInstance instance) {
Update[] updates = instance.getUpdates();
for (final Update update : updates) {
ResourceDownloader[] rds = update.getDownloaders();
for (ResourceDownloader rd : rds) {
rd.addListener(new ResourceDownloaderAdapter() {
@Override
public void reportActivity(ResourceDownloader downloader, String activity) {
}
@Override
public void reportPercentComplete(ResourceDownloader downloader, int percentage) {
if (listener != null) {
listener.progress(percentage);
}
}
});
}
}
}
});
sem.reserve();
return result[0];
} catch (Throwable e) {
}
return false;
}
use of com.biglybt.pif.update.UpdateCheckInstance in project BiglyBT by BiglySoftware.
the class SimplePluginInstaller method install.
public boolean install() {
try {
installer = CoreFactory.getSingleton().getPluginManager().getPluginInstaller();
StandardPlugin sp = installer.getStandardPlugin(plugin_id);
if (sp == null) {
throw (new Exception("Unknown plugin"));
}
Map<Integer, Object> properties = new HashMap<>();
properties.put(UpdateCheckInstance.PT_UI_STYLE, UpdateCheckInstance.PT_UI_STYLE_NONE);
properties.put(UpdateCheckInstance.PT_UI_DISABLE_ON_SUCCESS_SLIDEY, true);
final AESemaphore sem = new AESemaphore("plugin-install");
final Object[] result = new Object[] { null };
instance = installer.install(new InstallablePlugin[] { sp }, false, properties, new PluginInstallationListener() {
@Override
public void completed() {
synchronized (SimplePluginInstaller.this) {
completed = true;
}
result[0] = true;
if (listener != null) {
listener.finished();
}
sem.release();
}
@Override
public void cancelled() {
result[0] = new Exception("Cancelled");
if (listener != null) {
listener.finished();
}
sem.release();
}
@Override
public void failed(PluginException e) {
result[0] = e;
if (listener != null) {
listener.finished();
}
sem.release();
}
});
boolean kill_it;
synchronized (this) {
kill_it = cancelled;
}
if (kill_it) {
instance.cancel();
action_listener.actionComplete(new Exception("Cancelled"));
return (false);
}
instance.addListener(new UpdateCheckInstanceListener() {
@Override
public void cancelled(UpdateCheckInstance instance) {
}
@Override
public void complete(UpdateCheckInstance instance) {
Update[] updates = instance.getUpdates();
for (final Update update : updates) {
ResourceDownloader[] rds = update.getDownloaders();
for (ResourceDownloader rd : rds) {
rd.addListener(new ResourceDownloaderAdapter() {
@Override
public void reportActivity(ResourceDownloader downloader, String activity) {
}
@Override
public void reportPercentComplete(ResourceDownloader downloader, int percentage) {
if (listener != null) {
listener.progress(percentage);
}
}
});
}
}
}
});
sem.reserve();
action_listener.actionComplete(result[0]);
return (result[0] instanceof Boolean);
} catch (Throwable e) {
if (listener != null) {
listener.finished();
}
action_listener.actionComplete(e);
}
return false;
}
use of com.biglybt.pif.update.UpdateCheckInstance in project BiglyBT by BiglySoftware.
the class SimplePluginInstaller method cancel.
public void cancel() {
UpdateCheckInstance to_cancel = null;
synchronized (this) {
if (completed) {
return;
}
cancelled = true;
to_cancel = instance;
}
if (to_cancel != null) {
to_cancel.cancel();
}
action_listener.actionComplete(new Exception("Cancelled"));
}
Aggregations