[Monodevelop-patches-list] r2156 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Commands Gui Search Search/DocumentIterator
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 24 18:37:44 EST 2005
Author: lluis
Date: 2005-01-24 18:37:44 -0500 (Mon, 24 Jan 2005)
New Revision: 2156
Removed:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/Pads/
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/AllOpenDocumentIterator.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
Log:
2005-01-25 Lluis Sanchez Gual <lluis at novell.com>
* Gui/Pads/CompilerMessageView.cs:
* Makefile.am: CompilerMessageView moved to Monodevelop.Base.
* Commands/SearchCommands.cs:
* Search/SearchReplaceManager.cs:
* Search/DocumentIterator/CurrentDocumentIterator.cs:
* Search/DocumentIterator/WholeProjectDocumentIterator.cs:
* Search/DocumentIterator/AllOpenDocumentIterator.cs:
* Gui/SourceEditorDisplayBinding.cs: New GUI for warning about modified
files.
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-24 23:37:44 UTC (rev 2156)
@@ -1,3 +1,16 @@
+2005-01-25 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Gui/Pads/CompilerMessageView.cs:
+ * Makefile.am: CompilerMessageView moved to Monodevelop.Base.
+
+ * Commands/SearchCommands.cs:
+ * Search/SearchReplaceManager.cs:
+ * Search/DocumentIterator/CurrentDocumentIterator.cs:
+ * Search/DocumentIterator/WholeProjectDocumentIterator.cs:
+ * Search/DocumentIterator/AllOpenDocumentIterator.cs:
+ * Gui/SourceEditorDisplayBinding.cs: New GUI for warning about modified
+ files.
+
2005-01-11 Lluis Sanchez Gual <lluis at novell.com>
* Gui/SourceEditorDisplayBinding.cs: Use a different method for detecting
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Commands/SearchCommands.cs 2005-01-24 23:37:44 UTC (rev 2156)
@@ -56,7 +56,7 @@
if (window != null && window.ViewContent is SourceEditorDisplayBindingWrapper)
{
- SourceEditor_ editor = (SourceEditor_) ((SourceEditorDisplayBindingWrapper)window.ViewContent).Control;
+ SourceEditor_ editor = ((SourceEditorDisplayBindingWrapper)window.ViewContent).Editor;
string selectedText = editor.Buffer.GetSelectedText ();
if (selectedText != null && selectedText.Length > 0)
@@ -120,7 +120,7 @@
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
if (window != null && window.ViewContent is SourceEditorDisplayBindingWrapper)
{
- SourceEditor_ editor = (SourceEditor_) ((SourceEditorDisplayBindingWrapper)window.ViewContent).Control;
+ SourceEditor_ editor = ((SourceEditorDisplayBindingWrapper)window.ViewContent).Editor;
string selectedText = editor.Buffer.GetSelectedText ();
if (selectedText != null && selectedText.Length > 0)
SearchReplaceInFilesManager.SearchOptions.SearchPattern = selectedText.Split ('\n')[0];
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-01-24 23:37:44 UTC (rev 2156)
@@ -95,13 +95,16 @@
public class SourceEditorDisplayBindingWrapper : AbstractViewContent,
IEditable, IPositionable, IBookmarkOperations, IDebuggableEditor, ICodeStyleOperations
{
-
+ VBox mainBox;
+ HBox editorBar;
+ HBox reloadBar;
internal FileSystemWatcher fsw;
internal SourceEditor se;
object fileSaveLock = new object ();
DateTime lastSaveTime;
+ bool warnOverwrite = false;
void UpdateFSW (object o, EventArgs e)
{
@@ -130,13 +133,7 @@
{
FileSystemEventArgs e = (FileSystemEventArgs)evnt;
if (e.ChangeType == WatcherChangeTypes.Changed) {
- //To prevent more than one being shown at a
- //time, check if this is not null.
- if (ReloadFileDialog != null)
- return;
- ReloadFileDialog = 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));
- ReloadFileDialog.Response += new Gtk.ResponseHandler (Responded);
- ReloadFileDialog.ShowAll ();
+ ShowFileChangedWarning ();
}
}
@@ -162,6 +159,12 @@
public override Gtk.Widget Control {
get {
+ return mainBox;
+ }
+ }
+
+ public SourceEditor Editor {
+ get {
return se;
}
}
@@ -174,6 +177,9 @@
public SourceEditorDisplayBindingWrapper ()
{
+ mainBox = new VBox ();
+ editorBar = new HBox ();
+ mainBox.PackStart (editorBar, false, false, 0);
se = new SourceEditor (this);
se.Buffer.ModifiedChanged += new EventHandler (OnModifiedChanged);
se.Buffer.MarkSet += new MarkSetHandler (OnMarkSet);
@@ -190,6 +196,7 @@
fsw = new FileSystemWatcher ();
fsw.Changed += new FileSystemEventHandler (OnFileChanged);
UpdateFSW (null, null);
+ mainBox.PackStart (se, true, true, 0);
}
public void JumpTo (int line, int column)
@@ -247,6 +254,15 @@
public override void Save (string fileName)
{
+ if (warnOverwrite) {
+ if (fileName == ContentName) {
+ if (!Runtime.MessageService.AskQuestion (string.Format (GettextCatalog.GetString ("The file {0} has been changed outside of MonoDevelop. Are you sure you want to overwrite the file?"), fileName),"MonoDevelop"))
+ return;
+ }
+ warnOverwrite = false;
+ editorBar.Remove (reloadBar);
+ }
+
lock (fileSaveLock) {
se.Buffer.Save (fileName);
lastSaveTime = File.GetLastWriteTime (fileName);
@@ -257,11 +273,52 @@
public override void Load (string fileName)
{
+ if (warnOverwrite) {
+ warnOverwrite = false;
+ editorBar.Remove (reloadBar);
+ }
se.Buffer.LoadFile (fileName, Vfs.GetMimeType (fileName));
ContentName = fileName;
InitializeFormatter ();
}
+ void ShowFileChangedWarning ()
+ {
+ if (reloadBar == null) {
+ reloadBar = new HBox ();
+ reloadBar.BorderWidth = 3;
+ Gtk.Image img = Runtime.Gui.Resources.GetImage ("Icons.32x32.Warning", IconSize.Menu);
+ reloadBar.PackStart (img, false, false, 2);
+ reloadBar.PackStart (new Gtk.Label (GettextCatalog.GetString ("This file has been changed outside of MonoDevelop")), false, false, 5);
+ HBox box = new HBox ();
+ reloadBar.PackStart (box, true, true, 10);
+
+ Button b1 = new Button ("Reload");
+ box.PackStart (b1, false, false, 5);
+ b1.Clicked += new EventHandler (ClickedReload);
+
+ Button b2 = new Button ("Ignore");
+ box.PackStart (b2, false, false, 5);
+ b2.Clicked += new EventHandler (ClickedIgnore);
+
+ reloadBar.ShowAll ();
+ }
+ warnOverwrite = true;
+ editorBar.PackStart (reloadBar);
+ reloadBar.ShowAll ();
+ }
+
+ void ClickedReload (object sender, EventArgs args)
+ {
+ editorBar.Remove (reloadBar);
+ Load (ContentName);
+ }
+
+ void ClickedIgnore (object sender, EventArgs args)
+ {
+ editorBar.Remove (reloadBar);
+ }
+
public void InitializeFormatter()
{
/*IFormattingStrategy[] formater = (IFormattingStrategy[])(AddInTreeSingleton.AddInTree.GetTreeNode("/AddIns/DefaultTextEditor/Formater").BuildChildItems(this)).ToArray(typeof(IFormattingStrategy));
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Makefile.am 2005-01-24 23:37:44 UTC (rev 2156)
@@ -17,7 +17,6 @@
Gui/SourceEditorBuffer.cs \
Gui/SourceEditorView.cs \
Gui/SourceEditorDisplayBinding.cs \
-Gui/Pads/CompilerMessageView.cs \
Gui/OptionPanels/BehaviorTextEditorPanel.cs \
Gui/OptionPanels/MarkersTextEditorPanel.cs \
Gui/OptionPanels/CodeTemplatePanel.cs \
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/AllOpenDocumentIterator.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/AllOpenDocumentIterator.cs 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/AllOpenDocumentIterator.cs 2005-01-24 23:37:44 UTC (rev 2156)
@@ -45,9 +45,8 @@
if (!SearchReplaceUtilities.IsTextAreaSelected) {
return null;
}
- SourceEditor_ document = (SourceEditor_) (((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control);
- return new EditorDocumentInformation(document,
- CurrentFileName);
+ SourceEditor_ document = ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Editor;
+ return new EditorDocumentInformation(document, CurrentFileName);
}
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/CurrentDocumentIterator.cs 2005-01-24 23:37:44 UTC (rev 2156)
@@ -43,7 +43,7 @@
if (!SearchReplaceUtilities.IsTextAreaSelected) {
return null;
}
- curDocument = ((SourceEditor_) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control);
+ curDocument = ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Editor;
return new EditorDocumentInformation(curDocument, CurrentFileName);
}
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/DocumentIterator/WholeProjectDocumentIterator.cs 2005-01-24 23:37:44 UTC (rev 2156)
@@ -55,7 +55,7 @@
// WINDOWS DEPENDENCY : ToUpper
if (content.ContentName != null &&
content.ContentName.ToUpper() == fileName.ToUpper()) {
- document = (SourceEditor_) (((SourceEditorDisplayBindingWrapper)content).Control);
+ document = ((SourceEditorDisplayBindingWrapper)content).Editor;
return new EditorDocumentInformation(document, fileName);
}
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs 2005-01-24 23:30:17 UTC (rev 2155)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Search/SearchReplaceManager.cs 2005-01-24 23:37:44 UTC (rev 2156)
@@ -73,7 +73,7 @@
public static void Replace()
{
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- SourceEditor_ textarea = (SourceEditor_) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control;
+ SourceEditor_ textarea = ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Editor;
string text = textarea.Buffer.GetSelectedText ();
if (text.ToLower () == SearchOptions.SearchPattern.ToLower ()) {
int offset = textarea.Buffer.GetLowerSelectionBounds ();
@@ -92,7 +92,7 @@
{
SourceEditor_ textArea = null;
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- textArea = (SourceEditor_) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control;
+ textArea = ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Editor;
textArea.Buffer.PlaceCursor (textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark));
}
find.Reset();
@@ -124,7 +124,7 @@
{
SourceEditor_ textArea = null;
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
- textArea = (SourceEditor_) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control;
+ textArea = ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Editor;
textArea.Buffer.PlaceCursor (textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark));
}
find.Reset();
@@ -200,7 +200,7 @@
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
- return (SourceEditor_) ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Control;
+ return ((SourceEditorDisplayBindingWrapper)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent).Editor;
}
}
}
More information about the Monodevelop-patches-list
mailing list