Browse Source

Disable DecompileInNewViewCommand (will be re-activated when multi-document support is designed)

pull/1725/head
Christoph Wille 6 years ago
parent
commit
282174263b
  1. 8
      ILSpy/Commands/DecompileInNewViewCommand.cs
  2. 4
      ILSpy/MainWindow.xaml.cs

8
ILSpy/Commands/DecompileInNewViewCommand.cs

@ -21,9 +21,9 @@ using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpy.TextView; using ICSharpCode.ILSpy.TextView;
using ICSharpCode.ILSpy.TreeNodes; using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Analyzers namespace ICSharpCode.ILSpy.Commands
{ {
[ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)] // [ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)]
internal sealed class DecompileInNewViewCommand : IContextMenuEntry internal sealed class DecompileInNewViewCommand : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -40,13 +40,13 @@ namespace ICSharpCode.ILSpy.Analyzers
return true; return true;
} }
public void Execute(TextViewContext context) public async void Execute(TextViewContext context)
{ {
var dtv = new DecompilerTextView(); var dtv = new DecompilerTextView();
var nodes = context.SelectedTreeNodes.Cast<ILSpyTreeNode>().ToArray(); var nodes = context.SelectedTreeNodes.Cast<ILSpyTreeNode>().ToArray();
var title = string.Join(", ", nodes.Select(x => x.ToString())); var title = string.Join(", ", nodes.Select(x => x.ToString()));
MainWindow.Instance.ShowInNewPane(title, dtv, PanePosition.Document); MainWindow.Instance.ShowInNewPane(title, dtv, PanePosition.Document);
dtv.Decompile(MainWindow.Instance.CurrentLanguage, nodes, new DecompilationOptions()); await dtv.DecompileAsync(MainWindow.Instance.CurrentLanguage, nodes, new DecompilationOptions());
} }
} }
} }

4
ILSpy/MainWindow.xaml.cs

@ -1047,13 +1047,13 @@ namespace ICSharpCode.ILSpy
{ {
if (panePosition == PanePosition.Document) { if (panePosition == PanePosition.Document) {
var layoutDocument = new LayoutDocument() { Title = title, Content = content, ToolTip = toolTip, CanClose = true }; var layoutDocument = new LayoutDocument() { Title = title, Content = content, ToolTip = toolTip, CanClose = true };
var documentPane = this.DockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); var documentPane = this.DockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();
documentPane.Children.Add(layoutDocument); documentPane.Children.Add(layoutDocument);
} else { } else {
var layoutAnchorable = new LayoutAnchorable() { Title = title, Content = content, ToolTip = toolTip, CanClose = true, CanHide = true }; var layoutAnchorable = new LayoutAnchorable() { Title = title, Content = content, ToolTip = toolTip, CanClose = true, CanHide = true };
var documentPane = this.DockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault(); var documentPane = this.DockManager.Layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();
Docking.DockingHelper.DockHorizontal(layoutAnchorable, documentPane, new GridLength(200), panePosition == PanePosition.Top); Docking.DockingHelper.DockHorizontal(layoutAnchorable, documentPane, new GridLength(200), panePosition == PanePosition.Top);
} }
} }
#endregion #endregion

Loading…
Cancel
Save