Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/16/15 14:36:54 (9 years ago)
Author:
pfleck
Message:

#2025

  • Collapse tree per default when opening.
  • Added Plugin and Version textboxes.
  • Moved expand/collapse-all buttons.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/NewItemDialog/HeuristicLab.Optimizer/3.3/NewItemDialog.cs

    r12202 r12203  
    3030  internal partial class NewItemDialog : Form {
    3131    private bool isInitialized;
    32     private bool firstShown = true;
    3332
    3433    private List<TreeNode> treeNodes;
     
    113112    private void NewItemDialog_Shown(object sender, EventArgs e) {
    114113      SelectedType = null;
    115       if (firstShown) {
    116         searchTextBox.Focus();
    117         firstShown = false;
    118       }
    119114    }
    120115
     
    183178        if (category != null) {
    184179          descriptionTextBox.Text = category;
     180          pluginTextBox.Text = string.Empty;
     181          versionTextBox.Text = string.Empty;
    185182        }
    186183        Type type = typesTreeView.SelectedNode.Tag as Type;
    187184        if (type != null) {
    188185          string description = ItemAttribute.GetDescription(type);
     186          var version = ItemAttribute.GetVersion(type);
     187          var plugin = ApplicationManager.Manager.GetDeclaringPlugin(type);
    189188          if (description != null)
    190189            descriptionTextBox.Text = description;
     190          if (plugin != null)
     191            pluginTextBox.Text = plugin.Name;
     192          if (version != null)
     193            versionTextBox.Text = version.ToString();
    191194        }
    192195      } else if (typesTreeView.Nodes.Count == 0) {
    193196        descriptionTextBox.Text = "No types found";
     197        pluginTextBox.Text = string.Empty;
     198        versionTextBox.Text = string.Empty;
    194199      }
    195200    }
     
    233238    }
    234239    private void SetTreeNodeVisibility() {
    235       typesTreeView.ExpandAll();
    236240      TreeNode selectedNode = typesTreeView.SelectedNode;
    237       if (selectedNode != null) {
    238         typesTreeView.SelectedNode = selectedNode;
    239         selectedNode.EnsureVisible();
    240       } else if (string.IsNullOrEmpty(currentSearchString) && typesTreeView.Nodes.Count > 1) {
    241         typesTreeView.Nodes[0].EnsureVisible();
    242       }
     241      if (string.IsNullOrEmpty(currentSearchString) && (typesTreeView.Nodes.Count > 1)) {
     242        typesTreeView.CollapseAll();
     243        if (selectedNode != null) typesTreeView.SelectedNode = selectedNode;
     244      } else {
     245        typesTreeView.ExpandAll();
     246      }
     247      if (selectedNode != null) selectedNode.EnsureVisible();
    243248    }
    244249    #endregion
Note: See TracChangeset for help on using the changeset viewer.