/// <summary> /// Creates a file node for a project element. /// </summary> /// <param name="element">The project element.</param> /// <returns>An instance of the <see cref="DependentFileNode"/> class.</returns> public override DependentFileNode CreateDependentFileNode(ProjectElement element) { if (element == null) { throw new ArgumentNullException("element"); } string subType = element.GetMetadata(ProjectFileConstants.SubType); if (subType == MultiverseInterfaceSubType.Code) { DependentFileNode node = new MultiverseInterfaceIronPythonDependentFileNode(this, element); IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService)); // Make sure the language service is available if (languageService != null) { languageService.AddPythonFile(node.GetMkDocument()); } return(node); } return(base.CreateDependentFileNode(element)); }
private void OnBeforeProjectFileClosed(object sender, BeforeProjectFileClosedEventArgs e) { IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService)); if (languageService != null) { languageService.Clear(); } }
/// <summary> /// Creates a file node for a project element. /// </summary> /// <param name="element">The project element.</param> /// <returns>An instance of the <see cref="FileNode"/> class.</returns> public override FileNode CreateFileNode(ProjectElement element) { if (element == null) { throw new ArgumentNullException("element"); } MultiverseInterfaceFileNode node = null; // Get the SubType for the project element. string subType = element.GetMetadata(ProjectFileConstants.SubType); switch (subType) { case MultiverseInterfaceSubType.Code: node = new MultiverseInterfacePythonFileNode(this, element); break; case MultiverseInterfaceSubType.Frame: node = new MultiverseInterfaceXmlFileNode(this, element); break; case MultiverseInterfaceSubType.TableOfContents: node = new MultiverseInterfaceTocFileNode(this, element); break; default: // We could not recognize the file subtype, just create a WowFileNode node = new MultiverseInterfaceFileNode(this, element); break; } // Check whether this file should be added to the language service if (subType == MultiverseInterfaceSubType.Frame || subType == MultiverseInterfaceSubType.Code) { IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService)); // Make sure the language service is available if (languageService != null) { switch (subType) { case MultiverseInterfaceSubType.Frame: languageService.AddFrameXmlFile(node.GetMkDocument()); break; case MultiverseInterfaceSubType.Code: languageService.AddPythonFile(node.GetMkDocument()); break; } } } return(node); }
/// <summary> /// Removes a node from the hierarchy. /// </summary> /// <param name="node">The node to remove.</param> public override void RemoveChild(HierarchyNode node) { if (node is MultiverseInterfaceXmlFileNode || node is MultiverseInterfacePythonFileNode) { IPythonLanguageService languageService = (IPythonLanguageService)this.GetService(typeof(IPythonLanguageService)); if (languageService != null) { if (node is MultiverseInterfaceXmlFileNode) { languageService.RemoveFrameXmlFile(node.GetMkDocument()); } if (node is MultiverseInterfacePythonFileNode) { languageService.RemovePythonFile(node.GetMkDocument()); } } } base.RemoveChild(node); }