Search in sources :

Example 71 with Core

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);
                        }
                    }
                }
            });
        }
    });
}
Also used : PluginInterface(com.biglybt.pif.PluginInterface) UIManager(com.biglybt.pif.ui.UIManager) MenuItem(com.biglybt.pif.ui.menus.MenuItem) DownloadManager(com.biglybt.core.download.DownloadManager) GlobalManager(com.biglybt.core.global.GlobalManager) MenuManager(com.biglybt.pif.ui.menus.MenuManager) CoreRunningListener(com.biglybt.core.CoreRunningListener) MenuItemListener(com.biglybt.pif.ui.menus.MenuItemListener) Core(com.biglybt.core.Core)

Aggregations

Core (com.biglybt.core.Core)71 CoreRunningListener (com.biglybt.core.CoreRunningListener)37 DownloadManager (com.biglybt.core.download.DownloadManager)17 CoreLifecycleAdapter (com.biglybt.core.CoreLifecycleAdapter)12 GlobalManager (com.biglybt.core.global.GlobalManager)10 File (java.io.File)9 GridLayout (org.eclipse.swt.layout.GridLayout)8 UIFunctions (com.biglybt.ui.UIFunctions)6 Composite (org.eclipse.swt.widgets.Composite)6 ParameterListener (com.biglybt.core.config.ParameterListener)5 LogAlert (com.biglybt.core.logging.LogAlert)5 TOTorrent (com.biglybt.core.torrent.TOTorrent)5 AERunnable (com.biglybt.core.util.AERunnable)5 GridData (org.eclipse.swt.layout.GridData)5 DownloadManagerInitialisationAdapter (com.biglybt.core.download.DownloadManagerInitialisationAdapter)4 PluginInterface (com.biglybt.pif.PluginInterface)4 TableColumnCore (com.biglybt.ui.common.table.TableColumnCore)4 ArrayList (java.util.ArrayList)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 MessageText (com.biglybt.core.internat.MessageText)3