[Monodevelop-patches-list] r1000 - in trunk/MonoDevelop/src/Main/Base: Commands Gui/Dialogs/OptionPanels/IDEOptions

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Mon Feb 23 06:54:14 EST 2004


Author: jba
Date: 2004-02-23 06:54:14 -0500 (Mon, 23 Feb 2004)
New Revision: 1000

Modified:
   trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/LoadSavePanel.cs
Log:
fixed save backup and other Load/Save Panel options

Modified: trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs	2004-02-23 10:34:10 UTC (rev 999)
+++ trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs	2004-02-23 11:54:14 UTC (rev 1000)
@@ -63,13 +63,15 @@
 
 	public class SaveFile : AbstractMenuCommand
 	{
+		static PropertyService PropertyService = (PropertyService)ServiceManager.Services.GetService (typeof (PropertyService));
+		
 		public override void Run()
 		{
 			IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
 			if (window != null) {
 				if (window.ViewContent.IsViewOnly) {
 					return;
-}
+				}
 				
 				if (window.ViewContent.ContentName == null) {
 					SaveFileAs sfa = new SaveFileAs();
@@ -79,11 +81,17 @@
 					if ((File.GetAttributes(window.ViewContent.ContentName) & attr) != 0) {
 						SaveFileAs sfa = new SaveFileAs();
 						sfa.Run();
-					} else {
+					} else {						
 						IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
 						FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
 						projectService.MarkFileDirty(window.ViewContent.ContentName);
-						fileUtilityService.ObservedSave(new FileOperationDelegate(window.ViewContent.Save), window.ViewContent.ContentName);
+						string fileName = window.ViewContent.ContentName;
+						// save backup first
+						System.Console.WriteLine(fileName);
+						if((bool) PropertyService.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
+							fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), fileName + "~");
+						}
+						fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), fileName);
 					}
 				}
 			}
@@ -114,6 +122,8 @@
 	
 	public class SaveFileAs : AbstractMenuCommand
 	{
+		static PropertyService PropertyService = (PropertyService)ServiceManager.Services.GetService (typeof (PropertyService));
+		
 		public override void Run()
 		{
 			IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
@@ -156,8 +166,14 @@
 							return;
 						}
 						
+						// save backup first
+						if((bool) PropertyService.GetProperty ("SharpDevelop.CreateBackupCopy", false)) {
+							fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), filename + "~");
+						}
+						
+						// do actual save
 						if (fileUtilityService.ObservedSave(new NamedFileOperationDelegate(window.ViewContent.Save), filename) == FileOperationResult.OK) {
-							fileService.RecentOpen.AddLastFile(filename);
+							fileService.RecentOpen.AddLastFile(filename);							
 							IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
 							messageService.ShowMessage(filename, "File saved");
 						}

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/LoadSavePanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/LoadSavePanel.cs	2004-02-23 10:34:10 UTC (rev 999)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/LoadSavePanel.cs	2004-02-23 11:54:14 UTC (rev 1000)
@@ -89,8 +89,13 @@
 					 PropertyService.GetProperty ("SharpDevelop.LineTerminatorStyle", LineTerminatorStyle.Unix))) {
 				widget.unixRadioButton.Active = true;}
 			// Finish here
+			
+			// FIXME: renable all terminatore style radio buttons when they're implemented
+			widget.unixRadioButton.Sensitive = false;
+			widget.macintoshRadioButton.Sensitive = false;
+			widget.windowsRadioButton.Sensitive = false;
+			widget.terminator.Sensitive = false;
 
-
 		}
 		
 		public override bool StorePanelContents()




More information about the Monodevelop-patches-list mailing list