Index: src/Plugins/Wti/Wti.Data/PipingSoilProfile.cs
===================================================================
diff -u -r7e20ab62aae77f680275d9acd08f81cd12d37b97 -r85de34918096850be7844fe93a73336cd7c29d3e
--- src/Plugins/Wti/Wti.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 7e20ab62aae77f680275d9acd08f81cd12d37b97)
+++ src/Plugins/Wti/Wti.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 85de34918096850be7844fe93a73336cd7c29d3e)
@@ -1,7 +1,7 @@
namespace Wti.Data
{
///
- /// This class represents Soil Profiles imported for use in a piping calculation.
+ /// This class represents a soil profile, which was imported for use in a piping calculation.
///
public class PipingSoilProfile
{
Index: src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSoilProfileCollectionNodePresenter.cs
===================================================================
diff -u -r7e20ab62aae77f680275d9acd08f81cd12d37b97 -r85de34918096850be7844fe93a73336cd7c29d3e
--- src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSoilProfileCollectionNodePresenter.cs (.../PipingSoilProfileCollectionNodePresenter.cs) (revision 7e20ab62aae77f680275d9acd08f81cd12d37b97)
+++ src/Plugins/Wti/Wti.Forms/NodePresenters/PipingSoilProfileCollectionNodePresenter.cs (.../PipingSoilProfileCollectionNodePresenter.cs) (revision 85de34918096850be7844fe93a73336cd7c29d3e)
@@ -3,19 +3,28 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
+using System.Windows.Forms;
using DelftTools.Controls;
+using DelftTools.Controls.Swf;
using DelftTools.Utils.Collections;
using Wti.Data;
+using Wti.Forms.Extensions;
using Wti.Forms.Properties;
namespace Wti.Forms.NodePresenters
{
///
- /// Tree node presenter representing the collection of piping surface line available for piping
+ /// Tree node presenter representing the collection of available for piping
/// calculations.
///
public class PipingSoilProfileCollectionNodePresenter : ITreeNodePresenter
{
+ ///
+ /// Sets the action to be performed when importing instances
+ /// to .
+ ///
+ public Action ImportSoilProfilesAction { private get; set; }
+
public ITreeView TreeView { get; set; }
public Type NodeTagType
@@ -81,6 +90,10 @@
public IMenuItem GetContextMenu(ITreeNode sender, object nodeData)
{
+ if (ImportSoilProfilesAction != null)
+ {
+ return new MenuItemContextMenuStripAdapter(CreateContextMenu());
+ }
return null;
}
@@ -97,5 +110,24 @@
{
throw new InvalidOperationException(String.Format("Cannot delete node of type {0}.", GetType().Name));
}
+
+ private ContextMenuStrip CreateContextMenu()
+ {
+ var strip = new ContextMenuStrip();
+ if (ImportSoilProfilesAction != null)
+ {
+ strip.AddMenuItem(
+ Resources.ImportSoilProfiles,
+ Resources.ImportSoilProfilesDescription,
+ Resources.ImportIcon,
+ ImportSoilProfilesOnClick);
+ }
+ return strip;
+ }
+
+ private void ImportSoilProfilesOnClick(object sender, EventArgs e)
+ {
+ ImportSoilProfilesAction();
+ }
}
}
\ No newline at end of file
Index: src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r4959b3b9b84eec4cb80ec43c037579d9177b3d02 -r85de34918096850be7844fe93a73336cd7c29d3e
--- src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4959b3b9b84eec4cb80ec43c037579d9177b3d02)
+++ src/Plugins/Wti/Wti.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 85de34918096850be7844fe93a73336cd7c29d3e)
@@ -99,6 +99,24 @@
}
///
+ /// Looks up a localized string similar to Importeer ondergrondprofielen.
+ ///
+ public static string ImportSoilProfiles {
+ get {
+ return ResourceManager.GetString("ImportSoilProfiles", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Importeer nieuwe ondergrondprofielen van een *.soil bestand..
+ ///
+ public static string ImportSoilProfilesDescription {
+ get {
+ return ResourceManager.GetString("ImportSoilProfilesDescription", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Importeer dwarsdoorsnedes.
///
public static string ImportSurfaceLines {
Index: src/Plugins/Wti/Wti.Forms/Properties/Resources.resx
===================================================================
diff -u -r4959b3b9b84eec4cb80ec43c037579d9177b3d02 -r85de34918096850be7844fe93a73336cd7c29d3e
--- src/Plugins/Wti/Wti.Forms/Properties/Resources.resx (.../Resources.resx) (revision 4959b3b9b84eec4cb80ec43c037579d9177b3d02)
+++ src/Plugins/Wti/Wti.Forms/Properties/Resources.resx (.../Resources.resx) (revision 85de34918096850be7844fe93a73336cd7c29d3e)
@@ -355,4 +355,10 @@
Ondergrondprofielen
+
+ Importeer ondergrondprofielen
+
+
+ Importeer nieuwe ondergrondprofielen van een *.soil bestand.
+
\ No newline at end of file
Index: src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs
===================================================================
diff -u -r4959b3b9b84eec4cb80ec43c037579d9177b3d02 -r85de34918096850be7844fe93a73336cd7c29d3e
--- src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs (.../WtiGuiPlugin.cs) (revision 4959b3b9b84eec4cb80ec43c037579d9177b3d02)
+++ src/Plugins/Wti/Wti.Plugin/WtiGuiPlugin.cs (.../WtiGuiPlugin.cs) (revision 85de34918096850be7844fe93a73336cd7c29d3e)
@@ -78,7 +78,10 @@
{
ImportSurfaceLinesAction = Gui.CommandHandler.ImportToGuiSelection
};
- yield return new PipingSoilProfileCollectionNodePresenter();
+ yield return new PipingSoilProfileCollectionNodePresenter
+ {
+ ImportSoilProfilesAction = Gui.CommandHandler.ImportToGuiSelection
+ };
yield return new PipingOutputNodePresenter();
}
}
Index: test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSoilProfileCollectionNodePresenterTest.cs
===================================================================
diff -u -r7e20ab62aae77f680275d9acd08f81cd12d37b97 -r85de34918096850be7844fe93a73336cd7c29d3e
--- test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSoilProfileCollectionNodePresenterTest.cs (.../PipingSoilProfileCollectionNodePresenterTest.cs) (revision 7e20ab62aae77f680275d9acd08f81cd12d37b97)
+++ test/Plugins/Wti/Wti.Forms.Test/NodePresenters/PipingSoilProfileCollectionNodePresenterTest.cs (.../PipingSoilProfileCollectionNodePresenterTest.cs) (revision 85de34918096850be7844fe93a73336cd7c29d3e)
@@ -5,6 +5,7 @@
using System.Drawing;
using System.Linq;
using DelftTools.Controls;
+using DelftTools.Controls.Swf;
using DelftTools.Utils.Collections;
using NUnit.Framework;
using Rhino.Mocks;
@@ -318,5 +319,54 @@
Assert.AreEqual(expectedMessage, exception.Message);
mocks.VerifyAll(); // Expect no calls on arguments
}
+
+
+ [Test]
+ public void GetContextMenu_DefaultScenario_ReturnNull()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var nodeMock = mocks.StrictMock();
+ var dataMock = mocks.StrictMock