//========================================================================================== // Constructors //========================================================================================== /// <summary> /// Initializes a new instance of the <see cref="SortedCollection"/> class. /// </summary> /// <param name="comparer">An <see cref="IComparer"/> to use for the sorting.</param> protected SortedCollection(IComparer comparer) : base(new ArrayList()) { Tracer.VerifyNonNullArgument(comparer, "comparer"); this.comparer = comparer; this.list = (ArrayList)this.InnerCollection; }
/// <summary> /// Opens the standard editor for this file type in Visual Studio. /// </summary> /// <param name="logicalView">The type of view in which to open the document.</param> /// <param name="existingDocumentData"> /// Passed through to the IVsUIShellOpenDocument.OpenStandardEditor or OpenSpecificEditor, which /// will then determine if the document is already opened and reused the open window. /// </param> /// <param name="physicalView"> /// Name of the physical view if we're opening with a specific editor. Not used if opening with a standard editor. /// </param> /// <param name="specificEditor">The GUID of the specific registered editor to use to open this node.</param> /// <returns>The <see cref="IVsWindowFrame"/> object that contains the opened document.</returns> private IVsWindowFrame Open(VsLogicalView logicalView, IntPtr existingDocumentData, Guid specificEditor, string physicalView) { Tracer.VerifyNonNullArgument(logicalView, "logicalView"); // Check to see if the file exists before we try to open it. if (!File.Exists(this.AbsolutePath)) { Context.ShowErrorMessageBox(SconceStrings.FileDoesNotExist(this.AbsolutePath)); return(null); } IVsWindowFrame windowFrame; Guid logicalViewGuid = logicalView.Value; Guid editorTypeGuid = specificEditor; bool useSpecificEditor = (specificEditor != Guid.Empty); int hr; // Get a IVsUIShellOpenDocument object so that we can use it to open the document. IVsUIShellOpenDocument vsUIShellOpenDocument = (IVsUIShellOpenDocument)this.ServiceProvider.GetServiceOrThrow(typeof(SVsUIShellOpenDocument), typeof(IVsUIShellOpenDocument), classType, "Open"); // Open the document. if (useSpecificEditor) { hr = vsUIShellOpenDocument.OpenSpecificEditor( 0, this.CanonicalName, ref editorTypeGuid, physicalView, ref logicalViewGuid, this.Caption, (IVsUIHierarchy)this.Hierarchy, this.HierarchyId, existingDocumentData, (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)Package.Instance, out windowFrame); } else { hr = vsUIShellOpenDocument.OpenStandardEditor( unchecked ((uint)__VSOSEFLAGS.OSE_ChooseBestStdEditor), this.CanonicalName, ref logicalViewGuid, this.Caption, (IVsUIHierarchy)this.Hierarchy, this.HierarchyId, existingDocumentData, (Microsoft.VisualStudio.OLE.Interop.IServiceProvider)Package.Instance, out windowFrame); } string editorTypeName = useSpecificEditor ? "specific" : "standard"; if (NativeMethods.Succeeded(hr)) { Tracer.WriteLineInformation(classType, "Open", "Succeeded in opening '{0}' with a {1} editor.", this.AbsolutePath, editorTypeName); if (windowFrame != null) { // Get the document cookie and cache it. object pvar; hr = windowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocCookie, out pvar); NativeMethods.ThrowOnFailure(hr); // pvar is an int, but we need a uint. We get an error if we try to immediately cast to uint // without first casting to an int. uint cookie = unchecked ((uint)(int)pvar); this.SetDocumentCookie(cookie); Tracer.WriteLineInformation(classType, "Open", "Document '{0}' has a cookie value of {1}", this.AbsolutePath, cookie); // Show the window frame of the open document. The documentation says we don't need to do this, but the reality is different. hr = windowFrame.Show(); Tracer.Assert(NativeMethods.Succeeded(hr), "Error in IVsWindowFrame.Show(): 0x{0:x}", hr); // Trace the running documents. VsHelperMethods.TraceRunningDocuments(); } else { Tracer.Fail("Open succeeded but we were returned a null IVsWindowFrame so we can't show the document."); } } else if (hr == NativeMethods.OLE_E_PROMPTSAVECANCELLED) { Tracer.WriteLineInformation(classType, "Open", "The user canceled out of the open dialog box."); } else { Tracer.Fail("Failed to open '{0}' with a {1} editor. Hr=0x{2:x}", this.AbsolutePath, editorTypeName, hr); NativeMethods.ThrowOnFailure(hr); } return(windowFrame); }
//========================================================================================== // Constructors //========================================================================================== public ConfigurationProvider(Project project) { Tracer.VerifyNonNullArgument(project, "project"); this.project = project; }
//========================================================================================== // Constructors //========================================================================================== /// <summary> /// Initializes a new instance of the <see cref="ProjectFactory"/> class. /// </summary> public ProjectFactory(Package parent) { Tracer.VerifyNonNullArgument(parent, "parent"); this.parentPackage = parent; }
/// <summary> /// Initializes a new instance of the <see cref="NodeCollection"/> class. /// </summary> /// <param name="parent">The collection's parent folder node.</param> /// <param name="comparer">A comparer to use for the collection.</param> protected NodeCollection(FolderNode parent, IComparer comparer) : base(comparer) { Tracer.VerifyNonNullArgument(parent, "parent"); this.parent = parent; }
/// <summary> /// Initializes a new instance of the <see cref="CloneableCollection"/> class, specifying /// that it should take on the behavior of a dictionary. /// </summary> /// <param name="innerDictionary">The data container for the items.</param> protected CloneableCollection(IDictionary innerDictionary) { Tracer.VerifyNonNullArgument(innerDictionary, "innerDictionary"); this.innerDictionary = innerDictionary; }
//========================================================================================== // Constructors //========================================================================================== /// <summary> /// Initializes a new instance of the <see cref="CloneableCollection"/> class, specifying /// that it should take on the behavior of a list. /// </summary> /// <param name="innerList">The data container for the items.</param> protected CloneableCollection(IList innerList) { Tracer.VerifyNonNullArgument(innerList, "innerList"); this.innerList = innerList; }
//========================================================================================== // Constructors //========================================================================================== /// <summary> /// Initializes a new instance of the <see cref="NodeProperties"/> class. /// </summary> protected NodeProperties(Node node) { Tracer.VerifyNonNullArgument(node, "node"); this.node = node; }