Browse Source

Allow ISmartTextOutput to set the title of the decompilation tab.

pull/1801/head
Siegfried Pammer 6 years ago
parent
commit
004a585efc
  1. 5
      ILSpy/ISmartTextOutput.cs
  2. 2
      ILSpy/TextView/AvalonEditTextOutput.cs
  3. 7
      ILSpy/TextView/DecompilerTextView.cs

5
ILSpy/ISmartTextOutput.cs

@ -38,6 +38,11 @@ namespace ICSharpCode.ILSpy @@ -38,6 +38,11 @@ namespace ICSharpCode.ILSpy
void BeginSpan(HighlightingColor highlightingColor);
void EndSpan();
/// <summary>
/// Gets/sets the title displayed in the document tab's header.
/// </summary>
string Title { get; set; }
}
public static class SmartTextOutputExtensions

2
ILSpy/TextView/AvalonEditTextOutput.cs

@ -81,6 +81,8 @@ namespace ICSharpCode.ILSpy.TextView @@ -81,6 +81,8 @@ namespace ICSharpCode.ILSpy.TextView
bool needsIndent;
public string IndentationString { get; set; } = "\t";
public string Title { get; set; }
internal readonly List<VisualLineElementGenerator> elementGenerators = new List<VisualLineElementGenerator>();

7
ILSpy/TextView/DecompilerTextView.cs

@ -629,6 +629,10 @@ namespace ICSharpCode.ILSpy.TextView @@ -629,6 +629,10 @@ namespace ICSharpCode.ILSpy.TextView
foldingStrategy.UpdateFoldings(foldingManager, textEditor.Document);
Debug.WriteLine(" Updating folding: {0}", w.Elapsed); w.Restart();
}
if (this.DataContext is PaneModel model) {
model.Title = textOutput.Title;
}
}
#endregion
@ -751,6 +755,9 @@ namespace ICSharpCode.ILSpy.TextView @@ -751,6 +755,9 @@ namespace ICSharpCode.ILSpy.TextView
void DecompileNodes(DecompilationContext context, ITextOutput textOutput)
{
var nodes = context.TreeNodes;
if (textOutput is ISmartTextOutput smartTextOutput) {
smartTextOutput.Title = string.Join(", ", nodes.Select(n => n.ToString()));
}
for (int i = 0; i < nodes.Length; i++) {
if (i > 0)
textOutput.WriteLine();

Loading…
Cancel
Save