Browse Source

Revert "Generalize the work with the tree-nodes context menu."

This reverts commit b2c532bfe9.
pull/1/head
Eusebiu Marcu 14 years ago
parent
commit
e3431d762e
  1. 23
      ILSpy/TreeNodes/AssemblyTreeNode.cs
  2. 17
      ILSpy/TreeNodes/ILSpyTreeNode.cs

23
ILSpy/TreeNodes/AssemblyTreeNode.cs

@ -46,6 +46,9 @@ namespace ICSharpCode.ILSpy.TreeNodes
readonly List<TypeTreeNode> classes = new List<TypeTreeNode>(); readonly List<TypeTreeNode> classes = new List<TypeTreeNode>();
readonly Dictionary<string, NamespaceTreeNode> namespaces = new Dictionary<string, NamespaceTreeNode>(); readonly Dictionary<string, NamespaceTreeNode> namespaces = new Dictionary<string, NamespaceTreeNode>();
// UI
ContextMenu menu;
public AssemblyTreeNode(string fileName, AssemblyList assemblyList) public AssemblyTreeNode(string fileName, AssemblyList assemblyList)
{ {
if (fileName == null) if (fileName == null)
@ -60,7 +63,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
this.LazyLoading = true; this.LazyLoading = true;
CreateContextMenu(); CreateRemoveItemContextMenu();
} }
public string FileName { public string FileName {
@ -126,12 +129,10 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
} }
protected override void CreateContextMenu() void CreateRemoveItemContextMenu()
{ {
// this is necesary since it create the instance of the context menu var menu = GetContextMenu();
base.CreateContextMenu();
// add specific items - remove assembly
MenuItem item = new MenuItem() { MenuItem item = new MenuItem() {
Header = "Remove assembly", Header = "Remove assembly",
Icon = new Image() { Source = Images.Delete } Icon = new Image() { Source = Images.Delete }
@ -139,7 +140,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
item.Click += delegate { Delete(); }; item.Click += delegate { Delete(); };
contextMenu.Items.Add(item); menu.Items.Add(item);
} }
sealed class MyAssemblyResolver : IAssemblyResolver sealed class MyAssemblyResolver : IAssemblyResolver
@ -176,6 +177,14 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
} }
public override ContextMenu GetContextMenu()
{
if (menu != null)
return menu;
return (menu = new ContextMenu());
}
protected override void LoadChildren() protected override void LoadChildren()
{ {
try { try {

17
ILSpy/TreeNodes/ILSpyTreeNode.cs

@ -20,8 +20,6 @@ using System;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.Decompiler; using ICSharpCode.Decompiler;
using ICSharpCode.TreeView; using ICSharpCode.TreeView;
@ -33,9 +31,6 @@ namespace ICSharpCode.ILSpy.TreeNodes
/// </summary> /// </summary>
abstract class ILSpyTreeNodeBase : SharpTreeNode abstract class ILSpyTreeNodeBase : SharpTreeNode
{ {
// UI
protected ContextMenu contextMenu;
FilterSettings filterSettings; FilterSettings filterSettings;
public FilterSettings FilterSettings { public FilterSettings FilterSettings {
@ -66,18 +61,6 @@ namespace ICSharpCode.ILSpy.TreeNodes
return FilterResult.Hidden; return FilterResult.Hidden;
} }
protected virtual void CreateContextMenu()
{
contextMenu = new ContextMenu();
// add common context menu items, e.g. copy.
}
public override ContextMenu GetContextMenu()
{
return contextMenu;
}
protected object HighlightSearchMatch(string text, string suffix = null) protected object HighlightSearchMatch(string text, string suffix = null)
{ {
// TODO: implement highlighting the search match // TODO: implement highlighting the search match

Loading…
Cancel
Save