Search in sources :

Example 16 with UISWTInstance

use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.

the class PiecesView method registerPluginViews.

private void registerPluginViews(final UISWTInstance pluginUI) {
    if (pluginUI == null || registeredCoreSubViews) {
        return;
    }
    pluginUI.addView(TableManager.TABLE_TORRENT_PIECES, "PieceInfoView", PieceInfoView.class, manager);
    pluginUI.addView(TableManager.TABLE_TORRENT_PIECES, "MyPieceDistributionView", MyPieceDistributionView.class, manager);
    registeredCoreSubViews = true;
    final UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
    uiManager.addUIListener(new UIManagerListener() {

        @Override
        public void UIAttached(UIInstance instance) {
        }

        @Override
        public void UIDetached(UIInstance instance) {
            if (!(instance instanceof UISWTInstance)) {
                return;
            }
            registeredCoreSubViews = false;
            pluginUI.removeViews(TableManager.TABLE_TORRENT_PIECES, "PieceInfoView");
            pluginUI.removeViews(TableManager.TABLE_TORRENT_PIECES, "MyPieceDistributionView");
            uiManager.removeUIListener(this);
        }
    });
}
Also used : UIManager(com.biglybt.pif.ui.UIManager) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance) UIManagerListener(com.biglybt.pif.ui.UIManagerListener) UIInstance(com.biglybt.pif.ui.UIInstance)

Example 17 with UISWTInstance

use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.

the class PiecesView method initYourTableView.

// @see com.biglybt.ui.swt.views.table.impl.TableViewTab#initYourTableView()
@Override
public TableViewSWT<PEPiece> initYourTableView() {
    tv = TableViewFactory.createTableViewSWT(PEPiece.class, TableManager.TABLE_TORRENT_PIECES, getPropertiesPrefix(), basicItems, basicItems[0].getName(), SWT.SINGLE | SWT.FULL_SELECTION | SWT.VIRTUAL);
    tv.setEnableTabViews(enable_tabs, true, null);
    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
    if (uiFunctions != null) {
        UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
        registerPluginViews(pluginUI);
    }
    tv.addTableDataSourceChangedListener(this, true);
    tv.addMenuFillListener(this);
    tv.addLifeCycleListener(this);
    tv.addSelectionListener(this, false);
    return tv;
}
Also used : PEPiece(com.biglybt.core.peer.PEPiece) UIFunctionsSWT(com.biglybt.ui.swt.UIFunctionsSWT) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance)

Example 18 with UISWTInstance

use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.

the class FilesView method registerPluginViews.

private void registerPluginViews(final UISWTInstance pluginUI) {
    if (pluginUI == null || registeredCoreSubViews) {
        return;
    }
    DownloadManager manager;
    if (managers.size() == 1) {
        manager = managers.get(0);
    } else {
        manager = null;
    }
    pluginUI.addView(TableManager.TABLE_TORRENT_FILES, "FileInfoView", FileInfoView.class, manager);
    registeredCoreSubViews = true;
    final UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
    uiManager.addUIListener(new UIManagerListener() {

        @Override
        public void UIAttached(UIInstance instance) {
        }

        @Override
        public void UIDetached(UIInstance instance) {
            if (!(instance instanceof UISWTInstance)) {
                return;
            }
            registeredCoreSubViews = false;
            pluginUI.removeViews(TableManager.TABLE_TORRENT_FILES, "FileInfoView");
            uiManager.removeUIListener(this);
        }
    });
}
Also used : UIManager(com.biglybt.pif.ui.UIManager) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance) UIManagerListener(com.biglybt.pif.ui.UIManagerListener) DownloadManager(com.biglybt.core.download.DownloadManager) UIInstance(com.biglybt.pif.ui.UIInstance)

Example 19 with UISWTInstance

use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.

the class MainMenuV3 method builFileMenu.

/**
 * Builds the File menu dynamically
 * @param fileMenu
 */
private void builFileMenu(Menu fileMenu) {
    MenuItem openMenuItem = MenuFactory.createOpenMenuItem(fileMenu);
    Menu openSubMenu = openMenuItem.getMenu();
    MenuFactory.addOpenTorrentMenuItem(openSubMenu);
    MenuFactory.addOpenURIMenuItem(openSubMenu);
    MenuFactory.addOpenTorrentForTrackingMenuItem(openSubMenu);
    MenuFactory.addOpenVuzeFileMenuItem(openSubMenu);
    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode > 0) {
        Menu shareSubMenu = MenuFactory.createShareMenuItem(fileMenu).getMenu();
        MenuFactory.addShareFileMenuItem(shareSubMenu);
        MenuFactory.addShareFolderMenuItem(shareSubMenu);
        MenuFactory.addShareFolderContentMenuItem(shareSubMenu);
        MenuFactory.addShareFolderContentRecursiveMenuItem(shareSubMenu);
    }
    MenuFactory.addCreateMenuItem(fileMenu);
    if (!Constants.isOSX) {
        MenuFactory.addSeparatorMenuItem(fileMenu);
        MenuFactory.addCloseWindowMenuItem(fileMenu);
        MenuFactory.addCloseDetailsMenuItem(fileMenu);
        MenuFactory.addCloseDownloadBarsToMenu(fileMenu);
    }
    MenuFactory.addSeparatorMenuItem(fileMenu);
    MenuFactory.createTransfersMenuItem(fileMenu);
    /*
		 * No need for restart and exit on OS X since it's already handled on the application menu
		 */
    if (!Constants.isOSX) {
        MenuFactory.addSeparatorMenuItem(fileMenu);
        MenuFactory.addRestartMenuItem(fileMenu);
    }
    if (Constants.isCVSVersion() && !UI.isFirstUI()) {
        MenuItem itemLogout = new MenuItem(fileMenu, SWT.PUSH);
        itemLogout.setText("Shutdown UI (Keep " + Constants.APP_NAME + " running)");
        itemLogout.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
                if (uiFunctions != null) {
                    UISWTInstance uiSWTInstance = uiFunctions.getUISWTInstance();
                    if (uiSWTInstance instanceof UIInstanceFactory) {
                        try {
                            PluginInterface pi = PluginInitializer.getDefaultInterface();
                            pi.getUIManager().detachUI((UIInstanceFactory) uiSWTInstance);
                        } catch (UIException e1) {
                            e1.printStackTrace();
                        }
                    }
                }
            }
        });
    }
    if (!Constants.isOSX) {
        MenuFactory.addExitMenuItem(fileMenu);
    }
}
Also used : PluginInterface(com.biglybt.pif.PluginInterface) UIException(com.biglybt.pif.ui.UIException) IMainMenu(com.biglybt.ui.swt.mainwindow.IMainMenu) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance) UIInstanceFactory(com.biglybt.pif.ui.UIInstanceFactory)

Example 20 with UISWTInstance

use of com.biglybt.ui.swt.pif.UISWTInstance in project BiglyBT by BiglySoftware.

the class SBC_ArchivedDownloadsView method registerPluginViews.

private void registerPluginViews(final UISWTInstance pluginUI) {
    if (registeredCoreSubViews) {
        return;
    }
    pluginUI.addView(TABLE_NAME, "ArchivedFilesView", ArchivedFilesView.class, null);
    registeredCoreSubViews = true;
    final UIManager uiManager = PluginInitializer.getDefaultInterface().getUIManager();
    uiManager.addUIListener(new UIManagerListener() {

        @Override
        public void UIAttached(UIInstance instance) {
        }

        @Override
        public void UIDetached(UIInstance instance) {
            if (!(instance instanceof UISWTInstance)) {
                return;
            }
            registeredCoreSubViews = false;
            pluginUI.removeViews(TABLE_NAME, "ArchivedFilesView");
            uiManager.removeUIListener(this);
        }
    });
}
Also used : UIManager(com.biglybt.pif.ui.UIManager) UISWTInstance(com.biglybt.ui.swt.pif.UISWTInstance) UIManagerListener(com.biglybt.pif.ui.UIManagerListener) UIInstance(com.biglybt.pif.ui.UIInstance)

Aggregations

UISWTInstance (com.biglybt.ui.swt.pif.UISWTInstance)22 UIManagerListener (com.biglybt.pif.ui.UIManagerListener)12 UIInstance (com.biglybt.pif.ui.UIInstance)10 UIManager (com.biglybt.pif.ui.UIManager)10 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)10 DownloadManager (com.biglybt.core.download.DownloadManager)5 PluginInterface (com.biglybt.pif.PluginInterface)4 UISWTViewEventListenerWrapper (com.biglybt.ui.swt.pif.UISWTInstance.UISWTViewEventListenerWrapper)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)2 PEPeer (com.biglybt.core.peer.PEPeer)2 MenuItem (com.biglybt.pif.ui.menus.MenuItem)2 MenuItemListener (com.biglybt.pif.ui.menus.MenuItemListener)2 UIFunctions (com.biglybt.ui.UIFunctions)2 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)2 SelectedContentListener (com.biglybt.ui.selectedcontent.SelectedContentListener)2 TabbedMdiMaximizeListener (com.biglybt.ui.swt.mdi.TabbedMdiMaximizeListener)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Core (com.biglybt.core.Core)1