use of com.biglybt.core.Core in project BiglyBT by BiglySoftware.
the class SB_Transfers method addMenuUnwatched.
private void addMenuUnwatched(String id) {
PluginInterface pi = PluginInitializer.getDefaultInterface();
UIManager uim = pi.getUIManager();
MenuManager menuManager = uim.getMenuManager();
MenuItem menuItem = menuManager.addMenuItem("sidebar." + id, "v3.activity.button.watchall");
menuItem.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menuItem.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
CoreWaiterSWT.waitForCore(TriggerInThread.ANY_THREAD, new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
GlobalManager gm = core.getGlobalManager();
List<?> downloadManagers = gm.getDownloadManagers();
for (Iterator<?> iter = downloadManagers.iterator(); iter.hasNext(); ) {
DownloadManager dm = (DownloadManager) iter.next();
if (!PlatformTorrentUtils.getHasBeenOpened(dm) && dm.getAssumedComplete()) {
PlatformTorrentUtils.setHasBeenOpened(dm, true);
}
}
}
});
}
});
}
Aggregations