public LibraryNode(string name, LibraryNodeType type, ModuleId moduleId) : this(name, type, LibraryNodeCapabilities.None, null, moduleId) { }
public LibraryNode(string name, LibraryNodeType type, LibraryNodeCapabilities capabilities, CommandID contextMenuID, ModuleId moduleId) { this.capabilities = capabilities; this.contextMenuID = contextMenuID; this.name = name; this.uniquename = name; this.tooltip = name; this.type = type; parent = null; children = new List <LibraryNode>(); clipboardFormats = new List <VSOBJCLIPFORMAT>(); filteredView = new Dictionary <LibraryNodeType, LibraryNode>(); if (moduleId != null) { this.ownerHierarchy = moduleId.Hierarchy; this.fileId = moduleId.ItemID; ownerHierarchy.GetCanonicalName(fileId, out this.path); } sourceSpan = new TextSpan(); if (type == LibraryNodeType.Package) { this.CanGoToSource = false; } else { this.CanGoToSource = true; } if (type == LibraryNodeType.Members) { displayData.Image = (ushort)OMGlyphType.Members; displayData.SelectedImage = displayData.Image; } }
public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame) { // Check if this document is in the list of the documents. if (documents.ContainsKey(docCookie)) { return(VSConstants.S_OK); } // Get the information about this document from the RDT. IVsRunningDocumentTable rdt = provider.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable; if (null != rdt) { // Note that here we don't want to throw in case of error. uint flags; uint readLocks; uint writeLocks; string documentMoniker; IVsHierarchy hierarchy; uint itemId; IntPtr unkDocData; int hr = rdt.GetDocumentInfo(docCookie, out flags, out readLocks, out writeLocks, out documentMoniker, out hierarchy, out itemId, out unkDocData); try { if (Microsoft.VisualStudio.ErrorHandler.Failed(hr) || (IntPtr.Zero == unkDocData)) { return(VSConstants.S_OK); } // Check if the herarchy is one of the hierarchies this service is monitoring. if (!hierarchies.ContainsKey(hierarchy)) { // This hierarchy is not monitored, we can exit now. return(VSConstants.S_OK); } // Check the extension of the file to see if a listener is required. string extension = System.IO.Path.GetExtension(documentMoniker); if (0 != string.Compare(extension, SQLanguageService.LanguageExtension, StringComparison.OrdinalIgnoreCase)) { return(VSConstants.S_OK); } // Create the module id for this document. ModuleId docId = new ModuleId(hierarchy, itemId); // Try to get the text buffer. IVsTextLines buffer = Marshal.GetObjectForIUnknown(unkDocData) as IVsTextLines; // Create the listener. SQLanguageService ls = (SQLanguageService)provider.GetService(typeof(SQLanguageService)); TextLineEventListener listener = new TextLineEventListener(buffer, documentMoniker, docId, ls.GetSquirrelVersion()); // Add the listener to the dictionary, so we will not create it anymore. documents.Add(docCookie, listener); } finally { if (IntPtr.Zero != unkDocData) { Marshal.Release(unkDocData); } } } // Always return success. return(VSConstants.S_OK); }