Search in sources :

Example 6 with ViewManagerSWT

use of com.biglybt.ui.swt.views.ViewManagerSWT in project BiglyBT by BiglySoftware.

the class StatsView method registerPluginViews.

private static void registerPluginViews() {
    ViewManagerSWT vm = ViewManagerSWT.getInstance();
    if (vm.areCoreViewsRegistered(VIEW_ID)) {
        return;
    }
    vm.registerView(VIEW_ID, new UISWTViewBuilderCore(ActivityView.MSGID_PREFIX, null, ActivityView.class));
    vm.registerView(VIEW_ID, new UISWTViewBuilderCore(TransferStatsView.MSGID_PREFIX, null, TransferStatsView.class));
    vm.registerView(VIEW_ID, new UISWTViewBuilderCore(CacheView.MSGID_PREFIX, null, CacheView.class));
    vm.registerView(VIEW_ID, new UISWTViewBuilderCore(TrackerActivityView.MSGID_PREFIX, null, TrackerActivityView.class));
    boolean hasV4 = NetworkAdmin.getSingleton().hasDHTIPV4();
    if (hasV4) {
        vm.registerView(VIEW_ID, new UISWTViewBuilderCore(DHTView.MSGID_PREFIX, null, DHTView.class).setInitialDatasource(DHTView.DHT_TYPE_MAIN));
        vm.registerView(VIEW_ID, new UISWTViewBuilderCore(DHTOpsView.MSGID_PREFIX, null, DHTOpsView.class).setInitialDatasource(DHTOpsView.DHT_TYPE_MAIN));
        vm.registerView(VIEW_ID, new UISWTViewBuilderCore(VivaldiView.MSGID_PREFIX, null, VivaldiView.class).setInitialDatasource(VivaldiView.DHT_TYPE_MAIN));
    }
    if (NetworkAdmin.getSingleton().hasDHTIPV6()) {
        vm.registerView(VIEW_ID, new UISWTViewBuilderCore(DHTView.MSGID_PREFIX + ".6", null, DHTView.class).setInitialDatasource(VivaldiView.DHT_TYPE_MAIN_V6));
        if (!hasV4) {
            vm.registerView(VIEW_ID, new UISWTViewBuilderCore(DHTOpsView.MSGID_PREFIX + ".6", null, DHTOpsView.class).setInitialDatasource(DHTOpsView.DHT_TYPE_MAIN_V6));
        }
        vm.registerView(VIEW_ID, new UISWTViewBuilderCore(VivaldiView.MSGID_PREFIX + ".6", null, VivaldiView.class).setInitialDatasource(VivaldiView.DHT_TYPE_MAIN_V6));
    }
    if (hasV4) {
        if (Constants.isCVSVersion()) {
            vm.registerView(VIEW_ID, new UISWTViewBuilderCore(DHTView.MSGID_PREFIX + ".cvs", null, DHTView.class).setInitialDatasource(DHTView.DHT_TYPE_CVS));
            vm.registerView(VIEW_ID, new UISWTViewBuilderCore(VivaldiView.MSGID_PREFIX + ".cvs", null, VivaldiView.class).setInitialDatasource(VivaldiView.DHT_TYPE_CVS));
            vm.registerView(VIEW_ID, new UISWTViewBuilderCore(DHTView.MSGID_PREFIX + ".biglybt", null, DHTView.class).setInitialDatasource(DHTView.DHT_TYPE_BIGLYBT));
            vm.registerView(VIEW_ID, new UISWTViewBuilderCore(VivaldiView.MSGID_PREFIX + ".biglybt", null, VivaldiView.class).setInitialDatasource(VivaldiView.DHT_TYPE_BIGLYBT));
        } else {
            vm.registerView(VIEW_ID, new UISWTViewBuilderCore(DHTView.MSGID_PREFIX + ".biglybt", null, DHTView.class).setInitialDatasource(DHTView.DHT_TYPE_BIGLYBT));
        }
    }
    vm.registerView(VIEW_ID, new UISWTViewBuilderCore(TagStatsView.MSGID_PREFIX, null, TagStatsView.class));
    vm.registerView(VIEW_ID, new UISWTViewBuilderCore(XferStatsView.MSGID_PREFIX, null, XferStatsView.class));
    vm.setCoreViewsRegistered(VIEW_ID);
}
Also used : ViewManagerSWT(com.biglybt.ui.swt.views.ViewManagerSWT) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)

Example 7 with ViewManagerSWT

use of com.biglybt.ui.swt.views.ViewManagerSWT in project BiglyBT by BiglySoftware.

the class PluginsMenuHelper method buildViewMenu.

public static boolean buildViewMenu(Menu viewMenu) {
    int itemCount = viewMenu.getItemCount();
    MenuItemManager menuItemManager = MenuItemManager.getInstance();
    com.biglybt.pif.ui.menus.MenuItem[] plugin_items = menuItemManager.getAllAsArray(MenuManager.MENU_MENUBAR);
    if (plugin_items.length > 0) {
        sort(plugin_items);
        MenuBuildUtils.addPluginMenuItems(plugin_items, viewMenu, true, true, MenuBuildUtils.BASIC_MENU_ITEM_CONTROLLER);
    }
    List<UISWTViewBuilderCore> mainViewBuilders = getMainViewBuilder(ViewManagerSWT.getInstance());
    if (plugin_items.length > 0 && mainViewBuilders.size() > 0) {
        new MenuItem(viewMenu, SWT.SEPARATOR);
    }
    createViewInfoMenuItems(viewMenu, mainViewBuilders);
    if (viewMenu.getItemCount() > itemCount) {
        MenuFactory.addSeparatorMenuItem(viewMenu);
    }
    MenuItem menu_plugin_logViews = MenuFactory.addLogsViewMenuItem(viewMenu);
    ViewManagerSWT vi = ViewManagerSWT.getInstance();
    List<UISWTViewBuilderCore> logViewBuilders = getLogViewBuilders(vi);
    createViewInfoMenuItems(menu_plugin_logViews.getMenu(), logViewBuilders);
    return viewMenu.getItemCount() > itemCount;
}
Also used : MenuItemManager(com.biglybt.ui.common.util.MenuItemManager) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore) ViewManagerSWT(com.biglybt.ui.swt.views.ViewManagerSWT) MenuItem(org.eclipse.swt.widgets.MenuItem)

Example 8 with ViewManagerSWT

use of com.biglybt.ui.swt.views.ViewManagerSWT in project BiglyBT by BiglySoftware.

the class PluginsMenuHelper method buildPluginMenu.

public static void buildPluginMenu(Menu pluginMenu, boolean showPluginViews) {
    if (showPluginViews) {
        ViewManagerSWT vi = ViewManagerSWT.getInstance();
        List<UISWTViewBuilderCore> mainViewBuilders = getMainViewBuilder(vi);
        createViewInfoMenuItems(pluginMenu, mainViewBuilders);
        MenuItem menu_plugin_logViews = MenuFactory.addLogsViewMenuItem(pluginMenu);
        List<UISWTViewBuilderCore> logViewBuilders = getLogViewBuilders(vi);
        createViewInfoMenuItems(menu_plugin_logViews.getMenu(), logViewBuilders);
    }
    if (showPluginViews) {
        MenuFactory.addSeparatorMenuItem(pluginMenu);
        com.biglybt.pif.ui.menus.MenuItem[] plugin_items;
        plugin_items = MenuItemManager.getInstance().getAllAsArray("mainmenu");
        if (plugin_items.length > 0) {
            sort(plugin_items);
            MenuBuildUtils.addPluginMenuItems(plugin_items, pluginMenu, true, true, MenuBuildUtils.BASIC_MENU_ITEM_CONTROLLER);
            MenuFactory.addSeparatorMenuItem(pluginMenu);
        }
    }
    MenuFactory.addGetPluginsMenuItem(pluginMenu);
    MenuFactory.addPluginInstallFromFileItem(pluginMenu);
    MenuFactory.addPluginUnInstallMenuItem(pluginMenu);
    if (!showPluginViews) {
        MenuFactory.addSeparatorMenuItem(pluginMenu);
        MenuItem menu_plugin_logViews = MenuFactory.addLogsViewMenuItem(pluginMenu);
        List<UISWTViewBuilderCore> logViewBuilders = getLogViewBuilders(ViewManagerSWT.getInstance());
        createViewInfoMenuItems(menu_plugin_logViews.getMenu(), logViewBuilders);
    }
}
Also used : ViewManagerSWT(com.biglybt.ui.swt.views.ViewManagerSWT) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore) MenuItem(org.eclipse.swt.widgets.MenuItem)

Example 9 with ViewManagerSWT

use of com.biglybt.ui.swt.views.ViewManagerSWT in project BiglyBT by BiglySoftware.

the class BaseMDI method canShowEntryByID.

public boolean canShowEntryByID(String id) {
    if (id == null) {
        return (false);
    }
    if (canCreateEntryByCreationListener(id)) {
        return (true);
    }
    ViewManagerSWT vi = ViewManagerSWT.getInstance();
    UISWTViewBuilderCore builder = vi.getBuilder(viewID, id);
    if (builder == null) {
        builder = vi.getBuilder(getDataSourceType(), id);
    }
    return (builder != null);
}
Also used : ViewManagerSWT(com.biglybt.ui.swt.views.ViewManagerSWT) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)

Example 10 with ViewManagerSWT

use of com.biglybt.ui.swt.views.ViewManagerSWT in project BiglyBT by BiglySoftware.

the class BaseMDI method loadAndGetEntryByID.

private MdiEntry loadAndGetEntryByID(String id, boolean activate, boolean onlyLoadOnce, Object datasource) {
    if (id == null) {
        return (null);
    }
    @SuppressWarnings("deprecation") boolean loadedOnce = wasEntryLoadedOnce(id);
    if (loadedOnce && onlyLoadOnce) {
        return (null);
    }
    MdiEntry entry = getEntry(id);
    if (entry != null) {
        if (datasource != null) {
            entry.setDatasource(datasource);
        }
        if (activate) {
            showEntry(entry);
        }
        return (entry);
    }
    Map autoOpenInfo = new HashMap();
    // DataSourceResolves is tooled for Dashboard.. can't use it yet
    // Object value = DataSourceResolver.exportDataSource(datasource);
    // if (value == null) {
    // value = datasource;
    // }
    // datasource may not be writable to config, but assuming a MdiEntry is
    // created, the autoopen map will be updated with a writable ds.
    autoOpenInfo.put(AUTOOPENINFO_DS, datasource);
    MdiEntry mdiEntry = createEntryByCreationListener(id, autoOpenInfo);
    if (mdiEntry == null) {
        ViewManagerSWT vi = ViewManagerSWT.getInstance();
        UISWTViewBuilderCore builder = vi.getBuilder(viewID, id);
        if (builder == null) {
            builder = vi.getBuilder(getDataSourceType(), id);
        }
        if (builder != null) {
            mdiEntry = createEntry(builder, true);
        }
    }
    if (mdiEntry != null) {
        if (onlyLoadOnce) {
            setEntryLoadedOnce(id);
        }
        if (activate) {
            showEntry(mdiEntry);
        }
        return (mdiEntry);
    }
    return (null);
}
Also used : ViewManagerSWT(com.biglybt.ui.swt.views.ViewManagerSWT) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)

Aggregations

ViewManagerSWT (com.biglybt.ui.swt.views.ViewManagerSWT)10 UISWTViewBuilderCore (com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)8 MenuItem (org.eclipse.swt.widgets.MenuItem)2 COConfigurationManager (com.biglybt.core.config.COConfigurationManager)1 ConfigurationManager (com.biglybt.core.config.impl.ConfigurationManager)1 DownloadManager (com.biglybt.core.download.DownloadManager)1 UIFunctions (com.biglybt.ui.UIFunctions)1 TableView (com.biglybt.ui.common.table.TableView)1 MenuItemManager (com.biglybt.ui.common.util.MenuItemManager)1 UISWTViewEventCancelledException (com.biglybt.ui.swt.pifimpl.UISWTViewEventCancelledException)1 ArchivedFilesView (com.biglybt.ui.swt.views.ArchivedFilesView)1 MyTorrentsSubView (com.biglybt.ui.swt.views.MyTorrentsSubView)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1