mirror of https://github.com/icsharpcode/ILSpy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
957 B
32 lines
957 B
using System; |
|
using System.Windows; |
|
using ICSharpCode.Decompiler; |
|
using ICSharpCode.Decompiler.Metadata; |
|
using ICSharpCode.Decompiler.TypeSystem; |
|
using ICSharpCode.ILSpy.Properties; |
|
|
|
namespace ICSharpCode.ILSpy.TreeNodes |
|
{ |
|
[ExportContextMenuEntry(Header = nameof(Resources.CopyName), Icon = "images/Copy", Order = 9999)] |
|
public class CopyFullyQualifiedNameContextMenuEntry : IContextMenuEntry |
|
{ |
|
public bool IsVisible(TextViewContext context) |
|
{ |
|
return GetMemberNodeFromContext(context) != null; |
|
} |
|
|
|
public bool IsEnabled(TextViewContext context) => true; |
|
|
|
public void Execute(TextViewContext context) |
|
{ |
|
var member = GetMemberNodeFromContext(context)?.Member; |
|
if (member == null) return; |
|
Clipboard.SetText(member.ReflectionName); |
|
} |
|
|
|
private IMemberTreeNode GetMemberNodeFromContext(TextViewContext context) |
|
{ |
|
return context.SelectedTreeNodes?.Length == 1 ? context.SelectedTreeNodes[0] as IMemberTreeNode : null; |
|
} |
|
} |
|
} |