[Monodevelop-patches-list] r1826 - in trunk/MonoDevelop/src/Main/Base: . Gui Gui/Dialogs Gui/Dialogs/ReferenceDialog Gui/Workbench Services/File
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Fri Jun 25 16:38:50 EDT 2004
Author: tberman
Date: 2004-06-25 16:38:49 -0400 (Fri, 25 Jun 2004)
New Revision: 1826
Modified:
trunk/MonoDevelop/src/Main/Base/ChangeLog
trunk/MonoDevelop/src/Main/Base/Gui/AbstractViewContent.cs
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/DirtyFilesDialog.cs
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs
trunk/MonoDevelop/src/Main/Base/Gui/IViewContent.cs
trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs
trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs
Log:
new dirty files dialog, looks nice, seems to work well, i think i caught all the corner cases and whatnot.
Modified: trunk/MonoDevelop/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/Main/Base/ChangeLog 2004-06-25 20:19:20 UTC (rev 1825)
+++ trunk/MonoDevelop/src/Main/Base/ChangeLog 2004-06-25 20:38:49 UTC (rev 1826)
@@ -1,3 +1,18 @@
+2004-06-25 Todd Berman <tberman at off.net>
+
+ * Gui/AbstractViewContent.cs: Make PathRelativeToProject not store in
+ a string, and always be correct, no matter if the file is new, or has
+ been moved since being loaded.
+ * Gui/Dialogs/DirtyFilesDialog.cs: New dialog to use on close, should
+ be working perfectly.
+ * Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs: formatting fixes.
+ * Gui/IViewContent.cs: No longer all PathRelativeToProject to be set.
+ * Gui/Workbench/DefaultWorkbench.cs: remove the old closing code, and
+ use the new dirty files dialog.
+ * Services/File/FileService.cs: Fix LoadWrapperClass to not set the
+ path relative to project, as that is handled differently now. Remove
+ a method to make a path relative as there is no need for it now.
+
2004-06-24 Todd Berman <tberman at off.net>
* Commands/ProjectBrowserCommands/CombineNodeCommands.cs: set dialog
Modified: trunk/MonoDevelop/src/Main/Base/Gui/AbstractViewContent.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/AbstractViewContent.cs 2004-06-25 20:19:20 UTC (rev 1825)
+++ trunk/MonoDevelop/src/Main/Base/Gui/AbstractViewContent.cs 2004-06-25 20:38:49 UTC (rev 1826)
@@ -8,6 +8,7 @@
using System;
using MonoDevelop.Services;
+using MonoDevelop.Core.Services;
using MonoDevelop.Internal.Project;
namespace MonoDevelop.Gui
@@ -110,10 +111,10 @@
}
set
{
- if (!HasProject && value != null)
- {
+ if (value != null)
HasProject = true;
- }
+ else
+ HasProject = false;
project = value;
}
}
@@ -122,18 +123,11 @@
{
get
{
- return pathrelativetoproject;
- }
- set
- {
- if (value != null && value != "")
- {
- if (!HasProject)
- {
- HasProject = true;
- }
+ if (HasProject) {
+ FileUtilityService fus = (FileUtilityService)ServiceManager.GetService (typeof (FileUtilityService));
+ return fus.AbsoluteToRelativePath (project.BaseDirectory, ContentName).Substring (2);
}
- pathrelativetoproject = value;
+ return null;
}
}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/DirtyFilesDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/DirtyFilesDialog.cs 2004-06-25 20:19:20 UTC (rev 1825)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/DirtyFilesDialog.cs 2004-06-25 20:38:49 UTC (rev 1826)
@@ -1,184 +1,189 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-/* TODO : Dirty Files dialog
-* see DefaultWorkbench.cs OnClosing method
using System;
-using System.Drawing;
-using System.Windows.Forms;
+using System.Collections;
+
+using Gtk;
+
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
using MonoDevelop.Core.Properties;
+using MonoDevelop.Gui;
-using MonoDevelop.Core.Gui;
-
namespace MonoDevelop.Gui.Dialogs
{
- public class DirtyFilesDialog : System.Windows.Forms.Form
+ public class DirtyFilesDialog : Gtk.Dialog
{
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.ListView listView1;
- private System.Windows.Forms.Button savebutton;
- private System.Windows.Forms.Button saveallbutton;
- private System.Windows.Forms.Button discardallbutton;
- private System.Windows.Forms.Button cancelbutton;
-
- public DirtyFilesDialog()
+
+ Button btnSaveAndQuit;
+ Button btnQuit;
+ Button btnCancel;
+ TreeView tvFiles;
+ TreeStore tsFiles;
+
+ public DirtyFilesDialog() : base (GettextCatalog.GetString ("Save Files"), (Gtk.Window)WorkbenchSingleton.Workbench, DialogFlags.Modal)
{
- InitializeComponent();
+ tsFiles = new TreeStore (typeof (string), typeof (bool), typeof (SdiWorkspaceWindow), typeof (bool));
+ tvFiles = new TreeView (tsFiles);
+ IProjectService projectService = (IProjectService) ServiceManager.GetService (typeof (IProjectService));
+ TreeIter topCombineIter = TreeIter.Zero;
+ Hashtable projectIters = new Hashtable ();
+ if (projectService.CurrentOpenCombine != null) {
+ topCombineIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Solution: {0}"), projectService.CurrentOpenCombine.Name), true, null, false);
+ }
+ foreach (IViewContent viewcontent in WorkbenchSingleton.Workbench.ViewContentCollection) {
+ if (!viewcontent.IsDirty)
+ continue;
+
+ if (viewcontent.HasProject) {
+ TreeIter projIter = TreeIter.Zero;
+ if (projectIters.ContainsKey (viewcontent.Project))
+ projIter = (TreeIter) projectIters[viewcontent.Project];
+ else {
+ if (topCombineIter.Equals (TreeIter.Zero))
+ projIter = tsFiles.AppendValues (String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
+ else
+ projIter = tsFiles.AppendValues (topCombineIter, String.Format (GettextCatalog.GetString ("Project: {0}"), viewcontent.Project.Name), true, null, false);
+ projectIters[viewcontent.Project] = projIter;
+ }
+ tsFiles.AppendValues (projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
+ } else {
+ if (viewcontent.ContentName == null) {
+ viewcontent.ContentName = System.IO.Path.Combine (Environment.GetEnvironmentVariable ("HOME"), viewcontent.UntitledName);
+ }
+ tsFiles.AppendValues (viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
+ }
+ }
+ if (!topCombineIter.Equals (TreeIter.Zero)) {
+ if (!tsFiles.IterHasChild (topCombineIter))
+ tsFiles.Remove (ref topCombineIter);
+ }
+
+ TreeViewColumn mainColumn = new TreeViewColumn ();
+ mainColumn.Title = "header";
- listView1.Columns.Add(resourceService.GetString("Dialog.DirtyFiles.Files"), listView1.Width - 5, HorizontalAlignment.Left);
+ CellRendererToggle togRender = new CellRendererToggle ();
+ togRender.Toggled += new ToggledHandler (toggled);
+ mainColumn.PackStart (togRender, false);
+ mainColumn.AddAttribute (togRender, "active", 1);
+ mainColumn.AddAttribute (togRender, "inconsistent", 3);
- listView1.SmallImageList = FileUtility.ImageList;
+ CellRendererText textRender = new CellRendererText ();
+ mainColumn.PackStart (textRender, true);
+ mainColumn.AddAttribute (textRender, "text", 0);
+
+ tvFiles.AppendColumn (mainColumn);
+ tvFiles.HeadersVisible = false;
+ tvFiles.ExpandAll ();
+
+ ScrolledWindow sc = new ScrolledWindow ();
+ sc.Add (tvFiles);
+ sc.ShadowType = ShadowType.In;
+
+ this.VBox.BorderWidth = 12;
+ sc.BorderWidth = 12;
+ this.VBox.PackStart (sc);
- foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
- if (content.IsDirty && content.ContentName != null) {
- ListViewItem item = new ListViewItem(content.ContentName, FileUtility.GetImageIndexFor(content.ContentName));
- item.Selected = true;
- listView1.Items.Add(item);
- }
- }
+ btnSaveAndQuit = new Button (GettextCatalog.GetString ("_Save and Quit"));
+ btnQuit = new Button (Gtk.Stock.Quit);
+ btnCancel = new Button (Gtk.Stock.Cancel);
+
+ btnSaveAndQuit.Clicked += new EventHandler (SaveAndQuit);
+ btnQuit.Clicked += new EventHandler (Quit);
+ btnCancel.Clicked += new EventHandler (Cancel);
+
+ this.ActionArea.PackStart (btnCancel);
+ this.ActionArea.PackStart (btnQuit);
+ this.ActionArea.PackStart (btnSaveAndQuit);
+ this.SetDefaultSize (300, 200);
+ this.ShowAll ();
}
-
- void DiscardAll(object sender, EventArgs e)
+
+ ArrayList arrSaveWorkbenches = new ArrayList ();
+ void SaveAndQuit (object o, EventArgs e)
{
- DialogResult = DialogResult.OK;
+ tsFiles.Foreach (new TreeModelForeachFunc (CollectWorkbenches));
+ FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
+ foreach (SdiWorkspaceWindow window in arrSaveWorkbenches) {
+ fileUtilityService.ObservedSave(new FileOperationDelegate(window.ViewContent.Save), window.ViewContent.ContentName , FileErrorPolicy.ProvideAlternative);
+ }
+
+ Respond (Gtk.ResponseType.Ok);
+ Hide ();
}
-
- void SaveAll(object sender, EventArgs e)
+
+ bool CollectWorkbenches (TreeModel model, TreePath path, TreeIter iter)
{
- foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
- if (content.IsDirty && content.ContentName != null) {
- content.SaveFile();
- }
+ if ((bool)tsFiles.GetValue (iter, 1)) {
+ if (tsFiles.GetValue (iter, 2) != null)
+ arrSaveWorkbenches.Add (tsFiles.GetValue (iter, 2));
}
- DialogResult = DialogResult.OK;
+
+ return false;
}
-
- void SaveSelected(object sender, EventArgs e)
+
+ void Quit (object o, EventArgs e)
{
- foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
- if (content.IsDirty && content.ContentName != null) {
- foreach (ListViewItem item in listView1.SelectedItems) {
- if (item.Text == content.ContentName) {
- content.SaveFile();
- break;
- }
- }
+ Respond (Gtk.ResponseType.Ok);
+ Hide ();
+ }
+
+ void Cancel (object o, EventArgs e)
+ {
+ Respond (Gtk.ResponseType.Cancel);
+ Hide ();
+ }
+
+ void toggled (object o, ToggledArgs e)
+ {
+ TreeIter iter;
+ tsFiles.GetIterFromString (out iter, e.Path);
+ bool newsetting = !(bool)tsFiles.GetValue (iter, 1);
+ tsFiles.SetValue (iter, 1, newsetting);
+ if (tsFiles.IterHasChild (iter))
+ ToggleChildren (iter, newsetting);
+
+ TreeIter iterFirst;
+ tsFiles.GetIterFirst (out iterFirst);
+ if (tsFiles.IterHasChild (iterFirst))
+ NewCheckStatus (iterFirst);
+ }
+
+ void NewCheckStatus (TreeIter iter)
+ {
+ if (tsFiles.IterHasChild (iter)) {
+ TreeIter childIter;
+ tsFiles.IterNthChild (out childIter, iter, 0);
+ if (tsFiles.IterHasChild (childIter))
+ NewCheckStatus (childIter);
+ bool lastsetting = (bool)tsFiles.GetValue (childIter, 1);
+ bool inconsistant = (bool)tsFiles.GetValue (childIter, 3);
+ bool anytrue, finalsetting;
+ anytrue = finalsetting = lastsetting;
+ while (tsFiles.IterNext (ref childIter)) {
+ if (tsFiles.IterHasChild (childIter))
+ NewCheckStatus (childIter);
+ bool newsetting = (bool)tsFiles.GetValue (childIter, 1);
+ if (newsetting != lastsetting || (bool)tsFiles.GetValue (childIter, 3) == true)
+ inconsistant = true;
+ if (newsetting)
+ anytrue = true;
+ lastsetting = newsetting;
}
+
+ tsFiles.SetValue (iter, 3, inconsistant);
+ tsFiles.SetValue (iter, 1, anytrue);
}
- DialogResult = DialogResult.OK;
}
-
- private void InitializeComponent()
+
+ void ToggleChildren (TreeIter iter, bool setting)
{
- bool flat = Crownwood.Magic.Common.VisualStyle.IDE == (Crownwood.Magic.Common.VisualStyle)propertyService.GetProperty("MonoDevelop.Gui.VisualStyle", Crownwood.Magic.Common.VisualStyle.IDE);
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.listView1 = new System.Windows.Forms.ListView();
- this.savebutton = new System.Windows.Forms.Button();
- this.saveallbutton = new System.Windows.Forms.Button();
- this.discardallbutton = new System.Windows.Forms.Button();
- this.cancelbutton = new System.Windows.Forms.Button();
- this.groupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {this.listView1});
- this.groupBox1.Location = new System.Drawing.Point(8, 8);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(312, 272);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = resourceService.GetString("Dialog.DirtyFiles.DirtyFiles");
-
- //
- // listView1
- //
- this.listView1.HideSelection = false;
- this.listView1.FullRowSelect = true;
- this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
- this.listView1.Location = new System.Drawing.Point(8, 16);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(296, 248);
- this.listView1.TabIndex = 0;
- this.listView1.View = System.Windows.Forms.View.Details;
- listView1.BorderStyle = flat ? BorderStyle.FixedSingle : BorderStyle.Fixed3D;
-
- //
- // savebutton
- //
- this.savebutton.Location = new System.Drawing.Point(328, 16);
- this.savebutton.Name = "savebutton";
- this.savebutton.TabIndex = 1;
- this.savebutton.Size = new System.Drawing.Size(96, 24);
- this.savebutton.Text = resourceService.GetString("Dialog.DirtyFiles.SaveButton");
-
- this.savebutton.Click += new EventHandler(SaveSelected);
- savebutton.FlatStyle = flat ? FlatStyle.Flat : FlatStyle.Standard;
-
- //
- // saveallbutton
- //
- this.saveallbutton.Location = new System.Drawing.Point(328, 48);
- this.saveallbutton.Name = "saveallbutton";
- this.saveallbutton.TabIndex = 2;
- this.saveallbutton.Size = new System.Drawing.Size(96, 24);
- this.saveallbutton.Text = resourceService.GetString("Dialog.DirtyFiles.SaveAllButton");
-
- this.saveallbutton.Click += new EventHandler(SaveAll);
- saveallbutton.FlatStyle = flat ? FlatStyle.Flat : FlatStyle.Standard;
-
- //
- // discardallbutton
- //
- this.discardallbutton.Location = new System.Drawing.Point(328, 80);
- this.discardallbutton.Name = "discardallbutton";
- this.discardallbutton.TabIndex = 3;
- this.discardallbutton.Size = new System.Drawing.Size(96, 24);
- this.discardallbutton.Text = resourceService.GetString("Dialog.DirtyFiles.DiscardAllButton");
-
- this.discardallbutton.Click += new EventHandler(DiscardAll);
- discardallbutton.FlatStyle = flat ? FlatStyle.Flat : FlatStyle.Standard;
-
- //
- // cancelbutton
- //
- this.cancelbutton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.cancelbutton.Location = new System.Drawing.Point(328, 112);
- this.cancelbutton.Name = "cancelbutton";
- this.cancelbutton.TabIndex = 4;
- this.cancelbutton.Size = new System.Drawing.Size(96, 24);
- this.cancelbutton.Text = resourceService.GetString("Global.CancelButtonText");
- cancelbutton.FlatStyle = flat ? FlatStyle.Flat : FlatStyle.Standard;
-
- //
- // Win32Form1
- //
- this.AcceptButton = this.savebutton;
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.CancelButton = this.cancelbutton;
- this.ClientSize = new System.Drawing.Size(430, 290);
- this.Controls.AddRange(new System.Windows.Forms.Control[] {this.cancelbutton,
- this.discardallbutton,
- this.saveallbutton,
- this.savebutton,
- this.groupBox1});
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
-
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = resourceService.GetString("Dialog.DirtyFiles.DialogName");
-
- this.TopMost = true;
- this.groupBox1.ResumeLayout(false);
- this.ResumeLayout(false);
+ TreeIter newIter;
+ tsFiles.IterNthChild (out newIter, iter, 0);
+ do {
+ tsFiles.SetValue (newIter, 1, setting);
+ if (tsFiles.IterHasChild (newIter))
+ ToggleChildren (newIter, setting);
+ }
+ while (tsFiles.IterNext (ref newIter));
}
}
}
-*/
-
-
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs 2004-06-25 20:19:20 UTC (rev 1825)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs 2004-06-25 20:38:49 UTC (rev 1826)
@@ -75,8 +75,8 @@
} else {
store.SetValue (iter, 3, false);
selectDialog.RemoveReference (ReferenceType.Gac,
- (string)store.GetValue (iter, 0),
- (string)store.GetValue (iter, 4));
+ (string)store.GetValue (iter, 0),
+ (string)store.GetValue (iter, 4));
}
}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/IViewContent.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/IViewContent.cs 2004-06-25 20:19:20 UTC (rev 1825)
+++ trunk/MonoDevelop/src/Main/Base/Gui/IViewContent.cs 2004-06-25 20:38:49 UTC (rev 1826)
@@ -105,7 +105,6 @@
/// </summary>
string PathRelativeToProject {
get;
- set;
}
/// <summary>
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs 2004-06-25 20:19:20 UTC (rev 1825)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs 2004-06-25 20:38:49 UTC (rev 1826)
@@ -20,6 +20,7 @@
using MonoDevelop.Core.Services;
using MonoDevelop.Gui.Components;
+using MonoDevelop.Gui.Dialogs;
using MonoDevelop.Services;
@@ -258,45 +259,6 @@
CreateMainMenu();
}
- // public void OpenCombine(string filename)
- // {
- // Debug.Assert(projectManager != null);
- // projectManager.ClearCombine();
- // CloseAllFiles();
- // projectManager.OpenCombine(filename);
- // UpdateMenu(null, null);
- // }
- //
- // public void SaveCombine()
- // {
- // Debug.Assert(projectManager != null);
- // projectManager.SaveCombine();
- // }
- //
- // public void ClearCombine()
- // {
- // Debug.Assert(projectManager != null);
- // projectManager.ClearCombine();
- // }
- //
- // public void MarkFileDirty(string filename)
- // {
- // Debug.Assert(projectManager != null);
- // projectManager.MarkFileDirty(filename);
- // }
- //
- // public void OpenFile(string fileName)
- // {
- // Debug.Assert(fileManager != null);
- // fileManager.OpenFile(fileName);
- // }
- //
- // public void NewFile(string defaultName, string language, string content)
- // {
- // Debug.Assert(fileManager != null);
- // fileManager.NewFile(defaultName, language, content);
- // }
-
public void CloseContent(IViewContent content)
{
if (propertyService.GetProperty("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) {
@@ -314,7 +276,7 @@
ViewContentCollection fullList = new ViewContentCollection(workbenchContentCollection);
foreach (IViewContent content in fullList) {
IWorkbenchWindow window = content.WorkbenchWindow;
- window.CloseWindow(false, true, 0);
+ window.CloseWindow(true, true, 0);
}
} finally {
closeAll = false;
@@ -509,22 +471,9 @@
}
}
-// protected void OnTopMenuSelected(MenuCommand mc)
-// {
-// IStatusBarService statusBarService = (IStatusBarService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IStatusBarService));
-//
-// statusBarService.SetMessage(mc.Description);
-// }
-//
-// protected void OnTopMenuDeselected(MenuCommand mc)
-// {
-// SetStandardStatusBar(null, null);
-// }
-
protected /*override*/ void OnClosing(object o, Gtk.DeleteEventArgs e)
{
if (Close()) {
- // propertyService.SetProperty("SharpDevelop.Workbench.WorkbenchMemento", WorkbenchSingleton.Workbench.CreateMemento());
Gtk.Application.Quit ();
} else {
e.RetVal = true;
@@ -542,30 +491,26 @@
public bool Close()
{
IProjectService projectService = (IProjectService)MonoDevelop.Core.Services.ServiceManager.GetService(typeof(IProjectService));
-
- if (projectService != null)
+ projectService.SaveCombinePreferences ();
+
+ bool showDirtyDialog = false;
+
+ foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection)
{
- projectService.SaveCombinePreferences();
- while (WorkbenchSingleton.Workbench.ViewContentCollection.Count > 0)
- {
- IViewContent content = WorkbenchSingleton.Workbench.ViewContentCollection[0];
- content.WorkbenchWindow.CloseWindow(false, true, 0);
- if (WorkbenchSingleton.Workbench.ViewContentCollection.Contains(content))
- {
- return false;
- }
+ if (content.IsDirty) {
+ showDirtyDialog = true;
+ break;
}
- projectService.CloseCombine(false);
}
+
+ if (showDirtyDialog) {
+ DirtyFilesDialog dlg = new DirtyFilesDialog ();
+ int response = dlg.Run ();
+ if (response != (int)Gtk.ResponseType.Ok)
+ return false;
+ }
- // TODO : Dirty Files Dialog
- // foreach (IViewContent content in ViewContentCollection) {
- // if (content.IsDirty) {
- // MonoDevelop.Gui.Dialogs.DirtyFilesDialog dfd = new MonoDevelop.Gui.Dialogs.DirtyFilesDialog();
- // e.Cancel = dfd.ShowDialog() == DialogResult.Cancel;
- // return;
- // }
- // }
+ projectService.CloseCombine (false);
propertyService.SetProperty("SharpDevelop.Workbench.WorkbenchMemento", WorkbenchSingleton.Workbench.CreateMemento());
OnClosed (null);
return true;
Modified: trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs 2004-06-25 20:19:20 UTC (rev 1825)
+++ trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs 2004-06-25 20:38:49 UTC (rev 1826)
@@ -52,28 +52,25 @@
{
IDisplayBinding binding;
IProject project;
- string pathrelativetoproject;
public LoadFileWrapper(IDisplayBinding binding)
{
this.binding = binding;
}
- public LoadFileWrapper(IDisplayBinding binding, IProject project, string pathrelativetoproject)
+ public LoadFileWrapper(IDisplayBinding binding, IProject project)
{
this.binding = binding;
this.project = project;
- this.pathrelativetoproject = pathrelativetoproject;
}
public void Invoke(string fileName)
{
IViewContent newContent = binding.CreateContentForFile(fileName);
- if (project != null && pathrelativetoproject != null && pathrelativetoproject != "")
+ if (project != null)
{
newContent.HasProject = true;
newContent.Project = project;
- newContent.PathRelativeToProject = pathrelativetoproject;
}
WorkbenchSingleton.Workbench.ShowView(newContent);
DisplayBindingService displayBindingService = (DisplayBindingService)MonoDevelop.Core.Services.ServiceManager.GetService(typeof(DisplayBindingService));
@@ -131,17 +128,16 @@
IProject project = null;
Combine combine = null;
GetProjectAndCombineFromFile (fileName, out project, out combine);
- string pathrelativetoproject = GetRelativePath (project, fileName);
if (combine != null && project != null)
{
- if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, project, pathrelativetoproject).Invoke), fileName) == FileOperationResult.OK) {
+ if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, project).Invoke), fileName) == FileOperationResult.OK) {
fileService.RecentOpen.AddLastFile(fileName);
}
}
else
{
- if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, null, null).Invoke), fileName) == FileOperationResult.OK) {
+ if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, null).Invoke), fileName) == FileOperationResult.OK) {
fileService.RecentOpen.AddLastFile(fileName);
}
}
@@ -155,7 +151,7 @@
Gnome.Url.Show ("file://" + fileName);
}
} catch {
- if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate (new LoadFileWrapper (displayBindingService.LastBinding, null, null).Invoke), fileName) == FileOperationResult.OK) {
+ if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate (new LoadFileWrapper (displayBindingService.LastBinding, null).Invoke), fileName) == FileOperationResult.OK) {
fileService.RecentOpen.AddLastFile (fileName);
}
}
@@ -182,27 +178,6 @@
}
}
- protected string GetRelativePath (IProject project, string fileName)
- {
- string relativepath;
-
- if (project != null && fileName.IndexOf (project.BaseDirectory) == 0)
- {
- relativepath = fileName.Substring (project.BaseDirectory.Length);
-
- if (relativepath.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
- {
- relativepath = relativepath.Substring (1);
- }
- }
- else
- {
- relativepath = System.IO.Path.GetFileName (fileName);
- }
-
- return relativepath;
- }
-
public void NewFile(string defaultName, string language, string content)
{
DisplayBindingService displayBindingService = (DisplayBindingService)MonoDevelop.Core.Services.ServiceManager.GetService(typeof(DisplayBindingService));
More information about the Monodevelop-patches-list
mailing list