Index: src/Common/DelftTools.Shell.Core/Project.cs =================================================================== diff -u -r11918aed7833985ed88f93a4238b2d8f241cff17 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/DelftTools.Shell.Core/Project.cs (.../Project.cs) (revision 11918aed7833985ed88f93a4238b2d8f241cff17) +++ src/Common/DelftTools.Shell.Core/Project.cs (.../Project.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -1,18 +1,20 @@ using System.Collections.Generic; using DelftTools.Utils.Collections.Generic; +using DelftTools.Utils.Data; namespace DelftTools.Shell.Core { /// /// Container of all data and tasks. /// - public class Project : IObservable + public class Project : EditableObjectUnique, IObservable { private string name; private string description; private bool isChanged; private bool isTemporary; + private bool isMigrated; /// /// Creates instance of the Project. Index: src/Common/DelftTools.Shell.Core/Workflow/ActivityWrapper.cs =================================================================== diff -u -r12d3ca90d930bd544210c41acccb7ef1271a7e8c -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/DelftTools.Shell.Core/Workflow/ActivityWrapper.cs (.../ActivityWrapper.cs) (revision 12d3ca90d930bd544210c41acccb7ef1271a7e8c) +++ src/Common/DelftTools.Shell.Core/Workflow/ActivityWrapper.cs (.../ActivityWrapper.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -47,6 +47,7 @@ public override string Name { get { return Activity.Name; } + [EditAction] set { Activity.Name = value; } } Fisheye: Tag 11918aed7833985ed88f93a4238b2d8f241cff17 refers to a dead (removed) revision in file `src/Common/DelftTools.Utils/Collections/Generic/EventedListView.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: src/Common/DelftTools.Utils/DelftTools.Utils.csproj =================================================================== diff -u -r948f442828afd82e742d73b10afbeb0d6a31a7e6 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/DelftTools.Utils/DelftTools.Utils.csproj (.../DelftTools.Utils.csproj) (revision 948f442828afd82e742d73b10afbeb0d6a31a7e6) +++ src/Common/DelftTools.Utils/DelftTools.Utils.csproj (.../DelftTools.Utils.csproj) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -248,6 +248,7 @@ + Index: src/Common/DelftTools.Utils/TextDocumentBase.cs =================================================================== diff -u -rc681de56bb7c40d7c5802f2993feb4aa61c2e1d2 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/DelftTools.Utils/TextDocumentBase.cs (.../TextDocumentBase.cs) (revision c681de56bb7c40d7c5802f2993feb4aa61c2e1d2) +++ src/Common/DelftTools.Utils/TextDocumentBase.cs (.../TextDocumentBase.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -1,9 +1,10 @@ using DelftTools.Utils.Aop; +using DelftTools.Utils.Data; namespace DelftTools.Utils { [Entity(FireOnCollectionChange = false)] - public abstract class TextDocumentBase : INameable + public abstract class TextDocumentBase : EditableObjectUnique, INameable { private readonly bool readOnly; Index: src/Common/SharpMap/Layers/GroupLayer.cs =================================================================== diff -u -r4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/SharpMap/Layers/GroupLayer.cs (.../GroupLayer.cs) (revision 4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5) +++ src/Common/SharpMap/Layers/GroupLayer.cs (.../GroupLayer.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -79,7 +79,7 @@ switch (e.Action) { case NotifyCollectionChangeAction.Add: //set map property for layers being added - ((ILayer) e.Item).Map = Map; + SetMapInLayer((ILayer) e.Item); ((ILayer) e.Item).RenderRequired = true; break; case NotifyCollectionChangeAction.Remove: @@ -90,6 +90,12 @@ } } + [EditAction] + private void SetMapInLayer(ILayer layer) + { + layer.Map = Map; + } + void LayersCollectionChanging(object sender, NotifyCollectionChangingEventArgs e) { // performance @@ -100,10 +106,7 @@ if (sender == layers) //only for own layer collection { - if (LayersReadOnly) - { - throw new InvalidOperationException("It is not allowed to add or remove layers from a grouplayer that has a read-only layers collection"); - } + CheckIfLayersIsMutableOrThrow(); } if (CollectionChanging != null) @@ -112,6 +115,16 @@ } } + [EditAction] //a bit of a hack, not strictly an edit action + private void CheckIfLayersIsMutableOrThrow() + { + if (LayersReadOnly) + { + throw new InvalidOperationException( + "It is not allowed to add or remove layers from a grouplayer that has a read-only layers collection"); + } + } + [NoNotifyPropertyChange] public override bool RenderRequired { @@ -175,6 +188,15 @@ } } + [EditAction] + private void AfterMapSet() + { + foreach (ILayer layer in Layers) + { + layer.Map = Map; + } + } + private IEventedList layers; /// @@ -187,10 +209,7 @@ if (!isMapInitialized) { isMapInitialized = true; - foreach (ILayer layer in Layers) - { - layer.Map = Map; - } + AfterMapSet(); } return layers; Index: src/Common/SharpMap/Layers/Layer.cs =================================================================== diff -u -r4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/SharpMap/Layers/Layer.cs (.../Layer.cs) (revision 4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5) +++ src/Common/SharpMap/Layers/Layer.cs (.../Layer.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -735,6 +735,7 @@ UpdateCoordinateTransformation(); } + [EditAction] protected void UpdateCoordinateTransformation() { if (map == null) @@ -1111,14 +1112,20 @@ { labelLayer = value; - if (labelLayer != null) - { - labelLayer.Parent = this; - labelLayer.Map = map; - } + AfterLabelLayerSet(); } } + [EditAction] + private void AfterLabelLayerSet() + { + if (labelLayer != null) + { + labelLayer.Parent = this; + labelLayer.Map = map; + } + } + #region IDisposable Members /// Index: src/Common/SharpMap/Map/Map.cs =================================================================== diff -u -r12d3ca90d930bd544210c41acccb7ef1271a7e8c -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/SharpMap/Map/Map.cs (.../Map.cs) (revision 12d3ca90d930bd544210c41acccb7ef1271a7e8c) +++ src/Common/SharpMap/Map/Map.cs (.../Map.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -876,6 +876,7 @@ } } + [EditAction] private void CreateCoordinateSystemFromWkt(string value) { if (createCoordinateSystemFromWkt) return; @@ -968,6 +969,7 @@ } } + [EditAction] private void UpdateLayerCoordinateTransformation(ILayer layer) { if (CoordinateSystem == null) @@ -1072,8 +1074,8 @@ throw new NotImplementedException(); case NotifyCollectionChangeAction.Add: - layer1.Map = this; - + SetMapInLayer(layer1); + CheckMapExtends(layer1); UpdateLayerCoordinateTransformation(layer1); @@ -1092,6 +1094,7 @@ } } + [EditAction] private void SetRenderOrderAfterInsert(ILayer layer) { // Group layers are ignored in this code (by design) @@ -1119,6 +1122,7 @@ newLayers.ForEach(l => l.RenderOrder = allLayers.IndexOf(l) + 1); } + [EditAction] private void SetRenderOrderAfterRemove(ILayer layer) { // Group layers are ignored in this code (by design) @@ -1139,6 +1143,12 @@ .ForEach(l => l.RenderOrder -= oldLayers.Count); } + [EditAction] + private void SetMapInLayer(ILayer layer) + { + layer.Map = this; + } + /// /// Zooms map to extends if the added layer is the only layer with valid envelope. /// Index: src/DeltaShell/DeltaShell.Gui/DeltaShellGui.cs =================================================================== diff -u -r11918aed7833985ed88f93a4238b2d8f241cff17 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/DeltaShell/DeltaShell.Gui/DeltaShellGui.cs (.../DeltaShellGui.cs) (revision 11918aed7833985ed88f93a4238b2d8f241cff17) +++ src/DeltaShell/DeltaShell.Gui/DeltaShellGui.cs (.../DeltaShellGui.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -116,6 +116,7 @@ { if (application != null) { + UnsubscribeProjectEvents(); Application.ProjectClosing -= ApplicationProjectClosing; Application.ProjectOpened -= ApplicationProjectOpened; Application.ProjectOpening -= ApplicationProjectOpening; @@ -655,16 +656,75 @@ { Application.Project.IsChanged = false; + SubscribeProjectEvents(); ResumeUI(); } private void ApplicationProjectClosing(Project project) { + UnsubscribeProjectEvents(); SuspendUI(); ClonableToolStripMenuItem.ClearCache(); } + private void SubscribeProjectEvents() + { + var propertyChanged = (INotifyPropertyChanged)Application.Project; + propertyChanged.PropertyChanged += ApplicationProjectPropertyChanged; + + var collectionChanged = (INotifyCollectionChange)Application.Project; + } + + private void UnsubscribeProjectEvents() + { + if(Application.Project == null) + { + return; + } + + var propertyChanged = (INotifyPropertyChanged) Application.Project; + propertyChanged.PropertyChanged -= ApplicationProjectPropertyChanged; + + var collectionChanged = (INotifyCollectionChange)Application.Project; + } + + private bool viewNamesDirty = false; + + private void ApplicationProjectPropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (viewNamesDirty && sender is Project && e.PropertyName == "IsEditing" && !Application.Project.IsEditing) + { + OnProjectItemNameChanged(null); //sender is ignored anyway + viewNamesDirty = false; + return; + } + + if (e.PropertyName != "Name") + { + return; + } + + if (!Application.IsActivityRunning()) // avoid calls to Windows.Forms thread + { + if (Application.Project != null && Application.Project.IsEditing) + { + viewNamesDirty = true; + return; + } + OnProjectItemNameChanged(sender); + } + } + + [InvokeRequired] + private void OnProjectItemNameChanged(object sender) + { + foreach (var documentView in DocumentViews.AllViews) + { + UpdateViewName(documentView); + } + } + // Sets the tooltip for given view, assuming that ProjectExplorer is not null. private void SetToolTipForView(IView view) { Index: src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/DeltaShell.Plugins.CommonTools.Gui.csproj =================================================================== diff -u -rc681de56bb7c40d7c5802f2993feb4aa61c2e1d2 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/DeltaShell.Plugins.CommonTools.Gui.csproj (.../DeltaShell.Plugins.CommonTools.Gui.csproj) (revision c681de56bb7c40d7c5802f2993feb4aa61c2e1d2) +++ src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/DeltaShell.Plugins.CommonTools.Gui.csproj (.../DeltaShell.Plugins.CommonTools.Gui.csproj) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -164,7 +164,6 @@ PublicResXFileCodeGenerator Resources.nl-NL.Designer.cs - Designer PublicResXFileCodeGenerator Index: src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Forms/TextDocumentView.cs =================================================================== diff -u -rc681de56bb7c40d7c5802f2993feb4aa61c2e1d2 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Forms/TextDocumentView.cs (.../TextDocumentView.cs) (revision c681de56bb7c40d7c5802f2993feb4aa61c2e1d2) +++ src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Forms/TextDocumentView.cs (.../TextDocumentView.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -7,6 +7,8 @@ using DelftTools.Controls; using DelftTools.Utils; using DelftTools.Utils.Aop; +using DelftTools.Utils.Editing; +using DeltaShell.Plugins.CommonTools.Gui.Properties; namespace DeltaShell.Plugins.CommonTools.Gui.Forms { @@ -79,7 +81,9 @@ { settingContent = true; + textDocument.BeginEdit(new DefaultEditAction(Resources.TextDocumentView_OnVisibleChanged_Edit_text__ + characters)); textDocument.Content = textBox.Text; + textDocument.EndEdit(); characters = ""; settingContent = false; @@ -148,7 +152,9 @@ { settingContent = true; + textDocument.BeginEdit(new DefaultEditAction(Resources.TextDocumentView_OnVisibleChanged_Edit_text__ + characters)); textDocument.Content = textBox.Text; + textDocument.EndEdit(); characters = ""; timer.Stop(); Index: src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -rc681de56bb7c40d7c5802f2993feb4aa61c2e1d2 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c681de56bb7c40d7c5802f2993feb4aa61c2e1d2) +++ src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18063 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -2587,6 +2587,15 @@ } /// + /// Looks up a localized string similar to Edit text:. + /// + public static string TextDocumentView_OnVisibleChanged_Edit_text__ { + get { + return ResourceManager.GetString("TextDocumentView_OnVisibleChanged_Edit_text__", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap TimeSeries { Index: src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.nl-NL.resx =================================================================== diff -u -rc681de56bb7c40d7c5802f2993feb4aa61c2e1d2 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision c681de56bb7c40d7c5802f2993feb4aa61c2e1d2) +++ src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -900,6 +900,9 @@ NL Generate + + NL Edit text: + NL Choose your settings for the imported time series Index: src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.resx =================================================================== diff -u -rc681de56bb7c40d7c5802f2993feb4aa61c2e1d2 -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.resx (.../Resources.resx) (revision c681de56bb7c40d7c5802f2993feb4aa61c2e1d2) +++ src/DeltaShell/DeltaShell.Plugins.CommonTools.Gui/Properties/Resources.resx (.../Resources.resx) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -844,6 +844,9 @@ Font size is not within limits (3 - 200) + + Edit text: + Delta Shell Project File Index: test/Common/DelftTools.Tests/Controls/Swf/UndoRedoTestClasses/Child.cs =================================================================== diff -u -rc3b744cef7b0188501043e3cd312ffe299bde183 -r8edbe5e2130c81b456385607891c6ef98928f88e --- test/Common/DelftTools.Tests/Controls/Swf/UndoRedoTestClasses/Child.cs (.../Child.cs) (revision c3b744cef7b0188501043e3cd312ffe299bde183) +++ test/Common/DelftTools.Tests/Controls/Swf/UndoRedoTestClasses/Child.cs (.../Child.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -4,7 +4,7 @@ namespace DelftTools.Tests.Controls.Swf.UndoRedoTestClasses { [Entity(FireOnCollectionChange=false)] - public class Child + public class Child : IEditableObject { public string Name { get; set; } Index: test/Common/DelftTools.Tests/Controls/Swf/UndoRedoTestClasses/Parent.cs =================================================================== diff -u -rc3b744cef7b0188501043e3cd312ffe299bde183 -r8edbe5e2130c81b456385607891c6ef98928f88e --- test/Common/DelftTools.Tests/Controls/Swf/UndoRedoTestClasses/Parent.cs (.../Parent.cs) (revision c3b744cef7b0188501043e3cd312ffe299bde183) +++ test/Common/DelftTools.Tests/Controls/Swf/UndoRedoTestClasses/Parent.cs (.../Parent.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -6,7 +6,7 @@ namespace DelftTools.Tests.Controls.Swf.UndoRedoTestClasses { [Entity] - public class Parent + public class Parent : IEditableObject { public Parent() { Fisheye: Tag da707a3b8353f0928f7f5f77021e804d92529a7d refers to a dead (removed) revision in file `test/Common/DelftTools.Utils.Tests/Aop/EditableObjectUniqueTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag da707a3b8353f0928f7f5f77021e804d92529a7d refers to a dead (removed) revision in file `test/Common/DelftTools.Utils.Tests/Aop/TestClasses/ChildObject.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag da707a3b8353f0928f7f5f77021e804d92529a7d refers to a dead (removed) revision in file `test/Common/DelftTools.Utils.Tests/Aop/TestClasses/ClassWithAspects.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag da707a3b8353f0928f7f5f77021e804d92529a7d refers to a dead (removed) revision in file `test/Common/DelftTools.Utils.Tests/Aop/TestClasses/ClassWithoutAspects.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag da707a3b8353f0928f7f5f77021e804d92529a7d refers to a dead (removed) revision in file `test/Common/DelftTools.Utils.Tests/Aop/TestClasses/ParentObject.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: test/Common/DelftTools.Utils.Tests/DelftTools.Utils.Tests.csproj =================================================================== diff -u -rda707a3b8353f0928f7f5f77021e804d92529a7d -r8edbe5e2130c81b456385607891c6ef98928f88e --- test/Common/DelftTools.Utils.Tests/DelftTools.Utils.Tests.csproj (.../DelftTools.Utils.Tests.csproj) (revision da707a3b8353f0928f7f5f77021e804d92529a7d) +++ test/Common/DelftTools.Utils.Tests/DelftTools.Utils.Tests.csproj (.../DelftTools.Utils.Tests.csproj) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -128,14 +128,19 @@ + + + + +