public void OpenGroup(DocumentGroup group) { if (group == null) { return; } using (var stream = new VsOleStream()) { stream.Write(group.Positions, 0, group.Positions.Length); stream.Seek(0, SeekOrigin.Begin); var hr = DocumentWindowMgr.ReopenDocumentWindows(stream); if (hr != VSConstants.S_OK) { Debug.Assert(false, "ReopenDocumentWindows", String.Empty, hr); } } }
public void SaveGroup(string name, int? slot = null) { if (DocumentWindowMgr == null) { Debug.Assert(false, "IVsUIShellDocumentWindowMgr", String.Empty, 0); return; } if (!Package.Environment.GetDocumentWindows().Any()) { return; } var isBuiltIn = IsBuiltInGroup(name); if (isBuiltIn) { slot = null; } var group = Groups.FindByName(name); var files = new DocumentFilesHashSet(Package.Environment.GetDocumentFiles().OrderBy(Path.GetFileName)); //var bps = Package.Environment.GetMatchingBreakpoints(files, StringComparer.OrdinalIgnoreCase)); using (var stream = new VsOleStream()) { var hr = DocumentWindowMgr.SaveDocumentWindowPositions(0, stream); if (hr != VSConstants.S_OK) { Debug.Assert(false, "SaveDocumentWindowPositions", String.Empty, hr); if (group != null) { Groups.Remove(group); } return; } stream.Seek(0, SeekOrigin.Begin); var documents = String.Join(", ", files.Select(Path.GetFileName)); if (group == null) { group = new DocumentGroup { Name = name, Description = documents, Files = files, Positions = stream.ToArray() }; TrySetSlot(group, slot); if (isBuiltIn) { Groups.Insert(0, group); } else { Groups.Add(group); } } else { SaveUndoGroup(group); group.Description = documents; group.Files = files; group.Positions = stream.ToArray(); TrySetSlot(group, slot); } } }