Branch: refs/heads/master
Home: https://github.com/mono/monodevelop
Compare: https://github.com/mono/monodevelop/compare/2fd64fb86889...bd51d949e3de
Commit: bd51d949e3dee7c973bbd6519bff9095b3aa68eb
Author: Mike Krüger <[email protected]> (mkrueger)
Date: 2013-10-11 04:50:11 GMT
URL: https://github.com/mono/monodevelop/commit/bd51d949e3dee7c973bbd6519bff9095b3aa68eb
Fixed 'Bug 15344 - Converted/ignored files do not update their
line-ending warning' and 'Bug 15342 - Choosing "Convert all files to
UNIX line endings" only converts the current file'
Changed paths:
M main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/FileRegistry.cs
M main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
Modified: main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/FileRegistry.cs
===================================================================
@@ -69,6 +69,7 @@ public static void Add (SourceEditorView sourceEditorView)
public static void Remove (SourceEditorView sourceEditorView)
{
openFiles.Remove (sourceEditorView);
+ UpdateEolMessages ();
}
static bool SkipView (SourceEditorView view)
@@ -214,6 +215,16 @@ public static void IgnoreLineEndingsInAllFiles ()
view.Save ();
}
}
+
+ public static void UpdateEolMessages ()
+ {
+ var multiple = HasMultipleIncorretEolMarkers;
+ foreach (var view in openFiles) {
+ if (SkipView (view) || !view.SourceEditorWidget.HasIncorrectEolMarker)
+ continue;
+ view.SourceEditorWidget.UpdateEolMarkerMessage(multiple);
+ }
+ }
#endregion
}
}
Modified: main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
===================================================================
@@ -46,7 +46,6 @@
using MonoDevelop.SourceEditor.QuickTasks;
using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory.Refactoring;
-using ICSharpCode.NRefactory;
namespace MonoDevelop.SourceEditor
{
@@ -883,6 +882,11 @@ public void ShowFileChangedWarning (bool multiple)
}
}
+ internal void UpdateEolMarkerMessage (bool multiple)
+ {
+ ShowIncorretEolMarkers (Document.FileName, multiple);
+ }
+
internal bool EnsureCorrectEolMarker (string fileName)
{
if (UseIncorrectMarkers)
@@ -891,7 +895,11 @@ internal bool EnsureCorrectEolMarker (string fileName)
if (HasIncorrectEolMarker) {
switch (DefaultSourceEditorOptions.Instance.LineEndingConversion) {
case LineEndingConversion.Ask:
- ShowIncorretEolMarkers (fileName, FileRegistry.HasMultipleIncorretEolMarkers);
+ var hasMultipleIncorretEolMarkers = FileRegistry.HasMultipleIncorretEolMarkers;
+ ShowIncorretEolMarkers (fileName, hasMultipleIncorretEolMarkers);
+ if (hasMultipleIncorretEolMarkers) {
+ FileRegistry.UpdateEolMessages ();
+ }
return false;
case LineEndingConversion.ConvertAlways:
ConvertLineEndings ();
@@ -932,11 +940,12 @@ static string GetEolString (string detectedEol)
return "Unknown";
}
+ OverlayMessageWindow messageOverlayWindow;
void ShowIncorretEolMarkers (string fileName, bool multiple)
{
RemoveMessageBar ();
- var window = new OverlayMessageWindow ();
+ messageOverlayWindow = new OverlayMessageWindow ();
var hbox = new HBox ();
hbox.Spacing = 8;
@@ -953,21 +962,23 @@ void ShowIncorretEolMarkers (string fileName, bool multiple)
okButton.WidthRequest = 60;
hbox.PackEnd (okButton, false, false, 0);
- var combo = new ComboBox(new [] {
- string.Format ("Convert to {0} line endings", GetEolString(textEditor.Options.DefaultEolMarker)),
- string.Format ("Convert all files to {0} line endings", GetEolString(textEditor.Options.DefaultEolMarker)),
- string.Format ("Keep {0} line endings", GetEolString(DetectedEolMarker)),
- string.Format ("Keep {0} line endings in all files", GetEolString(DetectedEolMarker))
- });
+ var list = new List<string> ();
+ list.Add (string.Format ("Convert to {0} line endings", GetEolString (textEditor.Options.DefaultEolMarker)));
+ if (multiple)
+ list.Add (string.Format ("Convert all files to {0} line endings", GetEolString (textEditor.Options.DefaultEolMarker)));
+ list.Add (string.Format ("Keep {0} line endings", GetEolString (DetectedEolMarker)));
+ if (multiple)
+ list.Add (string.Format ("Keep {0} line endings in all files", GetEolString (DetectedEolMarker)));
+ var combo = new ComboBox (list.ToArray ());
combo.Active = 0;
hbox.PackEnd (combo, false, false, 0);
var container = new HBox ();
const int containerPadding = 8;
container.PackStart (hbox, true, true, containerPadding);
- window.Child = container;
- window.ShowOverlay (this.TextEditor);
+ messageOverlayWindow.Child = container;
+ messageOverlayWindow.ShowOverlay (this.TextEditor);
- window.SizeFunc = () => {
+ messageOverlayWindow.SizeFunc = () => {
return okButton.SizeRequest ().Width +
combo.SizeRequest ().Width +
image.SizeRequest ().Width +
@@ -978,27 +989,41 @@ void ShowIncorretEolMarkers (string fileName, bool multiple)
image.Clicked += delegate {
UseIncorrectMarkers = true;
view.WorkbenchWindow.ShowNotification = false;
- window.Destroy ();
+ RemoveMessageBar ();
};
okButton.Clicked += delegate {
- switch (combo.Active) {
- case 0:
- ConvertLineEndings ();
- view.WorkbenchWindow.ShowNotification = false;
- view.Save (fileName, view.SourceEncoding);
- break;
- case 1:
- FileRegistry.ConvertLineEndingsInAllFiles ();
- break;
- case 2:
- UseIncorrectMarkers = true;
- view.WorkbenchWindow.ShowNotification = false;
- break;
- case 3:
- FileRegistry.IgnoreLineEndingsInAllFiles ();
- break;
+ if (multiple) {
+ switch (combo.Active) {
+ case 0:
+ ConvertLineEndings ();
+ view.WorkbenchWindow.ShowNotification = false;
+ view.Save (fileName, view.SourceEncoding);
+ break;
+ case 1:
+ FileRegistry.ConvertLineEndingsInAllFiles ();
+ break;
+ case 2:
+ UseIncorrectMarkers = true;
+ view.WorkbenchWindow.ShowNotification = false;
+ break;
+ case 3:
+ FileRegistry.IgnoreLineEndingsInAllFiles ();
+ break;
+ }
+ } else {
+ switch (combo.Active) {
+ case 0:
+ ConvertLineEndings ();
+ view.WorkbenchWindow.ShowNotification = false;
+ view.Save (fileName, view.SourceEncoding);
+ break;
+ case 1:
+ UseIncorrectMarkers = true;
+ view.WorkbenchWindow.ShowNotification = false;
+ break;
+ }
}
- window.Destroy ();
+ RemoveMessageBar ();
};
}
#endregion
@@ -1073,6 +1098,10 @@ public void RemoveMessageBar ()
}
if (!TextEditor.Visible)
TextEditor.Visible = true;
+ if (messageOverlayWindow != null) {
+ messageOverlayWindow.Destroy ();
+ messageOverlayWindow = null;
+ }
}
public void Reload ()
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.