public override IEnumerable <IMenuBarItem> AllMenuItems() { yield return(_menuBarItemRepository[MenuBarItemIds.AddObservedData]); yield return(_menuBarItemRepository[MenuBarItemIds.LoadObservedData]); if (_treeNode.AllLeafNodes.OfType <ObservedDataNode>().Any()) { yield return(ObservedDataClassificationCommonContextMenuItems.EditMultipleMetaData(_treeNode).AsGroupStarter()); } yield return(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(_treeNode, _presenter)); var groupMenu = createGroupingSubMenu(_treeNode, _presenter); if (groupMenu.AllItems().Any()) { yield return(groupMenu); } if (_treeNode.HasChildren) { yield return(ObservedDataClassificationCommonContextMenuItems.ColorGroupObservedData(_userSettings)); } yield return(ClassificationCommonContextMenuItems.RemoveClassificationFolderMainMenu(_treeNode, _presenter).AsGroupStarter()); }
public ObservedDataFolderContextMenu( ITreeNode <RootNodeType> treeNode, IMenuBarItemRepository repository, IBuildingBlockRepository buildingBlockRepository, IBuildingBlockExplorerPresenter presenter, IUserSettings userSettings) { var allCompounds = buildingBlockRepository.All <Compound>().ToList(); //create sub menu containing all compounds var addObservedDataFor = CreateSubMenu.WithCaption(PKSimConstants.MenuNames.AddObservedDataFor) .WithIcon(ApplicationIcons.ObservedDataForMolecule); foreach (var compound in allCompounds) { addObservedDataFor.AddItem(CreateMenuButton.WithCaption(compound.Name) .WithCommandFor <AddObservedDataForCompoundUICommand, Compound>(compound)); } _view.AddMenuItem(repository[MenuBarItemIds.AddObservedData]); if (allCompounds.Any()) { _view.AddMenuItem(addObservedDataFor); } if (treeNode.HasChildren) { _view.AddMenuItem(ObservedDataClassificationCommonContextMenuItems.ColorGroupObservedData(userSettings)); } _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.LoadFromTemplate) .WithCommand <LoadObservedDataFromTemplateUICommand>() .WithIcon(ApplicationIcons.LoadFromTemplate) .AsGroupStarter()); _view.AddMenuItem(CreateMenuButton.WithCaption(PKSimConstants.MenuNames.AsDeveloperOnly("Load from Snapshot")) .WithCommand <LoadObservedDataFromSnapshotUICommand>() .WithIcon(ApplicationIcons.SnapshotImport) .ForDeveloper()); if (treeNode.AllLeafNodes.OfType <ObservedDataNode>().Any()) { _view.AddMenuItem(ObservedDataClassificationCommonContextMenuItems.EditMultipleMetaData(treeNode).AsGroupStarter()); } _view.AddMenuItem(ClassificationCommonContextMenuItems.CreateClassificationUnderMenu(treeNode, presenter)); var groupMenu = createGroupingSubMenu(treeNode, presenter); if (groupMenu.AllItems().Any()) { _view.AddMenuItem(groupMenu); } _view.AddMenuItem(createDeleteSubMenu(treeNode, presenter)); }