Changeset 12649


Ignore:
Timestamp:
07/07/15 14:40:43 (5 years ago)
Author:
ascheibe
Message:

#2025 applied ReSharper suggestions to NewItemDialog

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Attributes/CreatableAttribute.cs

    r12622 r12649  
    6161        return tokens.Take(tokens.Count - 1);
    6262      }
    63 
    6463      private static IEnumerable<string> GetTokensWithOrdering(string rawName) {
    6564        return rawName.Split(new[] { SplitToken }, StringSplitOptions.RemoveEmptyEntries);
     
    8483
    8584    public int Priority { get; set; }
    86 
    8785
    8886    public CreatableAttribute() {
     
    112110      else return null;
    113111    }
    114 
    115112    public static int GetPriority(Type type) {
    116113      var attribs = type.GetCustomAttributes(typeof(CreatableAttribute), false);
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.cs

    r12512 r12649  
    2727using System.Windows.Forms;
    2828using HeuristicLab.Common;
     29using HeuristicLab.Common.Resources;
    2930using HeuristicLab.Core;
    3031using HeuristicLab.PluginInfrastructure;
     
    9394
    9495    private TreeNode CreateCategoryTree(IEnumerable<IGrouping<string, Type>> categories) {
    95       imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Class);      // default icon
    96       imageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Namespace);  // plugins
     96      imageList.Images.Add(VSImageLibrary.Class);      // default icon
     97      imageList.Images.Add(VSImageLibrary.Namespace);  // plugins
    9798
    9899      var rootNode = new TreeNode();
     
    109110
    110111        // Skip categories with same full name because the raw name can still be different (missing order)
    111         if (rootNode.Nodes.Find(fullName, searchAllChildren: true).Length > 0)
     112        if (rootNode.Nodes.Find(fullName, true).Length > 0)
    112113          continue;
    113114
    114         var categoryNode = new TreeNode(name, imageIndex: 1, selectedImageIndex: 1) {
     115        var categoryNode = new TreeNode(name, 1, 1) {
    115116          Name = fullName,
    116117          Tag = rawName
     
    133134        rawName = rawName == null ? rawParentName : rawName + CreatableAttribute.Categories.SplitToken + rawParentName;
    134135        var fullName = CreatableAttribute.Categories.GetFullName(rawName);
    135         parentNode = node.Nodes.Find(fullName, searchAllChildren: false).SingleOrDefault();
     136        parentNode = node.Nodes.Find(fullName, false).SingleOrDefault();
    136137        if (parentNode == null) {
    137138          var name = CreatableAttribute.Categories.GetName(rawName);
    138           parentNode = new TreeNode(name, imageIndex: 1, selectedImageIndex: 1) {
     139          parentNode = new TreeNode(name, 1, 1) {
    139140            Name = fullName,
    140141            Tag = rawName
     
    149150      foreach (var category in categories) {
    150151        var fullName = CreatableAttribute.Categories.GetFullName(category.Key);
    151         var categoryNode = node.Nodes.Find(fullName, searchAllChildren: true).Single();
     152        var categoryNode = node.Nodes.Find(fullName, true).Single();
    152153        foreach (var creatable in category) {
    153154          var itemNode = CreateItemNode(creatable);
     
    323324    private void RestoreSelectedNode(TreeNode selectedNode) {
    324325      if (selectedNode != null) {
    325         var node = typesTreeView.Nodes.Find(selectedNode.Name, searchAllChildren: true).SingleOrDefault();
     326        var node = typesTreeView.Nodes.Find(selectedNode.Name, true).SingleOrDefault();
    326327        if (node != null)
    327328          typesTreeView.SelectedNode = node;
     
    360361    }
    361362
    362     private TreeNode toolStripMenuNode = null;
     363    private TreeNode toolStripMenuNode;
    363364    private void typesTreeView_MouseDown(object sender, MouseEventArgs e) {
    364365      if (e.Button == MouseButtons.Right) {
     
    440441      }
    441442    }
    442     private TreeNode LastVisibleNode {
    443       get {
    444         var node = FirstVisibleNode;
    445         while (node != null && node.NextVisibleNode != null) node = node.NextVisibleNode;
    446         return node;
    447       }
    448     }
    449443
    450444    private class ItemTreeNodeComparer : IComparer {
     
    456450        if (lhs.Tag is string && rhs.Tag is string) {
    457451          return Comparer.Compare((string)lhs.Tag, (string)rhs.Tag);
    458         } else if (lhs.Tag is string) {
     452        }
     453        if (lhs.Tag is string) {
    459454          return -1;
    460         } else
    461           return 1;
     455        }
     456        return 1;
    462457      }
    463458    }
Note: See TracChangeset for help on using the changeset viewer.