Index: branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.Designer.cs
===================================================================
--- branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.Designer.cs	(revision 12183)
+++ branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.Designer.cs	(revision 12184)
@@ -46,11 +46,18 @@
     private void InitializeComponent() {
       this.components = new System.ComponentModel.Container();
+      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewItemDialog));
       this.okButton = new System.Windows.Forms.Button();
       this.cancelButton = new System.Windows.Forms.Button();
-      this.itemsListView = new System.Windows.Forms.ListView();
-      this.nameColumnHeader = new System.Windows.Forms.ColumnHeader();
-      this.descriptioncolumnHeader = new System.Windows.Forms.ColumnHeader();
       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
-      this.versionColumnHeader = new System.Windows.Forms.ColumnHeader();
+      this.searchLabel = new System.Windows.Forms.Label();
+      this.splitContainer = new System.Windows.Forms.SplitContainer();
+      this.searchTextBox = new System.Windows.Forms.TextBox();
+      this.typesTreeView = new System.Windows.Forms.TreeView();
+      this.imageList = new System.Windows.Forms.ImageList(this.components);
+      this.descriptionTextBox = new System.Windows.Forms.TextBox();
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
+      this.splitContainer.Panel1.SuspendLayout();
+      this.splitContainer.Panel2.SuspendLayout();
+      this.splitContainer.SuspendLayout();
       this.SuspendLayout();
       // 
@@ -79,50 +86,87 @@
       this.cancelButton.UseVisualStyleBackColor = true;
       // 
-      // itemsListView
-      // 
-      this.itemsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                  | System.Windows.Forms.AnchorStyles.Left)
-                  | System.Windows.Forms.AnchorStyles.Right)));
-      this.itemsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.nameColumnHeader,
-            this.versionColumnHeader,
-            this.descriptioncolumnHeader});
-      this.itemsListView.FullRowSelect = true;
-      this.itemsListView.HideSelection = false;
-      this.itemsListView.Location = new System.Drawing.Point(12, 12);
-      this.itemsListView.MultiSelect = false;
-      this.itemsListView.Name = "itemsListView";
-      this.itemsListView.Size = new System.Drawing.Size(600, 391);
-      this.itemsListView.TabIndex = 1;
-      this.itemsListView.UseCompatibleStateImageBehavior = false;
-      this.itemsListView.View = System.Windows.Forms.View.Details;
-      this.itemsListView.SelectedIndexChanged += new System.EventHandler(this.itemTypesListView_SelectedIndexChanged);
-      this.itemsListView.DoubleClick += new System.EventHandler(this.itemTypesListView_DoubleClick);
-      // 
-      // nameColumnHeader
-      // 
-      this.nameColumnHeader.DisplayIndex = 0;
-      this.nameColumnHeader.Text = "Name";
-      this.nameColumnHeader.Width = 91;
-      // 
-      // descriptioncolumnHeader
-      // 
-      this.descriptioncolumnHeader.DisplayIndex = 2;
-      this.descriptioncolumnHeader.Text = "Description";
-      this.descriptioncolumnHeader.Width = 190;
-      // 
-      // versionColumnHeader
-      // 
-      this.versionColumnHeader.DisplayIndex = 1;
-      this.versionColumnHeader.Text = "Version";
+      // searchLabel
+      // 
+      this.searchLabel.Image = ((System.Drawing.Image)(resources.GetObject("searchLabel.Image")));
+      this.searchLabel.Location = new System.Drawing.Point(3, 3);
+      this.searchLabel.Name = "searchLabel";
+      this.searchLabel.Size = new System.Drawing.Size(20, 20);
+      this.searchLabel.TabIndex = 1;
+      this.toolTip.SetToolTip(this.searchLabel, "Enter string to search for items");
+      // 
+      // splitContainer
+      // 
+      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.splitContainer.Location = new System.Drawing.Point(12, 12);
+      this.splitContainer.Name = "splitContainer";
+      this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
+      // 
+      // splitContainer.Panel1
+      // 
+      this.splitContainer.Panel1.Controls.Add(this.searchLabel);
+      this.splitContainer.Panel1.Controls.Add(this.searchTextBox);
+      this.splitContainer.Panel1.Controls.Add(this.typesTreeView);
+      // 
+      // splitContainer.Panel2
+      // 
+      this.splitContainer.Panel2.Controls.Add(this.descriptionTextBox);
+      this.splitContainer.Size = new System.Drawing.Size(600, 391);
+      this.splitContainer.SplitterDistance = 292;
+      this.splitContainer.TabIndex = 4;
+      // 
+      // searchTextBox
+      // 
+      this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.searchTextBox.Location = new System.Drawing.Point(29, 3);
+      this.searchTextBox.Name = "searchTextBox";
+      this.searchTextBox.Size = new System.Drawing.Size(568, 20);
+      this.searchTextBox.TabIndex = 1;
+      this.searchTextBox.TextChanged += new System.EventHandler(this.searchTextBox_TextChanged);
+      // 
+      // typesTreeView
+      // 
+      this.typesTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.typesTreeView.HideSelection = false;
+      this.typesTreeView.ImageIndex = 0;
+      this.typesTreeView.ImageList = this.imageList;
+      this.typesTreeView.Location = new System.Drawing.Point(3, 29);
+      this.typesTreeView.Name = "typesTreeView";
+      this.typesTreeView.SelectedImageIndex = 0;
+      this.typesTreeView.ShowNodeToolTips = true;
+      this.typesTreeView.Size = new System.Drawing.Size(594, 260);
+      this.typesTreeView.TabIndex = 2;
+      this.typesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.itemsTreeView_AfterSelect);
+      this.typesTreeView.VisibleChanged += new System.EventHandler(this.itemsTreeView_VisibleChanged);
+      this.typesTreeView.DoubleClick += new System.EventHandler(this.itemTreeView_DoubleClick);
+      // 
+      // imageList
+      // 
+      this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
+      this.imageList.ImageSize = new System.Drawing.Size(16, 16);
+      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
+      // 
+      // descriptionTextBox
+      // 
+      this.descriptionTextBox.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+      this.descriptionTextBox.Location = new System.Drawing.Point(3, 3);
+      this.descriptionTextBox.Multiline = true;
+      this.descriptionTextBox.Name = "descriptionTextBox";
+      this.descriptionTextBox.ReadOnly = true;
+      this.descriptionTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+      this.descriptionTextBox.Size = new System.Drawing.Size(594, 89);
+      this.descriptionTextBox.TabIndex = 0;
       // 
       // NewItemDialog
       // 
       this.AcceptButton = this.okButton;
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
       this.CancelButton = this.cancelButton;
       this.ClientSize = new System.Drawing.Size(624, 444);
-      this.Controls.Add(this.itemsListView);
+      this.Controls.Add(this.splitContainer);
       this.Controls.Add(this.cancelButton);
       this.Controls.Add(this.okButton);
@@ -137,4 +181,10 @@
       this.Load += new System.EventHandler(this.NewItemDialog_Load);
       this.Shown += new System.EventHandler(this.NewItemDialog_Shown);
+      this.splitContainer.Panel1.ResumeLayout(false);
+      this.splitContainer.Panel1.PerformLayout();
+      this.splitContainer.Panel2.ResumeLayout(false);
+      this.splitContainer.Panel2.PerformLayout();
+      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
+      this.splitContainer.ResumeLayout(false);
       this.ResumeLayout(false);
 
@@ -145,9 +195,11 @@
     private System.Windows.Forms.Button okButton;
     private System.Windows.Forms.Button cancelButton;
-    private System.Windows.Forms.ListView itemsListView;
     private System.Windows.Forms.ToolTip toolTip;
-    private System.Windows.Forms.ColumnHeader nameColumnHeader;
-    private System.Windows.Forms.ColumnHeader descriptioncolumnHeader;
-    private System.Windows.Forms.ColumnHeader versionColumnHeader;
+    private System.Windows.Forms.SplitContainer splitContainer;
+    private System.Windows.Forms.TextBox descriptionTextBox;
+    private System.Windows.Forms.Label searchLabel;
+    private System.Windows.Forms.TextBox searchTextBox;
+    private System.Windows.Forms.TreeView typesTreeView;
+    private System.Windows.Forms.ImageList imageList;
   }
 }
Index: branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.cs
===================================================================
--- branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.cs	(revision 12183)
+++ branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.cs	(revision 12184)
@@ -21,5 +21,5 @@
 
 using System;
-using System.Drawing;
+using System.Collections.Generic;
 using System.Linq;
 using System.Windows.Forms;
@@ -29,5 +29,17 @@
 namespace HeuristicLab.Optimizer {
   internal partial class NewItemDialog : Form {
-    private bool initialized;
+    private List<TreeNode> treeNodes;
+    private string currentSearchString;
+
+    private Type selectedType;
+    public Type SelectedType {
+      get { return selectedType; }
+      private set {
+        if (value != selectedType) {
+          selectedType = value;
+          OnSelectedTypeChanged();
+        }
+      }
+    }
 
     private IItem item;
@@ -37,65 +49,208 @@
 
     public NewItemDialog() {
-      initialized = false;
+      InitializeComponent();
+      treeNodes = new List<TreeNode>();
+      currentSearchString = string.Empty;
       item = null;
-      InitializeComponent();
-    }
+      SelectedTypeChanged += this_SelectedTypeChanged;
+    }
+
 
     private void NewItemDialog_Load(object sender, EventArgs e) {
-      if (!initialized) {
-        var categories = from t in ApplicationManager.Manager.GetTypes(typeof(IItem))
-                         where CreatableAttribute.IsCreatable(t)
-                         orderby CreatableAttribute.GetCategory(t), ItemAttribute.GetName(t), ItemAttribute.GetVersion(t) ascending
-                         group t by CreatableAttribute.GetCategory(t) into c
-                         select c;
-
-        itemsListView.SmallImageList = new ImageList();
-        itemsListView.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Class);  // default icon
-        foreach (var category in categories) {
-          ListViewGroup group = new ListViewGroup(category.Key);
-          itemsListView.Groups.Add(group);
-          foreach (var creatable in category) {
-            string name = ItemAttribute.GetName(creatable);
-            string version = ItemAttribute.GetVersion(creatable).ToString();
-            string description = ItemAttribute.GetDescription(creatable);
-            ListViewItem item = new ListViewItem(new string[] { name, version, description }, group);
-            item.ImageIndex = 0;
-            Image image = ItemAttribute.GetImage(creatable);
-            if (image != null) {
-              itemsListView.SmallImageList.Images.Add(image);
-              item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
+      var categories =
+        from t in ApplicationManager.Manager.GetTypes(typeof(IItem))
+        where CreatableAttribute.IsCreatable(t)
+        orderby CreatableAttribute.GetCategory(t), ItemAttribute.GetName(t), ItemAttribute.GetVersion(t) ascending
+        group t by CreatableAttribute.GetCategory(t) into c
+        select c;
+
+      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Class);      // default icon
+      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Namespace);  // plugins
+      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Interface);  // interfacesitemsListView.SmallImageList = new ImageList();
+      imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Template);   // generic typesitemsListView.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Class);  // default icon
+
+      foreach (var category in categories) {
+        var categoryNode = new TreeNode(category.Key) {
+          ImageIndex = 1,
+          Tag = category.Key,
+        };
+        categoryNode.SelectedImageIndex = categoryNode.ImageIndex;
+
+        foreach (var creatable in category) {
+          string name = ItemAttribute.GetName(creatable);
+          string version = ItemAttribute.GetVersion(creatable).ToString();
+          string description = ItemAttribute.GetDescription(creatable);
+
+          var itemNode = new TreeNode(name) {
+            ImageIndex = 0,
+            Tag = creatable
+          };
+          itemNode.SelectedImageIndex = itemNode.ImageIndex;
+          categoryNode.Nodes.Add(itemNode);
+
+          /*
+          ListViewItem item = new ListViewItem(new string[] { name, version, description }, group);
+          item.ImageIndex = 0;
+          Image image = ItemAttribute.GetImage(creatable);
+          if (image != null) {
+            itemsListView.SmallImageList.Images.Add(image);
+            item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
+          }
+          item.Tag = creatable;
+          itemsListView.Items.Add(item);*/
+        }
+        if (categoryNode.Nodes.Count > 0)
+          treeNodes.Add(categoryNode);
+      }
+      foreach (var node in treeNodes)
+        typesTreeView.Nodes.Add((TreeNode)node.Clone());
+      //for (int i = 0; i < itemsListView.Columns.Count; i++)
+      //  itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
+    }
+
+    private void NewItemDialog_Shown(object sender, EventArgs e) {
+      SelectedType = null;
+    }
+
+    public virtual void Filter(string searchString) {
+      if (InvokeRequired) {
+        Invoke(new Action<string>(Filter), searchString);
+      } else {
+        searchString = searchString.ToLower();
+
+        if (!searchString.Contains(currentSearchString)) {
+          typesTreeView.BeginUpdate();
+          // expand saerch -> restore all tree nodes
+          var selectedNode = typesTreeView.SelectedNode;
+          typesTreeView.Nodes.Clear();
+          foreach (TreeNode node in treeNodes)
+            typesTreeView.Nodes.Add((TreeNode)node.Clone());
+          RestoreSelectedNode(selectedNode);
+          typesTreeView.EndUpdate();
+          // remove nodes
+          typesTreeView.BeginUpdate();
+          int i = 0;
+          while (i < typesTreeView.Nodes.Count) {
+            int j = 0;
+            while (j < typesTreeView.Nodes[i].Nodes.Count) {
+              if (!typesTreeView.Nodes[i].Nodes[j].Text.ToLower().Contains(searchString)) {
+                if ((typesTreeView.Nodes[i].Nodes[j].Tag as Type).Equals(SelectedType))
+                  SelectedType = null;
+                typesTreeView.Nodes[i].Nodes[j].Remove();
+              } else
+                j++;
             }
-            item.Tag = creatable;
-            itemsListView.Items.Add(item);
-          }
-        }
-        for (int i = 0; i < itemsListView.Columns.Count; i++)
-          itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
-        initialized = true;
-      }
-    }
-
-    private void NewItemDialog_Shown(object sender, EventArgs e) {
-      item = null;
-    }
-
-    private void itemTypesListView_SelectedIndexChanged(object sender, EventArgs e) {
-      okButton.Enabled = itemsListView.SelectedItems.Count == 1;
-    }
+            if (typesTreeView.Nodes[i].Nodes.Count == 0)
+              typesTreeView.Nodes[i].Remove();
+            else
+              i++;
+          }
+          typesTreeView.EndUpdate();
+          currentSearchString = searchString;
+
+          // if there is just one type node left, select by default
+          if (typesTreeView.Nodes.Count == 1) {
+            if (typesTreeView.Nodes[0].Nodes.Count == 1) {
+              typesTreeView.SelectedNode = typesTreeView.Nodes[0].Nodes[0];
+            }
+          }
+
+          if (typesTreeView.Nodes.Count == 0) {
+            SelectedType = null;
+            typesTreeView.Enabled = false;
+          } else {
+            SetTreeNodeVisibility();
+            typesTreeView.Enabled = true;
+          }
+          UpdateDescription();
+        }
+      }
+    }
+
+    protected virtual void UpdateDescription() {
+      descriptionTextBox.Text = string.Empty;
+
+      if (typesTreeView.SelectedNode != null) {
+        string category = typesTreeView.SelectedNode.Tag as string;
+        if (category != null) {
+          descriptionTextBox.Text = category;
+        }
+        Type type = typesTreeView.SelectedNode.Tag as Type;
+        if (type != null) {
+          string description = ItemAttribute.GetDescription(type);
+          if (description != null)
+            descriptionTextBox.Text = description;
+        }
+      } else if (typesTreeView.Nodes.Count == 0) {
+        descriptionTextBox.Text = "No types found";
+      }
+    }
+
+    #region Events
+    public event EventHandler SelectedTypeChanged;
+    protected virtual void OnSelectedTypeChanged() {
+      if (SelectedTypeChanged != null)
+        SelectedTypeChanged(this, EventArgs.Empty);
+    }
+    #endregion
+
+    #region Control Events
+    protected virtual void searchTextBox_TextChanged(object sender, System.EventArgs e) {
+      Filter(searchTextBox.Text);
+    }
+
+    protected virtual void itemsTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
+      if (typesTreeView.SelectedNode == null) SelectedType = null;
+      else SelectedType = typesTreeView.SelectedNode.Tag as Type;
+      UpdateDescription();
+    }
+
+    protected virtual void itemsTreeView_VisibleChanged(object sender, EventArgs e) {
+      if (Visible) SetTreeNodeVisibility();
+    }
+    #endregion
+
+    #region Helpers
+    private void RestoreSelectedNode(TreeNode selectedNode) {
+      if (selectedNode != null) {
+        foreach (TreeNode node in typesTreeView.Nodes) {
+          if (node.Text.Equals(selectedNode.Text)) typesTreeView.SelectedNode = node;
+          foreach (TreeNode child in node.Nodes) {
+            if ((child.Text.Equals(selectedNode.Text)) && (child.Tag == selectedNode.Tag))
+              typesTreeView.SelectedNode = child;
+          }
+        }
+        if (typesTreeView.SelectedNode == null) SelectedType = null;
+      }
+    }
+    private void SetTreeNodeVisibility() {
+      TreeNode selectedNode = typesTreeView.SelectedNode;
+      if (string.IsNullOrEmpty(currentSearchString) && (typesTreeView.Nodes.Count > 1)) {
+        typesTreeView.CollapseAll();
+        if (selectedNode != null) typesTreeView.SelectedNode = selectedNode;
+      } else {
+        typesTreeView.ExpandAll();
+      }
+      if (selectedNode != null) selectedNode.EnsureVisible();
+    }
+    #endregion
 
     private void okButton_Click(object sender, EventArgs e) {
-      if (itemsListView.SelectedItems.Count == 1) {
-        item = (IItem)Activator.CreateInstance((Type)itemsListView.SelectedItems[0].Tag);
+      if (SelectedType != null) {
+        item = (IItem)Activator.CreateInstance(SelectedType);
         DialogResult = DialogResult.OK;
         Close();
       }
     }
-    private void itemTypesListView_DoubleClick(object sender, EventArgs e) {
-      if (itemsListView.SelectedItems.Count == 1) {
-        item = (IItem)Activator.CreateInstance((Type)itemsListView.SelectedItems[0].Tag);
+    private void itemTreeView_DoubleClick(object sender, EventArgs e) {
+      if (SelectedType != null) {
+        item = (IItem)Activator.CreateInstance(SelectedType);
         DialogResult = DialogResult.OK;
         Close();
       }
     }
+    private void this_SelectedTypeChanged(object sender, EventArgs e) {
+      okButton.Enabled = SelectedType != null;
+    }
   }
 }
