public override int OnElementValueChanged(uint elementid, object varValueOld, object varValueNew) { int hr = VSConstants.S_OK; if (elementid == VSConstants.DocumentFrame) { IVsWindowFrame pWindowFrame = varValueOld as IVsWindowFrame; if (pWindowFrame != null) { object document; // Get the name of the document associated with the old window frame hr = pWindowFrame.GetProperty((int)__VSFPROPID.VSFPROPID_pszMkDocument, out document); if (ErrorHandler.Succeeded(hr)) { uint itemid; IVsHierarchy hier = projMgr as IVsHierarchy; hr = hier.ParseCanonicalName((string)document, out itemid); ComposeStarFileNode node = projMgr.NodeFromItemId(itemid) as ComposeStarFileNode; if (null != node) { // node.RunGenerator((string)document); } } } } return(hr); }
/// <summary> /// Create a file node based on an msbuild item. /// </summary> /// <param name="item">The msbuild item to be analyzed</param> /// <returns>ComposeStarFileNode or FileNode</returns> public override FileNode CreateFileNode(ProjectElement item) { if (item == null) { throw new ArgumentNullException("item"); } string include = item.GetMetadata(ProjectFileConstants.Include); ComposeStarFileNode newNode = new ComposeStarFileNode(this, item); newNode.OleServiceProvider.AddService(typeof(EnvDTE.Project), this.ProjectMgr.GetAutomationObject(), false); newNode.OleServiceProvider.AddService(typeof(EnvDTE.ProjectItem), newNode.GetAutomationObject(), false); newNode.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false); if (IsCodeFile(include)) { newNode.OleServiceProvider.AddService( typeof(SVSMDCodeDomProvider), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false); } return(newNode); }