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);
}
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;
}
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);
}
}
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);
}
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);
}
Aggregations