public static void Replace(RustProjectNode root, HierarchyNode old, Func <HierarchyNode> newN) { if (root == null) { throw new ArgumentNullException("root"); } if (old == null) { throw new ArgumentNullException("old"); } if (newN == null) { throw new ArgumentNullException("newN"); } __VSHIERARCHYITEMSTATE visualState = old.GetItemState(__VSHIERARCHYITEMSTATE.HIS_Selected | __VSHIERARCHYITEMSTATE.HIS_Expanded); HierarchyNode parent = old.Parent; HierarchyNode newNode; if (parent is UntrackedFolderNode) { using (((UntrackedFolderNode)parent).SuspendChildrenTracking()) { newNode = ReplaceCore(root, old, newN, parent); ((UntrackedFolderNode)parent).OnChildReplaced(old, newNode); } } else { newNode = ReplaceCore(root, old, newN, parent); } if ((visualState & __VSHIERARCHYITEMSTATE.HIS_Expanded) != 0) { newNode.ExpandItem(EXPANDFLAGS.EXPF_ExpandFolder); } if ((visualState & __VSHIERARCHYITEMSTATE.HIS_Selected) != 0) { newNode.ExpandItem(EXPANDFLAGS.EXPF_SelectItem); } }
public static void Replace(RustProjectNode root, HierarchyNode old, Func<HierarchyNode> newN) { if (root == null) throw new ArgumentNullException("root"); if (old == null) throw new ArgumentNullException("old"); if (newN == null) throw new ArgumentNullException("newN"); __VSHIERARCHYITEMSTATE visualState = old.GetItemState(__VSHIERARCHYITEMSTATE.HIS_Selected | __VSHIERARCHYITEMSTATE.HIS_Expanded); HierarchyNode parent = old.Parent; HierarchyNode newNode; if(parent is UntrackedFolderNode) { using(((UntrackedFolderNode)parent).SuspendChildrenTracking()) { newNode = ReplaceCore(root, old, newN, parent); ((UntrackedFolderNode)parent).OnChildReplaced(old, newNode); } } else { newNode = ReplaceCore(root, old, newN, parent); } if ((visualState & __VSHIERARCHYITEMSTATE.HIS_Expanded) != 0) newNode.ExpandItem(EXPANDFLAGS.EXPF_ExpandFolder); if ((visualState & __VSHIERARCHYITEMSTATE.HIS_Selected) != 0) newNode.ExpandItem(EXPANDFLAGS.EXPF_SelectItem); }