Adds the group archetypes to add to the menu. The groups. True if merge group items into any existing group of the same name.
(IEnumerable<GroupArchetype> groupArchetypes, bool withGroupMerge = true)
| 440 | /// <param name="groupArchetypes">The groups.</param> |
| 441 | /// <param name="withGroupMerge">True if merge group items into any existing group of the same name.</param> |
| 442 | public void AddGroups(IEnumerable<GroupArchetype> groupArchetypes, bool withGroupMerge = true) |
| 443 | { |
| 444 | // Check if can create group for them to be spawned via GUI |
| 445 | if (groupArchetypes.Any(g => g.Archetypes.Any(x => (x.Flags & NodeFlags.NoSpawnViaGUI) == 0))) |
| 446 | { |
| 447 | Profiler.BeginEvent("VisjectCM.AddGroups"); |
| 448 | var isLayoutLocked = IsLayoutLocked; |
| 449 | LockChildrenRecursive(); |
| 450 | |
| 451 | Profiler.BeginEvent("Create Groups"); |
| 452 | var groups = new List<VisjectCMGroup>(); |
| 453 | foreach (var groupArchetype in groupArchetypes) |
| 454 | { |
| 455 | var group = CreateGroup(groupArchetype, withGroupMerge); |
| 456 | group.Close(false); |
| 457 | |
| 458 | foreach (var nodeArchetype in groupArchetype.Archetypes) |
| 459 | { |
| 460 | var item = new VisjectCMItem(group, groupArchetype, nodeArchetype) |
| 461 | { |
| 462 | Parent = group |
| 463 | }; |
| 464 | } |
| 465 | if (_contextSensitiveSearchEnabled && _selectedBoxes.Count > 0) |
| 466 | group.EvaluateVisibilityWithBox(_selectedBoxes[0]); |
| 467 | group.SortChildren(); |
| 468 | if (ShowExpanded) |
| 469 | group.Open(false); |
| 470 | group.Parent = _groupsPanel; |
| 471 | _groups.Add(group); |
| 472 | |
| 473 | groups.Add(group); |
| 474 | } |
| 475 | Profiler.EndEvent(); |
| 476 | |
| 477 | if (!isLayoutLocked) |
| 478 | { |
| 479 | if (_contextSensitiveSearchEnabled && _selectedBoxes.Count != 0 && _selectedBoxes[0] != null) |
| 480 | UpdateFilters(); |
| 481 | else |
| 482 | SortGroups(); |
| 483 | Profiler.BeginEvent("Perform Layout"); |
| 484 | UnlockChildrenRecursive(); |
| 485 | foreach (var group in groups) |
| 486 | group.PerformLayout(); |
| 487 | PerformLayout(); |
| 488 | Profiler.EndEvent(); |
| 489 | |
| 490 | if (_searchBox.TextLength != 0) |
| 491 | { |
| 492 | OnSearchFilterChanged(); |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | Profiler.EndEvent(); |
| 497 | } |
| 498 | } |
| 499 |
no test coverage detected