Index: Core/Common/src/Core.Common.Gui/IToolViewController.cs
===================================================================
diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Common/src/Core.Common.Gui/IToolViewController.cs (.../IToolViewController.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455)
+++ Core/Common/src/Core.Common.Gui/IToolViewController.cs (.../IToolViewController.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -35,6 +35,13 @@
IViewList ToolWindowViews { get; }
///
+ /// Checks whether a tool window of type is open.
+ ///
+ /// The type of tool window to check for.
+ /// true if a tool window of type is open, false otherwise.
+ bool IsToolWindowOpen();
+
+ ///
/// Open the tool view and make it visible in the interface.
///
/// The tool view to open.
Index: Core/Common/src/Core.Common.Gui/RingtoetsGui.cs
===================================================================
diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455)
+++ Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -1062,6 +1062,11 @@
ToolWindowViews.Remove(toolView);
}
+ public bool IsToolWindowOpen()
+ {
+ return ToolWindowViews.Any(t => t.GetType() == typeof(T));
+ }
+
public void OpenToolView(IView toolView)
{
ToolWindowViews.Add(toolView);
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Core.Plugins.OxyPlot.csproj
===================================================================
diff -u -rc8848af0c6f8780634dcce2013e606f090da6577 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.OxyPlot/Core.Plugins.OxyPlot.csproj (.../Core.Plugins.OxyPlot.csproj) (revision c8848af0c6f8780634dcce2013e606f090da6577)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Core.Plugins.OxyPlot.csproj (.../Core.Plugins.OxyPlot.csproj) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -66,7 +66,6 @@
ChartDataView.cs
-
Component
Fisheye: Tag 0d7895f07d2c1b15457ffdc8e8762780a5837030 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.OxyPlot/IToolViewController.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs
===================================================================
diff -u -rfbb37872d09f1ded75ce2209e8e48a6b64d8a78f -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs (.../LegendController.cs) (revision fbb37872d09f1ded75ce2209e8e48a6b64d8a78f)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/Legend/LegendController.cs (.../LegendController.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -21,6 +21,7 @@
using System;
using Core.Common.Controls.Views;
+using Core.Common.Gui;
using Core.Components.Charting.Data;
using Core.Components.OxyPlot.Forms;
Index: Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs
===================================================================
diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455)
+++ Core/Plugins/src/Core.Plugins.OxyPlot/OxyPlotGuiPlugin.cs (.../OxyPlotGuiPlugin.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -20,8 +20,6 @@
// All rights reserved.
using System.Collections.Generic;
-using System.Linq;
-using Core.Common.Controls.Views;
using Core.Common.Gui;
using Core.Common.Gui.Forms;
using Core.Common.Gui.Forms.ViewManager;
@@ -37,7 +35,7 @@
///
/// This class ties all the components together to enable charting interaction.
///
- public class OxyPlotGuiPlugin : GuiPlugin, IToolViewController
+ public class OxyPlotGuiPlugin : GuiPlugin
{
private ChartingRibbon chartingRibbon;
@@ -55,7 +53,7 @@
public override void Activate()
{
- legendController = CreateLegendController(this);
+ legendController = CreateLegendController(Gui);
chartingRibbon = CreateRibbon(legendController, Gui);
legendController.ToggleLegend();
@@ -81,26 +79,6 @@
base.Dispose();
}
- #region IToolWindowController
-
- public bool IsToolWindowOpen()
- {
- return Gui.ToolWindowViews.Any(t => t.GetType() == typeof(T));
- }
-
- public void OpenToolView(IView toolView)
- {
- Gui.OpenToolView(toolView);
- UpdateComponentsForActiveView();
- }
-
- public void CloseToolView(IView toolView)
- {
- Gui.CloseToolView(toolView);
- }
-
- #endregion
-
///
/// Creates a new .
///
Fisheye: Tag 0d7895f07d2c1b15457ffdc8e8762780a5837030 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.ProjectExplorer/Commands/ShowProjectExplorerCommand.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/Commands/ToggleProjectExplorerCommand.cs
===================================================================
diff -u
--- Core/Plugins/src/Core.Plugins.ProjectExplorer/Commands/ToggleProjectExplorerCommand.cs (revision 0)
+++ Core/Plugins/src/Core.Plugins.ProjectExplorer/Commands/ToggleProjectExplorerCommand.cs (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -0,0 +1,72 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Core.Common.Controls.Commands;
+using Core.Common.Gui;
+
+namespace Core.Plugins.ProjectExplorer.Commands
+{
+ public class ToggleProjectExplorerCommand : ICommand
+ {
+ private readonly IToolViewController toolViewController;
+
+ public ToggleProjectExplorerCommand(IToolViewController toolViewController)
+ {
+ this.toolViewController = toolViewController;
+ }
+
+ public bool Enabled
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public bool Checked
+ {
+ get
+ {
+ if (toolViewController == null || toolViewController.ToolWindowViews == null)
+ {
+ return false;
+ }
+
+ return toolViewController.ToolWindowViews.Contains(ProjectExplorerGuiPlugin.Instance.ProjectExplorer);
+ }
+ }
+
+ public void Execute(params object[] arguments)
+ {
+ var view = ProjectExplorerGuiPlugin.Instance.ProjectExplorer;
+ var active = toolViewController.ToolWindowViews.Contains(view);
+
+ if (active)
+ {
+ toolViewController.ToolWindowViews.Remove(view);
+ }
+ else
+ {
+ ProjectExplorerGuiPlugin.Instance.InitializeProjectTreeView();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/Core.Plugins.ProjectExplorer.csproj
===================================================================
diff -u -r7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.ProjectExplorer/Core.Plugins.ProjectExplorer.csproj (.../Core.Plugins.ProjectExplorer.csproj) (revision 7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1)
+++ Core/Plugins/src/Core.Plugins.ProjectExplorer/Core.Plugins.ProjectExplorer.csproj (.../Core.Plugins.ProjectExplorer.csproj) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -82,7 +82,7 @@
Properties\GlobalAssembly.cs
-
+
UserControl
@@ -99,9 +99,6 @@
Ribbon.xaml
-
- Component
-
Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.Designer.cs
===================================================================
diff -u -r7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.Designer.cs (.../ProjectExplorer.Designer.cs) (revision 7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1)
+++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.Designer.cs (.../ProjectExplorer.Designer.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -6,20 +6,7 @@
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
+
#region Component Designer generated code
///
@@ -28,27 +15,42 @@
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProjectExplorer));
this.treeViewPanel = new System.Windows.Forms.Panel();
+ this.projectTreeView = new Core.Common.Controls.TreeView.TreeView();
+ this.treeViewPanel.SuspendLayout();
this.SuspendLayout();
//
// treeViewPanel
//
+ this.treeViewPanel.Controls.Add(this.projectTreeView);
resources.ApplyResources(this.treeViewPanel, "treeViewPanel");
this.treeViewPanel.Name = "treeViewPanel";
//
+ // projectTreeView
+ //
+ this.projectTreeView.AllowDrop = true;
+ resources.ApplyResources(this.projectTreeView, "projectTreeView");
+ this.projectTreeView.HideSelection = false;
+ this.projectTreeView.LabelEdit = true;
+ this.projectTreeView.Name = "projectTreeView";
+ //
// ProjectExplorer
//
+ this.AllowDrop = true;
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.treeViewPanel);
this.Name = "ProjectExplorer";
+ this.treeViewPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel treeViewPanel;
+ private Common.Controls.TreeView.TreeView projectTreeView;
}
}
Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.cs
===================================================================
diff -u -r7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.cs (.../ProjectExplorer.cs) (revision 7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1)
+++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.cs (.../ProjectExplorer.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -18,8 +18,10 @@
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+
+using System;
using System.Windows.Forms;
-using Core.Common.Gui;
+using Core.Common.Controls.TreeView;
using Core.Common.Gui.Commands;
using Core.Common.Gui.Forms;
using Core.Common.Gui.Selection;
@@ -29,34 +31,90 @@
{
public partial class ProjectExplorer : UserControl, IProjectExplorer
{
- public ProjectExplorer(IApplicationSelection applicationSelection, IViewCommands viewCommands,
- IProjectOwner projectOwner)
+ public ProjectExplorer(IApplicationSelection applicationSelection, IViewCommands viewCommands)
{
InitializeComponent();
- ProjectTreeView = new ProjectTreeView(applicationSelection, viewCommands, projectOwner);
- treeViewPanel.Controls.Add(ProjectTreeView);
+ ApplicationSelection = applicationSelection;
+ ViewCommands = viewCommands;
+
+ TreeView.TreeViewController.TreeNodeDoubleClick += TreeViewDoubleClick;
+ TreeView.TreeViewController.NodeDataDeleted += ProjectDataDeleted;
+ TreeView.AfterSelect += TreeViewSelectedNodeChanged;
+ ApplicationSelection.SelectionChanged += GuiSelectionChanged;
}
- public ProjectTreeView ProjectTreeView { get; private set; }
public object Data
{
get
{
- return ProjectTreeView.Data;
+ return TreeView.TreeViewController.Data;
}
set
{
- ProjectTreeView.Data = value;
+ TreeView.TreeViewController.Data = value;
}
}
public TreeView TreeView
{
get
{
- return ProjectTreeView;
+ return projectTreeView;
}
}
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+
+ ApplicationSelection.SelectionChanged -= GuiSelectionChanged;
+
+ base.Dispose(disposing);
+ }
+
+ private IApplicationSelection ApplicationSelection { get; set; }
+ private IViewCommands ViewCommands { get; set; }
+
+ private void TreeViewSelectedNodeChanged(object sender, TreeViewEventArgs e)
+ {
+ ApplicationSelection.Selection = e.Node.Tag;
+ }
+
+ private void TreeViewDoubleClick(object sender, EventArgs e)
+ {
+ ViewCommands.OpenViewForSelection();
+ }
+
+ private void ProjectDataDeleted(object sender, TreeNodeDataDeletedEventArgs e)
+ {
+ ViewCommands.RemoveAllViewsForItem(e.DeletedDataInstance);
+ }
+
+ ///
+ /// Update selected node when selection in gui changes.
+ ///
+ ///
+ ///
+ private void GuiSelectionChanged(object sender, EventArgs e)
+ {
+ if (ApplicationSelection.Selection == null)
+ {
+ return;
+ }
+
+ TreeNode node = TreeView.TreeViewController.GetNodeByTag(ApplicationSelection.Selection);
+ if (node != null)
+ {
+ TreeView.SelectedNode = node;
+ }
+ }
}
}
\ No newline at end of file
Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.resx
===================================================================
diff -u -r7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.resx (.../ProjectExplorer.resx) (revision 7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1)
+++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorer.resx (.../ProjectExplorer.resx) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -118,17 +118,47 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
Fill
+
+
+ 0
+
+
+ 0, 0
+
+
+ 0
+
+
+ 375, 352
+
+
+ 0
+
+
+ projectTreeView
+
+
+ Core.Common.Controls.TreeView.TreeView, Core.Common.Controls.TreeView, Version=0.5.0.1894, Culture=neutral, PublicKeyToken=null
+
+
+ treeViewPanel
+
+
+ 0
+
+
+ Fill
+
0, 0
375, 352
-
5
Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs
===================================================================
diff -u -r7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision 7f1e4c8c634d60e05912f3fbbc72b21cd3404dc1)
+++ Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectExplorerGuiPlugin.cs (.../ProjectExplorerGuiPlugin.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -41,9 +41,7 @@
private IDocumentViewController documentViewController;
private IViewCommands viewCommands;
private IProjectOwner projectOwner;
- private IProjectCommands projectCommands;
private IApplicationSelection applicationSelection;
- private IGuiPluginsHost guiPluginsHost;
public ProjectExplorerGuiPlugin()
{
@@ -72,21 +70,17 @@
{
toolViewController = value;
projectOwner = value;
- projectCommands = value.ProjectCommands;
applicationSelection = value;
documentViewController = value;
viewCommands = value.ViewCommands;
- guiPluginsHost = value;
}
else
{
toolViewController = null;
projectOwner = null;
- projectCommands = null;
applicationSelection = null;
documentViewController = null;
viewCommands = null;
- guiPluginsHost = null;
}
}
@@ -142,18 +136,17 @@
{
if (ProjectExplorer == null || ProjectExplorer.IsDisposed)
{
- ProjectExplorer = new ProjectExplorer(applicationSelection, viewCommands, projectOwner);
+ ProjectExplorer = new ProjectExplorer(applicationSelection, viewCommands);
Gui.Plugins
.SelectMany(pluginGui => pluginGui.GetTreeNodeInfos())
- .ForEachElementDo(tni => ProjectExplorer.ProjectTreeView.TreeViewController.RegisterTreeNodeInfo(tni));
+ .ForEachElementDo(tni => ProjectExplorer.TreeView.TreeViewController.RegisterTreeNodeInfo(tni));
- ProjectExplorer.ProjectTreeView.Project = projectOwner.Project;
- ProjectExplorer.ProjectTreeView.TreeViewController.NodeUpdated += (s, e) => documentViewController.UpdateToolTips();
+ ProjectExplorer.TreeView.TreeViewController.Data = projectOwner.Project;
+ ProjectExplorer.TreeView.TreeViewController.NodeUpdated += (s, e) => documentViewController.UpdateToolTips();
ProjectExplorer.Text = Properties.Resources.ProjectExplorerPluginGui_InitializeProjectTreeView_Project_Explorer;
}
- //add project treeview as a toolwindowview.
toolViewController.ToolWindowViews.Add(ProjectExplorer, ViewLocation.Left | ViewLocation.Top);
}
@@ -188,12 +181,12 @@
private void ApplicationProjectClosed(Project project)
{
- ProjectExplorer.ProjectTreeView.Project = null;
+ ProjectExplorer.TreeView.TreeViewController.Data = null;
}
private void ApplicationProjectOpened(Project project)
{
- ProjectExplorer.ProjectTreeView.Project = project;
+ ProjectExplorer.TreeView.TreeViewController.Data = project;
}
}
}
\ No newline at end of file
Fisheye: Tag 0d7895f07d2c1b15457ffdc8e8762780a5837030 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.ProjectExplorer/ProjectTreeView.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/src/Core.Plugins.ProjectExplorer/Ribbon.xaml.cs
===================================================================
diff -u -rfbb37872d09f1ded75ce2209e8e48a6b64d8a78f -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/src/Core.Plugins.ProjectExplorer/Ribbon.xaml.cs (.../Ribbon.xaml.cs) (revision fbb37872d09f1ded75ce2209e8e48a6b64d8a78f)
+++ Core/Plugins/src/Core.Plugins.ProjectExplorer/Ribbon.xaml.cs (.../Ribbon.xaml.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -39,7 +39,7 @@
{
InitializeComponent();
- showProjectExplorerCommand = new ShowProjectExplorerCommand(toolViewController);
+ showProjectExplorerCommand = new ToggleProjectExplorerCommand(toolViewController);
}
public IEnumerable Commands
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/ChartingRibbonTest.cs
===================================================================
diff -u -rb6d165f6edddc4271e94c5f6d70c12d4ba0c60eb -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/ChartingRibbonTest.cs (.../ChartingRibbonTest.cs) (revision b6d165f6edddc4271e94c5f6d70c12d4ba0c60eb)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/ChartingRibbonTest.cs (.../ChartingRibbonTest.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -36,24 +36,23 @@
// Setup
var mocks = new MockRepository();
var documentViewController = mocks.Stub();
+ var toolViewController = mocks.Stub();
mocks.ReplayAll();
- using(var oxyPlotGuiPlugin = new OxyPlotGuiPlugin())
+ var openChartViewCommand = new OpenChartViewCommand(documentViewController);
+ var toggleLegendViewCommand = new ToggleLegendViewCommand(new LegendController(toolViewController));
+ var ribbon = new ChartingRibbon
{
- var openChartViewCommand = new OpenChartViewCommand(documentViewController);
- var toggleLegendViewCommand = new ToggleLegendViewCommand(new LegendController(oxyPlotGuiPlugin));
- var ribbon = new ChartingRibbon
- {
- OpenChartViewCommand = openChartViewCommand,
- ToggleLegendViewCommand = toggleLegendViewCommand,
- };
+ OpenChartViewCommand = openChartViewCommand,
+ ToggleLegendViewCommand = toggleLegendViewCommand,
+ };
- // Call
- var commands = ribbon.Commands.ToArray();
+ // Call
+ var commands = ribbon.Commands.ToArray();
- // Assert
- CollectionAssert.AreEqual(new ICommand[]{openChartViewCommand, toggleLegendViewCommand}, commands);
- }
+ // Assert
+ CollectionAssert.AreEqual(new ICommand[]{openChartViewCommand, toggleLegendViewCommand}, commands);
+
mocks.VerifyAll();
}
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Commands/ToggleLegendViewCommandTest.cs
===================================================================
diff -u -rb6d165f6edddc4271e94c5f6d70c12d4ba0c60eb -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Commands/ToggleLegendViewCommandTest.cs (.../ToggleLegendViewCommandTest.cs) (revision b6d165f6edddc4271e94c5f6d70c12d4ba0c60eb)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Commands/ToggleLegendViewCommandTest.cs (.../ToggleLegendViewCommandTest.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -1,4 +1,5 @@
using Core.Common.Controls.Commands;
+using Core.Common.Gui;
using Core.Plugins.OxyPlot.Commands;
using Core.Plugins.OxyPlot.Legend;
using NUnit.Framework;
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendControllerTest.cs
===================================================================
diff -u -ra70fac40e34e16bed007b1d0d4e437d91c89d0cb -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendControllerTest.cs (.../LegendControllerTest.cs) (revision a70fac40e34e16bed007b1d0d4e437d91c89d0cb)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/Legend/LegendControllerTest.cs (.../LegendControllerTest.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -1,4 +1,5 @@
using System;
+using Core.Common.Gui;
using Core.Plugins.OxyPlot.Legend;
using NUnit.Framework;
using Rhino.Mocks;
@@ -19,17 +20,20 @@
}
[Test]
- public void Constructor_WithPlugin_DoesNotThrow()
+ public void Constructor_WithToolViewController_DoesNotThrow()
{
// Setup
- using (var plugin = new OxyPlotGuiPlugin())
- {
- // Call
- TestDelegate test = () => new LegendController(plugin);
+ var mocks = new MockRepository();
+ var toolViewController = mocks.StrictMock();
- // Assert
- Assert.DoesNotThrow(test);
- }
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new LegendController(toolViewController);
+
+ // Assert
+ Assert.DoesNotThrow(test);
+ mocks.VerifyAll();
}
[Test]
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs
===================================================================
diff -u -r0c64d8a6c718c0aa67403a16c94dd0c10f862455 -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 0c64d8a6c718c0aa67403a16c94dd0c10f862455)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -28,14 +28,13 @@
{
// Assert
Assert.IsInstanceOf(plugin);
- Assert.IsInstanceOf(plugin);
Assert.IsNull(plugin.RibbonCommandHandler);
}
}
[Test]
[RequiresSTA]
- public void Activate_WithoutGui_ThrowsNullReferenceException()
+ public void Activate_WithoutGui_ThrowsArgumentNullException()
{
// Setup
using (var plugin = new OxyPlotGuiPlugin())
@@ -44,7 +43,7 @@
TestDelegate test = () => plugin.Activate();
// Assert
- Assert.Throws(test);
+ Assert.Throws(test);
}
}
@@ -58,15 +57,11 @@
using (var plugin = new OxyPlotGuiPlugin())
{
var gui = mocks.StrictMock();
- var dockingManger = mocks.Stub();
- var toolWindows = new ViewList(dockingManger, null);
- var view = mocks.StrictMock();
+ gui.Expect(g => g.IsToolWindowOpen()).Return(false);
+ gui.Expect(g => g.OpenToolView(Arg.Matches(c => true)));
gui.Expect(g => g.ActiveViewChanged += null).IgnoreArguments();
gui.Expect(g => g.ActiveViewChanged -= null).IgnoreArguments();
- gui.Expect(g => g.ToolWindowViews).Return(toolWindows).Repeat.Twice();
- gui.Expect(g => g.OpenToolView(Arg.Matches(c => true)));
- gui.Expect(g => g.ActiveView).Return(view);
mocks.ReplayAll();
@@ -102,70 +97,8 @@
}
[Test]
- public void CloseToolView_Always_CloseToolView()
- {
- // Setup
- using (var plugin = new OxyPlotGuiPlugin())
- {
- var mocks = new MockRepository();
- var gui = mocks.StrictMock();
- var view = mocks.StrictMock();
- gui.Expect(g => g.CloseToolView(view));
-
- mocks.ReplayAll();
-
- plugin.Gui = gui;
-
- // Call
- plugin.CloseToolView(view);
-
- // Assert
- mocks.VerifyAll();
- }
- }
-
- [Test]
- [RequiresSTA]
[TestCase(true)]
[TestCase(false)]
- public void GivenConfiguredGui_WhenOpenToolView_UpdateComponentsWithDataFromActiveView(bool isChartViewActive)
- {
- // Given
- var mocks = new MockRepository();
- var projectStore = mocks.Stub();
- mocks.ReplayAll();
-
- using (var gui = new RingtoetsGui(new MainWindow(), projectStore))
- {
- var plugin = new OxyPlotGuiPlugin();
- IView viewMock = isChartViewActive ? (IView)new TestChartView() : new TestView();
- var baseChart = new BaseChart
- {
- Data = new LineData(Enumerable.Empty>())
- };
- viewMock.Data = baseChart;
-
- gui.Plugins.Add(plugin);
- gui.Run();
-
- gui.DocumentViews.Add(viewMock);
- gui.DocumentViews.ActiveView = viewMock;
- var legendView = gui.ToolWindowViews.First(t => t is LegendView);
-
- legendView.Data = null;
-
- // When
- plugin.OpenToolView(legendView);
-
- // Then
- Assert.AreSame(isChartViewActive ? baseChart.Data : null, legendView.Data);
- mocks.VerifyAll();
- }
- }
-
- [Test]
- [TestCase(true)]
- [TestCase(false)]
[RequiresSTA]
public void GivenConfiguredGui_WhenActiveViewChangesToViewWithChart_ThenRibbonSetVisibility(bool visible)
{
Index: Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/Core.Plugins.ProjectExplorer.Test.csproj
===================================================================
diff -u -rb6d165f6edddc4271e94c5f6d70c12d4ba0c60eb -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/Core.Plugins.ProjectExplorer.Test.csproj (.../Core.Plugins.ProjectExplorer.Test.csproj) (revision b6d165f6edddc4271e94c5f6d70c12d4ba0c60eb)
+++ Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/Core.Plugins.ProjectExplorer.Test.csproj (.../Core.Plugins.ProjectExplorer.Test.csproj) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -83,7 +83,6 @@
-
Fisheye: Tag 0d7895f07d2c1b15457ffdc8e8762780a5837030 refers to a dead (removed) revision in file `Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/ProjectTreeViewTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/TreeNodeInfos/ProjectTreeNodeInfoTest.cs
===================================================================
diff -u -rc69baf986e7cc7a0158ef8c51ddf4e62dd05038f -r0d7895f07d2c1b15457ffdc8e8762780a5837030
--- Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/TreeNodeInfos/ProjectTreeNodeInfoTest.cs (.../ProjectTreeNodeInfoTest.cs) (revision c69baf986e7cc7a0158ef8c51ddf4e62dd05038f)
+++ Core/Plugins/test/Core.Plugins.ProjectExplorer.Test/TreeNodeInfos/ProjectTreeNodeInfoTest.cs (.../ProjectTreeNodeInfoTest.cs) (revision 0d7895f07d2c1b15457ffdc8e8762780a5837030)
@@ -111,11 +111,9 @@
var treeNode = new TreeNode();
var gui = mocks.StrictMultiMock();
var menuBuilderMock = mocks.StrictMock();
- var projectCommandsMock = mocks.StrictMock();
var viewCommandsMock = mocks.StrictMock();
gui.Expect(g => g.Get(treeNode, info)).Return(menuBuilderMock);
- gui.Expect(g => g.ProjectCommands).Return(projectCommandsMock);
gui.Expect(g => g.ViewCommands).Return(viewCommandsMock);
menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock);