Changeset 12649
- Timestamp:
- 07/07/15 14:40:43 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/Attributes/CreatableAttribute.cs
r12622 r12649 61 61 return tokens.Take(tokens.Count - 1); 62 62 } 63 64 63 private static IEnumerable<string> GetTokensWithOrdering(string rawName) { 65 64 return rawName.Split(new[] { SplitToken }, StringSplitOptions.RemoveEmptyEntries); … … 84 83 85 84 public int Priority { get; set; } 86 87 85 88 86 public CreatableAttribute() { … … 112 110 else return null; 113 111 } 114 115 112 public static int GetPriority(Type type) { 116 113 var attribs = type.GetCustomAttributes(typeof(CreatableAttribute), false); -
trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.cs
r12512 r12649 27 27 using System.Windows.Forms; 28 28 using HeuristicLab.Common; 29 using HeuristicLab.Common.Resources; 29 30 using HeuristicLab.Core; 30 31 using HeuristicLab.PluginInfrastructure; … … 93 94 94 95 private TreeNode CreateCategoryTree(IEnumerable<IGrouping<string, Type>> categories) { 95 imageList.Images.Add( HeuristicLab.Common.Resources.VSImageLibrary.Class); // default icon96 imageList.Images.Add( HeuristicLab.Common.Resources.VSImageLibrary.Namespace); // plugins96 imageList.Images.Add(VSImageLibrary.Class); // default icon 97 imageList.Images.Add(VSImageLibrary.Namespace); // plugins 97 98 98 99 var rootNode = new TreeNode(); … … 109 110 110 111 // 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) 112 113 continue; 113 114 114 var categoryNode = new TreeNode(name, imageIndex: 1, selectedImageIndex:1) {115 var categoryNode = new TreeNode(name, 1, 1) { 115 116 Name = fullName, 116 117 Tag = rawName … … 133 134 rawName = rawName == null ? rawParentName : rawName + CreatableAttribute.Categories.SplitToken + rawParentName; 134 135 var fullName = CreatableAttribute.Categories.GetFullName(rawName); 135 parentNode = node.Nodes.Find(fullName, searchAllChildren:false).SingleOrDefault();136 parentNode = node.Nodes.Find(fullName, false).SingleOrDefault(); 136 137 if (parentNode == null) { 137 138 var name = CreatableAttribute.Categories.GetName(rawName); 138 parentNode = new TreeNode(name, imageIndex: 1, selectedImageIndex:1) {139 parentNode = new TreeNode(name, 1, 1) { 139 140 Name = fullName, 140 141 Tag = rawName … … 149 150 foreach (var category in categories) { 150 151 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(); 152 153 foreach (var creatable in category) { 153 154 var itemNode = CreateItemNode(creatable); … … 323 324 private void RestoreSelectedNode(TreeNode selectedNode) { 324 325 if (selectedNode != null) { 325 var node = typesTreeView.Nodes.Find(selectedNode.Name, searchAllChildren:true).SingleOrDefault();326 var node = typesTreeView.Nodes.Find(selectedNode.Name, true).SingleOrDefault(); 326 327 if (node != null) 327 328 typesTreeView.SelectedNode = node; … … 360 361 } 361 362 362 private TreeNode toolStripMenuNode = null;363 private TreeNode toolStripMenuNode; 363 364 private void typesTreeView_MouseDown(object sender, MouseEventArgs e) { 364 365 if (e.Button == MouseButtons.Right) { … … 440 441 } 441 442 } 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 }449 443 450 444 private class ItemTreeNodeComparer : IComparer { … … 456 450 if (lhs.Tag is string && rhs.Tag is string) { 457 451 return Comparer.Compare((string)lhs.Tag, (string)rhs.Tag); 458 } else if (lhs.Tag is string) { 452 } 453 if (lhs.Tag is string) { 459 454 return -1; 460 } else461 455 } 456 return 1; 462 457 } 463 458 }
Note: See TracChangeset
for help on using the changeset viewer.