[Monodevelop-patches-list] r1854 - in trunk/MonoDevelop/Core/src: AddIns/DisplayBindings/SourceEditor AddIns/DisplayBindings/SourceEditor/Gui Main/Base Main/Base/Gui Main/Base/Gui/Workbench/Layouts
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jun 28 15:01:36 EDT 2004
Author: tberman
Date: 2004-06-28 15:01:36 -0400 (Mon, 28 Jun 2004)
New Revision: 1854
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/Core/src/Main/Base/ChangeLog
trunk/MonoDevelop/Core/src/Main/Base/Gui/AbstractViewContent.cs
trunk/MonoDevelop/Core/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
Log:
committing on the trunk
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2004-06-28 18:59:40 UTC (rev 1853)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2004-06-28 19:01:36 UTC (rev 1854)
@@ -1,3 +1,8 @@
+2004-06-28 Todd Berman <tberman at off.net>
+
+ * Gui/SourceEditorDisplayBinding.cs: Add a FSW to monitor for external
+ changes to a loaded file.
+
2004-06-26 Lluis Sanchez Gual <lluis at ximian.com>
* Search/SearchReplaceManager.cs: Make sure the search starts at the current
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-06-28 18:59:40 UTC (rev 1853)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-06-28 19:01:36 UTC (rev 1854)
@@ -91,8 +91,45 @@
public class SourceEditorDisplayBindingWrapper : AbstractViewContent,
IEditable, IPositionable, IBookmarkOperations, IDebuggableEditor
{
+
+ internal FileSystemWatcher fsw;
+
internal SourceEditor se;
-
+
+ void UpdateFSW (object o, EventArgs e)
+ {
+ if (ContentName == null || ContentName.Length == 0)
+ return;
+
+ fsw.EnableRaisingEvents = false;
+ fsw.Path = Path.GetDirectoryName (ContentName);
+ fsw.Filter = Path.GetFileName (ContentName);
+ fsw.EnableRaisingEvents = true;
+ }
+
+ private void OnFileChanged (object o, FileSystemEventArgs e)
+ {
+ DispatchService dispatcher = (DispatchService)ServiceManager.GetService (typeof (DispatchService));
+ dispatcher.GuiDispatch (new StatefulMessageHandler (realFileChanged), e);
+ }
+
+ void realFileChanged (object evnt)
+ {
+ FileSystemEventArgs e = (FileSystemEventArgs)evnt;
+ if (e.ChangeType == WatcherChangeTypes.Changed) {
+ MessageDialog msg = new MessageDialog ((Gtk.Window)WorkbenchSingleton.Workbench, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, String.Format (GettextCatalog.GetString ("The file {0} has been changed outside of MonoDevelop. Would you like to reload the file?"), ContentName));
+ msg.Response += new Gtk.ResponseHandler (Responded);
+ msg.ShowAll ();
+ }
+ }
+
+ void Responded (object o, ResponseArgs e)
+ {
+ if (e.ResponseId == ResponseType.Yes)
+ Load (ContentName);
+ ((Gtk.Window)o).Hide ();
+ }
+
public void ExecutingAt (int line)
{
se.ExecutingAt (line);
@@ -122,6 +159,7 @@
se.Buffer.MarkSet += new MarkSetHandler (OnMarkSet);
se.Buffer.Changed += new EventHandler (OnChanged);
se.View.ToggleOverwrite += new EventHandler (CaretModeChanged);
+ ContentNameChanged += new EventHandler (UpdateFSW);
CaretModeChanged (null, null);
PropertiesChanged (null, null);
@@ -129,8 +167,11 @@
PropertyService propertyService = (PropertyService) ServiceManager.GetService (typeof (PropertyService));
IProperties properties2 = ((IProperties) propertyService.GetProperty("MonoDevelop.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new DefaultProperties()));
properties2.PropertyChanged += new PropertyEventHandler (PropertiesChanged);
+ fsw = new FileSystemWatcher ();
+ fsw.Changed += new FileSystemEventHandler (OnFileChanged);
+ UpdateFSW (null, null);
}
-
+
public void JumpTo (int line, int column)
{
// NOTE: 0 based!
@@ -169,6 +210,7 @@
public override void Dispose()
{
+ fsw.Dispose ();
}
void OnModifiedChanged (object o, EventArgs e)
Modified: trunk/MonoDevelop/Core/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/Main/Base/ChangeLog 2004-06-28 18:59:40 UTC (rev 1853)
+++ trunk/MonoDevelop/Core/src/Main/Base/ChangeLog 2004-06-28 19:01:36 UTC (rev 1854)
@@ -1,5 +1,12 @@
2004-06-28 Todd Berman <tberman at off.net>
+ * Gui/Workbench/Layouts/SdiWorkspaceWindow.cs: make sure everything is
+ being disposed on close.
+ * Gui/AbstractViewContent.cs: work around small virtual bug, will file
+ this when i can replicate in a smaller test case.
+
+2004-06-28 Todd Berman <tberman at off.net>
+
* Services/Project/DefaultProjectService.cs:
* Services/Project/IProjectService.cs:
* Internal/Project/Project/IProject.cs:
Modified: trunk/MonoDevelop/Core/src/Main/Base/Gui/AbstractViewContent.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Main/Base/Gui/AbstractViewContent.cs 2004-06-28 18:59:40 UTC (rev 1853)
+++ trunk/MonoDevelop/Core/src/Main/Base/Gui/AbstractViewContent.cs 2004-06-28 19:01:36 UTC (rev 1854)
@@ -18,7 +18,6 @@
string untitledName = "";
string contentName = null;
IProject project = null;
- string pathrelativetoproject = null;
bool isDirty = false;
bool isViewOnly = false;
@@ -103,6 +102,10 @@
public abstract void Load(string fileName);
+ public override void Dispose ()
+ {
+ }
+
public IProject Project
{
get
Modified: trunk/MonoDevelop/Core/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2004-06-28 18:59:40 UTC (rev 1853)
+++ trunk/MonoDevelop/Core/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs 2004-06-28 19:01:36 UTC (rev 1854)
@@ -253,6 +253,7 @@
WorkbenchSingleton.Workbench.WorkbenchLayout.RemoveTab (pageNum);
}
OnWindowDeselected(EventArgs.Empty);
+ content.Dispose ();
OnCloseEvent(null);
}
More information about the Monodevelop-patches-list
mailing list