diff options
11 files changed, 8 insertions, 94 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/ISolutionItemHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/ISolutionItemHandler.cs index adef0bf5d4..3fe2ca2901 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/ISolutionItemHandler.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/ISolutionItemHandler.cs @@ -72,13 +72,5 @@ namespace MonoDevelop.Projects.Extensions /// Unique and immutable identifier of the solution item inside the solution /// </summary> string ItemId { get; } - - /// <summary> - /// Notifies that this solution item has been modified - /// </summary> - /// <param name='hint'> - /// Hint about which part of the solution item has been modified. This will typically be the property name. - /// </param> - void OnModified (string hint); } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/SolutionItemHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/SolutionItemHandler.cs index 56391bd52f..74bc882e00 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/SolutionItemHandler.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Extensions/SolutionItemHandler.cs @@ -78,9 +78,5 @@ namespace MonoDevelop.Projects.Extensions public abstract string ItemId { get; } public abstract void Save (IProgressMonitor monitor); - - public virtual void OnModified (string hint) - { - } } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildHandler.cs index b054d44061..997d89402c 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildHandler.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildHandler.cs @@ -135,10 +135,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild throw new NotSupportedException (); } - public virtual void OnModified (string hint) - { - } - public virtual void Dispose () { } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProject.cs index eef96162ff..2c4adcc030 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProject.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProject.cs @@ -141,12 +141,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild public void Save (string fileName) { - string content = SaveToString (); - TextFile.WriteFile (fileName, content, bom, true); - } - - public string SaveToString () - { // StringWriter.Encoding always returns UTF16. We need it to return UTF8, so the // XmlDocument will write the UTF8 header. ProjectWriter sw = new ProjectWriter (bom); @@ -157,7 +151,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild if (endsWithEmptyLine && !content.EndsWith (newLine)) content += newLine; - return content; + TextFile.WriteFile (fileName, content, bom, true); } public string DefaultTargets { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs index 6df5bff7d2..bbefbadd2f 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs @@ -42,7 +42,6 @@ using Mono.Addins; using System.Linq; using MonoDevelop.Core.Instrumentation; using System.Text; -using MonoDevelop.Core.ProgressMonitoring; namespace MonoDevelop.Projects.Formats.MSBuild { @@ -58,7 +57,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild string lastFileName; ITimeTracker timer; bool forceUseMSBuild; - bool modifiedInMemory; struct ItemInfo { public MSBuildItem Item; @@ -140,11 +138,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild lastBuildRuntime = runtime.Id; lastFileName = item.FileName; } - else if (modifiedInMemory) { - modifiedInMemory = false; - var p = SaveProject (new NullProgressMonitor ()); - projectBuilder.RefreshWithContent (p.SaveToString ()); - } return projectBuilder; } @@ -969,31 +962,10 @@ namespace MonoDevelop.Projects.Formats.MSBuild return false; } - public override void OnModified (string hint) - { - base.OnModified (hint); - modifiedInMemory = true; - } - protected override void SaveItem (MonoDevelop.Core.IProgressMonitor monitor) { - modifiedInMemory = false; - - MSBuildProject msproject = SaveProject (monitor); - if (msproject == null) - return; - - // Don't save the file to disk if the content did not change - msproject.Save (EntityItem.FileName); - - if (projectBuilder != null) - projectBuilder.Refresh (); - } - - MSBuildProject SaveProject (MonoDevelop.Core.IProgressMonitor monitor) - { if (Item is UnknownProject || Item is UnknownSolutionItem) - return null; + return; bool newProject; SolutionEntityItem eitem = EntityItem; @@ -1235,7 +1207,11 @@ namespace MonoDevelop.Projects.Formats.MSBuild } else msproject.RemoveProjectExtensions ("MonoDevelop"); - return msproject; + // Don't save the file to disk if the content did not change + msproject.Save (eitem.FileName); + + if (projectBuilder != null) + projectBuilder.Refresh (); } void SetIfPresentOrNotDefaultValue (MSBuildPropertySet propGroup, string name, string value, string defaultValue) diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs index b48d28766f..a30a8f7d94 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/RemoteProjectBuilder.cs @@ -96,11 +96,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild builder.Refresh (); } - public void RefreshWithContent (string projectContent) - { - builder.RefreshWithContent (projectContent); - } - public void Dispose () { if (engine != null) { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs index 89ae4dfbc5..4764f5541f 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs @@ -985,10 +985,6 @@ namespace MonoDevelop.Projects get { return false; } } - public void OnModified (string hint) - { - } - public void Dispose () { } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs index 16b98083fa..71f75b3cf9 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs @@ -897,7 +897,6 @@ namespace MonoDevelop.Projects /// </param> protected void NotifyModified (string hint) { - ItemHandler.OnModified (hint); OnModified (new SolutionItemModifiedEventArgs (this, hint)); } diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs index 6644ad3f79..315bd88b46 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/BuildEngine.cs @@ -46,7 +46,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild ManualResetEvent doneEvent = new ManualResetEvent (false); Dictionary<string,Engine> engines = new Dictionary<string, Engine> (); - Dictionary<string,string> unsavedProjects = new Dictionary<string, string> (); public void Dispose () { @@ -93,9 +92,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild internal void UnloadProject (string file) { - lock (unsavedProjects) - unsavedProjects.Remove (file); - RunSTA (delegate { foreach (var engine in engines.Values) { var loadedProj = engine.GetLoadedProject (file); @@ -105,21 +101,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild }); } - internal void SetUnsavedProjectContent (string file, string content) - { - lock (unsavedProjects) - unsavedProjects [file] = content; - } - - internal string GetUnsavedProjectContent (string file) - { - lock (unsavedProjects) { - string content; - unsavedProjects.TryGetValue (file, out content); - return content; - } - } - internal static void RunSTA (ThreadStart ts) { lock (workLock) { diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs index 8253c49b33..167acc7240 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/IProjectBuilder.cs @@ -34,7 +34,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild MSBuildVerbosity verbosity); string[] GetAssemblyReferences (ProjectConfigurationInfo[] configurations); void Refresh (); - void RefreshWithContent (string projectContent); } [Serializable] diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs index 56960f921d..20a59ab9e4 100644 --- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs +++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.Formats.MSBuild/ProjectBuilder.cs @@ -63,12 +63,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild buildEngine.UnloadProject (file); } - public void RefreshWithContent (string projectContent) - { - buildEngine.UnloadProject (file); - buildEngine.SetUnsavedProjectContent (file, projectContent); - } - void LogWriteLine (string txt) { if (currentLogWriter != null) @@ -151,11 +145,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild var p = engine.GetLoadedProject (pc.ProjectFile); if (p == null) { p = new Project (engine); - var content = buildEngine.GetUnsavedProjectContent (pc.ProjectFile); - if (content == null) - p.Load (pc.ProjectFile); - else - p.Load (new StringReader (content)); + p.Load (pc.ProjectFile); } p.GlobalProperties.SetProperty ("Configuration", pc.Configuration); if (!string.IsNullOrEmpty (pc.Platform)) |