OLD | NEW |
| (Empty) |
1 /// Copyright (c) Microsoft Corporation. All rights reserved. | |
2 | |
3 using System; | |
4 using System.Diagnostics; | |
5 using Microsoft.VisualStudio; | |
6 using Microsoft.VisualStudio.Shell.Interop; | |
7 using IOleServiceProvider = Microsoft.VisualStudio.OLE.Interop.IServiceProvider; | |
8 | |
9 namespace Microsoft.VisualStudio.Project | |
10 { | |
11 class ProjectDesignerDocumentManager : DocumentManager | |
12 { | |
13 #region ctors | |
14 public ProjectDesignerDocumentManager(ProjectNode node) | |
15 : base(node) | |
16 { | |
17 } | |
18 #endregion | |
19 | |
20 #region overriden methods | |
21 | |
22 public override int Open(ref Guid logicalView, IntPtr docDataExi
sting, out IVsWindowFrame windowFrame, WindowFrameShowAction windowFrameAction) | |
23 { | |
24 Guid editorGuid = VSConstants.GUID_ProjectDesignerEditor
; | |
25 return this.OpenWithSpecific(0, ref editorGuid, String.E
mpty, ref logicalView, docDataExisting, out windowFrame, windowFrameAction); | |
26 } | |
27 | |
28 public override int OpenWithSpecific(uint editorFlags, ref Guid
editorType, string physicalView, ref Guid logicalView, IntPtr docDataExisting, o
ut IVsWindowFrame frame, WindowFrameShowAction windowFrameAction) | |
29 { | |
30 frame = null; | |
31 Debug.Assert(editorType == VSConstants.GUID_ProjectDesig
nerEditor, "Cannot open project designer with guid " + editorType.ToString()); | |
32 | |
33 | |
34 if(this.Node == null || this.Node.ProjectMgr == null ||
this.Node.ProjectMgr.IsClosed) | |
35 { | |
36 return VSConstants.E_FAIL; | |
37 } | |
38 | |
39 IVsUIShellOpenDocument uiShellOpenDocument = this.Node.P
rojectMgr.Site.GetService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocum
ent; | |
40 IOleServiceProvider serviceProvider = this.Node.ProjectM
gr.Site.GetService(typeof(IOleServiceProvider)) as IOleServiceProvider; | |
41 | |
42 if(serviceProvider != null && uiShellOpenDocument != nul
l) | |
43 { | |
44 string fullPath = this.GetFullPathForDocument(); | |
45 string caption = this.GetOwnerCaption(); | |
46 | |
47 IVsUIHierarchy parentHierarchy = this.Node.Proje
ctMgr.GetProperty((int)__VSHPROPID.VSHPROPID_ParentHierarchy) as IVsUIHierarchy; | |
48 | |
49 IntPtr parentHierarchyItemId = (IntPtr)this.Node
.ProjectMgr.GetProperty((int)__VSHPROPID.VSHPROPID_ParentHierarchyItemid); | |
50 | |
51 ErrorHandler.ThrowOnFailure(uiShellOpenDocument.
OpenSpecificEditor(editorFlags, fullPath, ref editorType, physicalView, ref logi
calView, caption, parentHierarchy, (uint)(parentHierarchyItemId.ToInt32()), docD
ataExisting, serviceProvider, out frame)); | |
52 | |
53 if(frame != null) | |
54 { | |
55 if(windowFrameAction == WindowFrameShowA
ction.Show) | |
56 { | |
57 ErrorHandler.ThrowOnFailure(fram
e.Show()); | |
58 } | |
59 } | |
60 } | |
61 | |
62 return VSConstants.S_OK; | |
63 } | |
64 #endregion | |
65 | |
66 } | |
67 } | |
OLD | NEW |