Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj =================================================================== diff -u -r49bebd2cfc2cae266077222234b9bd42ff58e2a8 -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 49bebd2cfc2cae266077222234b9bd42ff58e2a8) +++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -127,9 +127,17 @@ MessageWindowDialog.cs + + + + + + + + Index: Core/Common/src/Core.Common.Gui/IApplicationSelection.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/IApplicationSelection.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/IApplicationSelection.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,22 @@ +using System; + +namespace Core.Common.Gui +{ + /// + /// Interface for keeping and notifying changes to the application selection. + /// + public interface IApplicationSelection + { + /// + /// Gets or sets current selected object(s). Visibility of the menus, toolbars and + /// other controls should be updated when selected object is changed. Default + /// implementation will also show it in the PropertyGrid. + /// + object Selection { get; set; } + + /// + /// Fired when user changes selection by clicking on it or by setting it using property. + /// + event EventHandler SelectionChanged; + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/ICommandsOwner.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/ICommandsOwner.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/ICommandsOwner.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Core.Common.Gui +{ + /// + /// Object that holds the commands available within the application. + /// + public interface ICommandsOwner + { + /// + /// Gets or sets CommandHandler. + /// + IApplicationFeatureCommands ApplicationCommands { get; } + + IStorageCommands StorageCommands { get; } + + IProjectCommands ProjectCommands { get; } + + IViewCommands ViewCommands { get; } + + /// + /// Gets commands. + /// + IList Commands { get; } + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/IDocumentViewController.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/IDocumentViewController.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/IDocumentViewController.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,43 @@ +using System; + +using Core.Common.Controls.Views; + +namespace Core.Common.Gui +{ + /// + /// Interface for controller that controls Document Views in the application. + /// + public interface IDocumentViewController + { + /// + /// Fired when the active view in the document pane changes. + /// + event EventHandler ActiveViewChanged; + + /// + /// Gets the currently active document . + /// + IView ActiveView { get; } + + /// + /// Gets all document views currently opened in the gui. + /// + IViewList DocumentViews { get; } + + /// + /// Resolves document views + /// + IViewResolver DocumentViewsResolver { get; } + + /// + /// Suspends view removal on item delete. Useful to avoid unnecessary checks (faster item removal). + /// + bool IsViewRemoveOnItemDeleteSuspended { get; set; } + + /// + /// Update the tool tip for every view currently open. Reasons for doing so + /// include the modification of the tree structure which is reflected in a tool tip. + /// + void UpdateToolTips(); + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/IGui.cs =================================================================== diff -u -re96306bc32984aa50c6d1162167214024ddcf59a -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision e96306bc32984aa50c6d1162167214024ddcf59a) +++ Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -1,19 +1,7 @@ -// -------------------------------------------------------------------------------------------------------------------- -// Deltares. All rights reserved. -// -// Provides graphical user interface logic required to work with an application. -// -// -------------------------------------------------------------------------------------------------------------------- - using System; -using System.Collections; -using System.Collections.Generic; -using System.Configuration; -using Core.Common.Base.Data; + using Core.Common.Base.Plugin; using Core.Common.Base.Storage; -using Core.Common.Controls.Views; -using Core.Common.Gui.Forms.MainWindow; using Core.Common.Gui.Forms.PropertyGridView; using Core.Common.Gui.PropertyBag; @@ -22,143 +10,28 @@ /// /// Provides graphical user interface logic required to work with an application. /// - public interface IGui : IDisposable + public interface IGui : ICommandsOwner, ISettingsOwner, IToolViewController, IProjectOwner, + IApplicationSelection, IDocumentViewController, IContextMenuBuilderProvider, + IMainWindowController, IGuiPluginsHost, IDisposable { - #region Public events - - event Action ProjectOpened; - event Action ProjectClosing; - - #endregion - - #region Public Properties - /// - /// Gets the of the . - /// - ApplicationCore ApplicationCore { get; } - - /// - /// Gets or sets the project of the . - /// - Project Project { get; set; } - - /// - /// Gets or sets the project path of the . - /// - string ProjectFilePath { get; set; } - - /// - /// Gets or sets CommandHandler. - /// - IApplicationFeatureCommands ApplicationCommands { get; } - - IStorageCommands StorageCommands { get; } - - IProjectCommands ProjectCommands { get; } - - IViewCommands ViewCommands { get; } - - /// - /// Gets commands. - /// - IList Commands { get; } - - /// - /// Gets the currently active document . - /// - IView ActiveView { get; } - - /// - /// Gets all document views currently opened in the gui. - /// - IViewList DocumentViews { get; } - - /// - /// Resolves document views - /// - IViewResolver DocumentViewsResolver { get; } - - /// /// Object responsible for retrieving the instance /// for a given data object and wrapping that in a /// for the application to be used. /// IPropertyResolver PropertyResolver { get; } /// - /// Gets main window of the graphical user interface. + /// Gets the of the . /// - IMainWindow MainWindow { get; } + ApplicationCore ApplicationCore { get; } /// - /// Gets view manager used to handle tool windows. - /// - IViewList ToolWindowViews { get; } - - /// - /// List of plugins. - /// - IList Plugins { get; } - - /// - /// Gets the fixed settings of the . - /// - GuiCoreSettings FixedSettings { get; } - - /// - /// Gets the user specific settings of the . - /// - ApplicationSettingsBase UserSettings { get; } - - /// - /// Suspends view removal on item delete. Useful to avoid unnecessary checks (faster item removal). - /// - bool IsViewRemoveOnItemDeleteSuspended { get; set; } - - /// - /// Gets or sets current selected object(s). - /// Visibility of the menus, toolbars and other controls should be updated when selected object is changed. - /// Default implementation will also show it in the PropertyGrid. - /// - object Selection { get; set; } - - /// /// Gets or sets the current storage. /// IStoreProject Storage { get; } /// - /// Gets the of the - /// - IContextMenuBuilderProvider ContextMenuProvider { get; } - - #endregion - - #region Public Methods - - /// - /// Exits gui by user request. - /// - void Exit(); - - /// - /// Returns GuiPlugin for a given type. - /// TODO: a bit too implicit method, to be removed. - /// - /// Any type loaded from plugin. - /// Plugin gui associated with a given type - GuiPlugin GetPluginGuiForType(Type type); - - /// - /// Queries the plugins to get all data with view definitions recursively given a - /// piece of hierarchical data. - /// - /// The root data object. - /// An enumeration of all (child)data that have view definitions declared. - IEnumerable GetAllDataWithViewDefinitionsRecursively(object rootDataObject); - - /// /// Runs gui. Internally it runs , initializes all user interface components, including /// those loaded from plugins. After that it creates and shows main window. /// @@ -171,47 +44,8 @@ void Run(string projectPath); /// - /// Fully refreshes the user interface. + /// Exits gui by user request. /// - void RefreshGui(); - - /// - /// Updates the title of the main window. - /// - void UpdateTitle(); - - /// - /// Update the tool tip for every view currently open. Reasons for doing so - /// include the modification of the tree structure which is reflected in a tool tip. - /// - void UpdateToolTips(); - - /// - /// Open the tool view and make it visible in the interface. - /// - /// The tool view to open. - void OpenToolView(IView toolView); - - /// - /// Close the tool view removing it from the interface. - /// - /// The tool view to close. - void CloseToolView(IView toolView); - - #endregion - - #region Events - - /// - /// Fired when user changes selection by clicking on it or by setting it using Selection property. - /// - event EventHandler SelectionChanged; - - /// - /// Fired when the active view in the document pane changes. - /// - event EventHandler ActiveViewChanged; - - #endregion + void Exit(); } } \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/IGuiPluginsHost.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/IGuiPluginsHost.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/IGuiPluginsHost.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,34 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Core.Common.Gui +{ + /// + /// Interface describing the object that hosts all the leaded graphical user interface + /// plugins of the application. + /// + public interface IGuiPluginsHost + { + /// + /// List of plugins. + /// + IList Plugins { get; } + + /// + /// Returns GuiPlugin for a given type. + /// TODO: a bit too implicit method, to be removed. + /// + /// Any type loaded from plugin. + /// Plugin gui associated with a given type + GuiPlugin GetPluginGuiForType(Type type); + + /// + /// Queries the plugins to get all data with view definitions recursively given a + /// piece of hierarchical data. + /// + /// The root data object. + /// An enumeration of all (child)data that have view definitions declared. + IEnumerable GetAllDataWithViewDefinitionsRecursively(object rootDataObject); + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/IMainWindowController.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/IMainWindowController.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/IMainWindowController.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,26 @@ +using Core.Common.Gui.Forms.MainWindow; + +namespace Core.Common.Gui +{ + /// + /// Interface that declare member that allow for the controlling the main window of + /// the application. + /// + public interface IMainWindowController + { + /// + /// Gets main window of the graphical user interface. + /// + IMainWindow MainWindow { get; } + + /// + /// Fully refreshes the user interface. + /// + void RefreshGui(); + + /// + /// Updates the title of the main window. + /// + void UpdateTitle(); + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/IProjectOwner.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/IProjectOwner.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/IProjectOwner.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,32 @@ +using System; + +using Core.Common.Base.Data; + +namespace Core.Common.Gui +{ + /// + /// Interface declaring members related to owning an . + /// + public interface IProjectOwner + { + /// + /// Occurs when a new instance is available at . + /// + event Action ProjectOpened; + + /// + /// Occurs when the instance available at is removed. + /// + event Action ProjectClosing; + + /// + /// Gets or sets the project of the . + /// + Project Project { get; set; } + + /// + /// Gets or sets the project path of the . + /// + string ProjectFilePath { get; set; } + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/ISettingsOwner.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/ISettingsOwner.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/ISettingsOwner.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,20 @@ +using System.Configuration; + +namespace Core.Common.Gui +{ + /// + /// Interface declaring the members of the object that holds settings. + /// + public interface ISettingsOwner + { + /// + /// Gets the fixed settings of the user interface. + /// + GuiCoreSettings FixedSettings { get; } + + /// + /// Gets the user specific settings of the user interface. + /// + ApplicationSettingsBase UserSettings { get; } + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/IToolViewController.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/IToolViewController.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/IToolViewController.cs (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -0,0 +1,27 @@ +using Core.Common.Controls.Views; + +namespace Core.Common.Gui +{ + /// + /// Interface for controller that controls Tool Views in the application. + /// + public interface IToolViewController + { + /// + /// Gets view manager used to handle tool windows. + /// + IViewList ToolWindowViews { get; } + + /// + /// Open the tool view and make it visible in the interface. + /// + /// The tool view to open. + void OpenToolView(IView toolView); + + /// + /// Close the tool view removing it from the interface. + /// + /// The tool view to close. + void CloseToolView(IView toolView); + } +} \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/RingtoetsGui.cs =================================================================== diff -u -r109fecb57876eebf5108a34b8b7ab79f37559dd2 -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 109fecb57876eebf5108a34b8b7ab79f37559dd2) +++ Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -20,7 +20,6 @@ using Core.Common.Gui.Forms.SplashScreen; using Core.Common.Gui.Forms.ViewManager; using Core.Common.Gui.Properties; -using Core.Common.Utils; using Core.Common.Utils.Events; using Core.Common.Utils.Extensions; using Core.Common.Utils.Reflection; @@ -34,7 +33,7 @@ /// /// Gui class provides graphical user functionality for a given IApplication. /// - public class RingtoetsGui : IGui, IContextMenuBuilderProvider + public class RingtoetsGui : IGui { public event EventHandler SelectionChanged; // TODO: make it weak public event EventHandler ActiveViewChanged; Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs =================================================================== diff -u -re96306bc32984aa50c6d1162167214024ddcf59a -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision e96306bc32984aa50c6d1162167214024ddcf59a) +++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -36,12 +36,12 @@ /// An of . /// Thrown when either: /// - /// is null - /// is null + /// is null + /// is null /// public override IEnumerable GetProjectTreeViewNodePresenters() { - yield return new ProjectNodePresenter(Gui.ContextMenuProvider, Gui.ProjectCommands); + yield return new ProjectNodePresenter(Gui, Gui.ProjectCommands); } public override IEnumerable GetChildDataWithViewDefinitions(object dataObject) Index: Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/ProjectExplorerGuiPluginTest.cs =================================================================== diff -u -re96306bc32984aa50c6d1162167214024ddcf59a -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/ProjectExplorerGuiPluginTest.cs (.../ProjectExplorerGuiPluginTest.cs) (revision e96306bc32984aa50c6d1162167214024ddcf59a) +++ Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/ProjectExplorerGuiPluginTest.cs (.../ProjectExplorerGuiPluginTest.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -46,7 +46,6 @@ { projectExplorerPluginGui, pluginGui }).Repeat.Any(); - gui.Expect(g => g.ContextMenuProvider).Return(mocks.StrictMock()).Repeat.Any(); gui.Stub(g=>g.ApplicationCommands).Return(mocks.StrictMock()); gui.Stub(g => g.ProjectCommands).Return(mocks.StrictMock()); Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs =================================================================== diff -u -r34acbefc8cf9232743a0d4b0e9ba21f26576531b -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 34acbefc8cf9232743a0d4b0e9ba21f26576531b) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -72,14 +72,14 @@ /// Get the defined for the . /// /// An of . - /// Thrown when is null. + /// Thrown when is null. public override IEnumerable GetProjectTreeViewNodePresenters() { - yield return new AssessmentSectionBaseNodePresenter(Gui.ContextMenuProvider); - yield return new FailureMechanismNodePresenter(Gui.ContextMenuProvider); - yield return new PlaceholderWithReadonlyNameNodePresenter(Gui.ContextMenuProvider); - yield return new CategoryTreeFolderNodePresenter(Gui.ContextMenuProvider); - yield return new FailureMechanismContributionNodePresenter(Gui.ContextMenuProvider); + yield return new AssessmentSectionBaseNodePresenter(Gui); + yield return new FailureMechanismNodePresenter(Gui); + yield return new PlaceholderWithReadonlyNameNodePresenter(Gui); + yield return new CategoryTreeFolderNodePresenter(Gui); + yield return new FailureMechanismContributionNodePresenter(Gui); } public override IEnumerable GetTreeNodeInfos() @@ -125,8 +125,7 @@ { Text = failureMechanismContribution => RingtoetsDataResources.FailureMechanismContribution_DisplayName, Image = failureMechanismContribution => RingtoetsFormsResources.GenericInputOutputIcon, - ContextMenu = (failureMechanismContribution, sourceNode) => Gui.ContextMenuProvider - .Get(sourceNode) + ContextMenu = (failureMechanismContribution, sourceNode) => Gui.Get(sourceNode) .AddOpenItem() .AddSeparator() .AddExportItem() @@ -166,7 +165,7 @@ private ContextMenuStrip AssessmentSectionBaseContextMenu(AssessmentSectionBase nodeData, TreeNode node) { - return Gui.ContextMenuProvider.Get(node) + return Gui.Get(node) .AddRenameItem() .AddDeleteItem() .AddSeparator() @@ -228,7 +227,7 @@ Enabled = false }; - return Gui.ContextMenuProvider.Get(node) + return Gui.Get(node) .AddCustomItem(calculateItem) .AddCustomItem(clearOutputItem) .AddSeparator() @@ -257,7 +256,7 @@ private ContextMenuStrip PlaceholderWithReadonlyNameContextMenu(PlaceholderWithReadonlyName nodeData, TreeNode node) { - IContextMenuBuilder menuBuilder = Gui.ContextMenuProvider.Get(node); + IContextMenuBuilder menuBuilder = Gui.Get(node); if (nodeData is InputPlaceholder || nodeData is OutputPlaceholder) { @@ -310,7 +309,7 @@ private ContextMenuStrip CategoryTreeFolderContextMenu(CategoryTreeFolder nodeData, TreeNode node) { - return Gui.ContextMenuProvider.Get(node) + return Gui.Get(node) .AddExpandAllItem() .AddCollapseAllItem() .Build(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs =================================================================== diff -u -r8cae5d69ac2d4cf678486ac2b457c0dfe97089d5 -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 8cae5d69ac2d4cf678486ac2b457c0dfe97089d5) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsGuiPluginTest.cs (.../RingtoetsGuiPluginTest.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -56,10 +56,8 @@ var applicationCore = new ApplicationCore(); var guiStub = mocks.DynamicMultiMock(typeof(IGui), typeof(IContextMenuBuilderProvider)); - var contextMenuProviderMock = mocks.DynamicMock(); guiStub.Expect(g => g.ApplicationCore).Return(applicationCore).Repeat.Any(); - guiStub.Expect(g => g.ContextMenuProvider).Return(contextMenuProviderMock).Repeat.Any(); mocks.ReplayAll(); Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -r778cb6e89f676cb60f95da71d7aed9d5b355ed2e -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 778cb6e89f676cb60f95da71d7aed9d5b355ed2e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -50,29 +50,29 @@ /// Get the defined for the . /// /// An of . - /// Thrown when is null. + /// Thrown when is null. public override IEnumerable GetProjectTreeViewNodePresenters() { - yield return new PipingFailureMechanismNodePresenter(Gui.ContextMenuProvider) + yield return new PipingFailureMechanismNodePresenter(Gui) { RunActivitiesAction = activities => ActivityProgressDialogRunner.Run(Gui.MainWindow, activities) }; - yield return new PipingCalculationContextNodePresenter(Gui.ContextMenuProvider) + yield return new PipingCalculationContextNodePresenter(Gui) { RunActivityAction = activity => ActivityProgressDialogRunner.Run(Gui.MainWindow, activity) }; - yield return new PipingCalculationGroupContextNodePresenter(Gui.ContextMenuProvider) + yield return new PipingCalculationGroupContextNodePresenter(Gui) { RunActivitiesAction = activities => ActivityProgressDialogRunner.Run(Gui.MainWindow, activities) }; - yield return new PipingInputContextNodePresenter(Gui.ContextMenuProvider); - yield return new PipingSurfaceLineCollectionNodePresenter(Gui.ContextMenuProvider); - yield return new PipingSurfaceLineNodePresenter(Gui.ContextMenuProvider); - yield return new PipingSoilProfileCollectionNodePresenter(Gui.ContextMenuProvider); - yield return new PipingSoilProfileNodePresenter(Gui.ContextMenuProvider); - yield return new PipingOutputNodePresenter(Gui.ContextMenuProvider); - yield return new EmptyPipingOutputNodePresenter(Gui.ContextMenuProvider); - yield return new EmptyPipingCalculationReportNodePresenter(Gui.ContextMenuProvider); + yield return new PipingInputContextNodePresenter(Gui); + yield return new PipingSurfaceLineCollectionNodePresenter(Gui); + yield return new PipingSurfaceLineNodePresenter(Gui); + yield return new PipingSoilProfileCollectionNodePresenter(Gui); + yield return new PipingSoilProfileNodePresenter(Gui); + yield return new PipingOutputNodePresenter(Gui); + yield return new EmptyPipingOutputNodePresenter(Gui); + yield return new EmptyPipingCalculationReportNodePresenter(Gui); } public override IEnumerable GetTreeNodeInfos() @@ -118,7 +118,7 @@ { Text = pipingInputContext => PipingFormsResources.PipingInputContextNodePresenter_NodeDisplayName, Image = pipingInputContext => PipingFormsResources.PipingInputIcon, - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddImportItem() .AddExportItem() @@ -133,7 +133,7 @@ Image = ringtoetsPipingSurfaceLine => PipingFormsResources.FolderIcon, ForegroundColor = ringtoetsPipingSurfaceLine => ringtoetsPipingSurfaceLine.Any() ? Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText), ChildNodeObjects = ringtoetsPipingSurfaceLine => ringtoetsPipingSurfaceLine.Cast().ToArray(), - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddImportItem() .AddExportItem() @@ -148,7 +148,7 @@ Text = pipingSurfaceLine => pipingSurfaceLine.Name, Image = pipingSurfaceLine => PipingFormsResources.PipingSurfaceLineIcon, - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddPropertiesItem() .Build() @@ -160,7 +160,7 @@ Image = pipingSoilProfiles => PipingFormsResources.FolderIcon, ForegroundColor = pipingSoilProfiles => pipingSoilProfiles.Any() ? Color.FromKnownColor(KnownColor.ControlText) : Color.FromKnownColor(KnownColor.GrayText), ChildNodeObjects = pipingSoilProfiles => pipingSoilProfiles.Cast().ToArray(), - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddImportItem() .AddExportItem() @@ -174,7 +174,7 @@ { Text = pipingSoilProfile => pipingSoilProfile.Name, Image = pipingSoilProfile => PipingFormsResources.PipingSoilProfileIcon, - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddPropertiesItem() .Build() @@ -184,7 +184,7 @@ { Text = pipingOutput => PipingFormsResources.PipingOutput_DisplayName, Image = pipingOutput => PipingFormsResources.PipingOutputIcon, - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddExportItem() .AddSeparator() @@ -197,7 +197,7 @@ Text = emptyPipingOutput => PipingFormsResources.PipingOutput_DisplayName, Image = emptyPipingOutput => PipingFormsResources.PipingOutputIcon, ForegroundColor = emptyPipingOutput => Color.FromKnownColor(KnownColor.GrayText), - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddExportItem() .AddSeparator() @@ -210,7 +210,7 @@ Text = emptyPipingCalculationReport => PipingDataResources.CalculationReport_DisplayName, Image = emptyPipingCalculationReport => PipingFormsResources.PipingCalculationReportIcon, ForegroundColor = emptyPipingCalculationReport => Color.FromKnownColor(KnownColor.GrayText), - ContextMenu = (nodeData, node) => Gui.ContextMenuProvider + ContextMenu = (nodeData, node) => Gui .Get(node) .AddOpenItem() .AddSeparator() @@ -256,7 +256,7 @@ clearAllItem.ToolTipText = PipingFormsResources.PipingCalculationGroup_ClearOutput_No_calculation_with_output_to_clear; } - return Gui.ContextMenuProvider.Get(node) + return Gui.Get(node) .AddCustomItem(addCalculationGroupItem) .AddCustomItem(addCalculationItem) .AddSeparator() @@ -433,7 +433,7 @@ clearOutputItem.ToolTipText = PipingFormsResources.ClearOutput_No_output_to_clear; } - return Gui.ContextMenuProvider.Get(node) + return Gui.Get(node) .AddCustomItem(validateItem) .AddCustomItem(calculateItem) .AddCustomItem(clearOutputItem) @@ -612,7 +612,7 @@ clearAllItem.ToolTipText = PipingFormsResources.PipingCalculationGroup_ClearOutput_No_calculation_with_output_to_clear; } - var builder = Gui.ContextMenuProvider.Get(node) + var builder = Gui.Get(node) .AddCustomItem(addCalculationGroupItem) .AddCustomItem(addCalculationItem) .AddSeparator() Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs =================================================================== diff -u -re96306bc32984aa50c6d1162167214024ddcf59a -r98939d3757e99732f74f6345b5eb58c90e30a4d4 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision e96306bc32984aa50c6d1162167214024ddcf59a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4) @@ -88,10 +88,8 @@ var guiStub = mocks.Stub(); guiStub.Stub(g => g.ApplicationCommands).Return(mocks.Stub()); - var contextMenuProviderMock = mocks.DynamicMock(); Expect.Call(guiStub.ApplicationCore).Return(applicationCore).Repeat.Any(); - Expect.Call(guiStub.ContextMenuProvider).Return(contextMenuProviderMock).Repeat.Any(); mocks.ReplayAll();