use of com.biglybt.pif.ui.UIManager in project BiglyBT by BiglySoftware.
the class SBC_TagsOverview method registerPluginViews.
private void registerPluginViews(final UISWTInstance pluginUI) {
if (registeredCoreSubViews) {
return;
}
pluginUI.addView(TABLE_TAGS, "TagSettingsView", TagSettingsView.class, null);
pluginUI.addView(TABLE_TAGS, "MyTorrentsSubView", MyTorrentsSubView.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_TAGS, "TagSettingsView");
pluginUI.removeViews(TABLE_TAGS, "MyTorrentsSubView");
uiManager.removeUIListener(this);
}
});
}
use of com.biglybt.pif.ui.UIManager in project BiglyBT by BiglySoftware.
the class SB_Transfers method addHeaderMenu.
protected void addHeaderMenu() {
PluginInterface pi = PluginInitializer.getDefaultInterface();
UIManager uim = pi.getUIManager();
assert uim != null;
final MenuManager menuManager = uim.getMenuManager();
MenuItem menuItem;
menuItem = menuManager.addMenuItem("sidebar." + MultipleDocumentInterface.SIDEBAR_HEADER_TRANSFERS, "MyTorrentsView.menu.setCategory.add");
menuItem.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menuItem.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
CategoryUIUtils.showCreateCategoryDialog(null);
}
});
// cats in sidebar
menuItem.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setVisible(COConfigurationManager.getBooleanParameter("Library.CatInSideBar"));
}
});
menuItem = menuManager.addMenuItem("sidebar." + MultipleDocumentInterface.SIDEBAR_HEADER_TRANSFERS, "ConfigView.section.style.CatInSidebar");
menuItem.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menuItem.setStyle(MenuItem.STYLE_CHECK);
menuItem.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
boolean b = COConfigurationManager.getBooleanParameter("Library.CatInSideBar");
COConfigurationManager.setParameter("Library.CatInSideBar", !b);
}
});
menuItem.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setVisible(CategoryManager.getCategories().length > 0);
menu.setData(COConfigurationManager.getBooleanParameter("Library.CatInSideBar"));
}
});
// show tags in sidebar
TagUIUtils.setupSideBarMenus(menuManager);
}
use of com.biglybt.pif.ui.UIManager in project BiglyBT by BiglySoftware.
the class SideBar method addGeneralMenus.
/**
* @since 3.1.0.1
*/
private void addGeneralMenus() {
PluginManager pm = CoreFactory.getSingleton().getPluginManager();
PluginInterface pi = pm.getDefaultPluginInterface();
UIManager uim = pi.getUIManager();
MenuManager menuManager = uim.getMenuManager();
{
MenuItem menuItem = menuManager.addMenuItem("sidebar._end_", "menu.add.to.dashboard");
menuItem.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menuItem.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
SideBarEntrySWT sbe = (SideBarEntrySWT) currentEntry;
if (sbe != null && sbe.getId().equals(MultipleDocumentInterface.SIDEBAR_HEADER_DASHBOARD)) {
menu.setVisible(false);
} else {
menu.setVisible(sbe != null && sbe.canBuildStandAlone());
}
}
});
menuItem.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
SideBarEntrySWT sbe = (SideBarEntrySWT) currentEntry;
if (sbe != null) {
MainMDISetup.getSb_dashboard().addItem(sbe);
}
}
});
}
{
MenuItem menuItem = menuManager.addMenuItem("sidebar._end_", "menu.pop.out");
menuItem.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menuItem.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
SideBarEntrySWT sbe = (SideBarEntrySWT) currentEntry;
menu.setVisible(sbe != null && sbe.canBuildStandAlone());
}
});
menuItem.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
SideBarEntrySWT sbe = (SideBarEntrySWT) currentEntry;
if (sbe != null) {
SkinnedDialog skinnedDialog = new SkinnedDialog("skin3_dlg_sidebar_popout", "shell", // standalone
null, SWT.RESIZE | SWT.MAX | SWT.DIALOG_TRIM);
SWTSkin skin = skinnedDialog.getSkin();
SWTSkinObjectContainer cont = sbe.buildStandAlone((SWTSkinObjectContainer) skin.getSkinObject("content-area"));
if (cont != null) {
skinnedDialog.setTitle(sbe.getTitle());
skinnedDialog.open();
} else {
skinnedDialog.close();
}
}
}
});
}
}
use of com.biglybt.pif.ui.UIManager in project BiglyBT by BiglySoftware.
the class StatsView method registerPluginViews.
private void registerPluginViews(final UISWTInstance pluginUI) {
if (pluginUI == null || registeredCoreSubViews) {
return;
}
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, ActivityView.MSGID_PREFIX, ActivityView.class, null);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, TransferStatsView.MSGID_PREFIX, TransferStatsView.class, null);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, CacheView.MSGID_PREFIX, CacheView.class, null);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX, DHTView.class, DHTView.DHT_TYPE_MAIN);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTOpsView.MSGID_PREFIX, DHTOpsView.class, DHTOpsView.DHT_TYPE_MAIN);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX, VivaldiView.class, VivaldiView.DHT_TYPE_MAIN);
if (NetworkAdmin.getSingleton().hasDHTIPV6()) {
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".6", DHTView.class, DHTView.DHT_TYPE_MAIN_V6);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".6", VivaldiView.class, VivaldiView.DHT_TYPE_MAIN_V6);
}
if (Constants.isCVSVersion()) {
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".cvs", DHTView.class, DHTView.DHT_TYPE_CVS);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".cvs", VivaldiView.class, VivaldiView.DHT_TYPE_CVS);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".biglybt", DHTView.class, DHTView.DHT_TYPE_BIGLYBT);
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".biglybt", VivaldiView.class, VivaldiView.DHT_TYPE_BIGLYBT);
}
pluginUI.addView(UISWTInstance.VIEW_STATISTICS, TagStatsView.MSGID_PREFIX, TagStatsView.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(UISWTInstance.VIEW_STATISTICS, ActivityView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, TransferStatsView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, CacheView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTOpsView.MSGID_PREFIX);
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX);
if (NetworkAdmin.getSingleton().hasDHTIPV6()) {
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".6");
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".6");
}
if (Constants.isCVSVersion()) {
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, DHTView.MSGID_PREFIX + ".cvs");
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, VivaldiView.MSGID_PREFIX + ".cvs");
}
pluginUI.removeViews(UISWTInstance.VIEW_STATISTICS, TagStatsView.MSGID_PREFIX);
uiManager.removeUIListener(this);
}
});
}
use of com.biglybt.pif.ui.UIManager in project BiglyBT by BiglySoftware.
the class TableViewSWT_TabsCommon method buildFolder.
private void buildFolder(final Composite form, final String props_prefix) {
PluginInterface pi = PluginInitializer.getDefaultInterface();
UIManager uim = pi.getUIManager();
MenuManager menuManager = uim.getMenuManager();
menuItemShowTabs = menuManager.addMenuItem(props_prefix + "._end_", "ConfigView.section.style.ShowTabsInTorrentView");
menuItemShowTabs.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menuItemShowTabs.setStyle(MenuItem.STYLE_CHECK);
menuItemShowTabs.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(COConfigurationManager.getBooleanParameter("Library.ShowTabsInTorrentView"));
}
});
menuItemShowTabs.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
COConfigurationManager.setParameter("Library.ShowTabsInTorrentView", (Boolean) menu.getData());
}
});
cTabsHolder.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event e) {
if (tabbedMDI.getMinimized()) {
fdHeightChanger.height = tabbedMDI.getFolderHeight();
cTabsHolder.getParent().layout();
return;
}
Double l = (Double) sash.getData("PCT");
if (l != null) {
int newHeight = (int) (form.getBounds().height * l.doubleValue());
if (newHeight != fdHeightChanger.height) {
fdHeightChanger.height = newHeight;
cTabsHolder.getParent().layout();
}
}
}
});
String[] restricted_to = tv.getTabViewsRestrictedTo();
Set<String> rt_set = new HashSet<>();
if (restricted_to != null) {
rt_set.addAll(Arrays.asList(restricted_to));
}
// Call plugin listeners
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
if (pluginUI != null) {
UISWTViewEventListenerWrapper[] pluginViews = pluginUI.getViewListeners(tv.getTableID());
if (pluginViews != null) {
for (final UISWTViewEventListenerWrapper l : pluginViews) {
if (l == null) {
continue;
}
try {
String view_id = l.getViewID();
if (restricted_to != null && !rt_set.contains(view_id)) {
continue;
}
tabbedMDI.registerEntry(view_id, new MdiEntryCreationListener2() {
@Override
public MdiEntry createMDiEntry(MultipleDocumentInterface mdi, String id, Object datasource, Map<?, ?> params) {
return addTabView(l, null);
}
});
tabbedMDI.loadEntryByID(view_id, false);
} catch (Exception e) {
// skip, plugin probably specifically asked to not be added
}
}
}
}
}
if (!tabbedMDI.getMinimized()) {
MdiEntry[] entries = tabbedMDI.getEntries();
if (entries.length > 0) {
tabbedMDI.showEntry(entries[0]);
}
}
}
Aggregations