Index: Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/CalculationTreeNodeInfoFactory.cs =================================================================== diff -u -r87445dcecde875ada5513431df8ca2d01a57f742 -r5e9fd91bb55d97ee46d4446960dfa7f63b0d48cf --- Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/CalculationTreeNodeInfoFactory.cs (.../CalculationTreeNodeInfoFactory.cs) (revision 87445dcecde875ada5513431df8ca2d01a57f742) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/CalculationTreeNodeInfoFactory.cs (.../CalculationTreeNodeInfoFactory.cs) (revision 5e9fd91bb55d97ee46d4446960dfa7f63b0d48cf) @@ -23,7 +23,6 @@ using System.Linq; using System.Windows.Forms; using Core.Common.Controls.TreeView; -using Core.Common.Gui; using Core.Common.Gui.ContextMenu; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; @@ -45,13 +44,11 @@ /// /// The type of calculation group context to create a object for. /// The function for obtaining child node objects. - /// The action for adding a calculation to the calculation group. - /// The gui to use. + /// The function for obtaining the context menu strip. /// A object. public static TreeNodeInfo CreateCalculationGroupContextTreeNodeInfo( Func childNodeObjects, - Action addCalculation, - IGui gui) + Func contextMenuStrip) where TCalculationGroupContext : ICalculationContext { return new TreeNodeInfo @@ -60,7 +57,7 @@ Image = context => Resources.GeneralFolderIcon, EnsureVisibleOnCreate = context => true, ChildNodeObjects = childNodeObjects, - ContextMenuStrip = (context, parentData, treeViewControl) => ContextMenuStrip(context, parentData, treeViewControl, addCalculation, gui), + ContextMenuStrip = contextMenuStrip, CanRename = (context, parentData) => IsNestedGroup(parentData), OnNodeRenamed = (context, newName) => { @@ -128,41 +125,6 @@ return parentData is ICalculationContext; } - private static ContextMenuStrip ContextMenuStrip(TCalculationGroupContext nodeData, object parentData, TreeViewControl treeViewControl, Action addCalculation, IGui gui) where TCalculationGroupContext : ICalculationContext - { - var group = nodeData.WrappedData; - var builder = gui.Get(nodeData, treeViewControl); - var isNestedGroup = IsNestedGroup(parentData); - - if (!isNestedGroup) - { - builder - .AddOpenItem() - .AddSeparator(); - } - - AddCreateCalculationGroupItem(builder, group); - AddCreateCalculationItem(builder, nodeData, addCalculation); - builder.AddSeparator(); - - if (isNestedGroup) - { - builder.AddRenameItem(); - builder.AddDeleteItem(); - builder.AddSeparator(); - } - - return builder - .AddImportItem() - .AddExportItem() - .AddSeparator() - .AddExpandAllItem() - .AddCollapseAllItem() - .AddSeparator() - .AddPropertiesItem() - .Build(); - } - private static bool CanDropOrInsert(object draggedData, object targetData) { var calculationContext = draggedData as ICalculationContext;