public CodeStructureRootElement Build(IPsiSourceFile sourceFile, CodeStructureOptions options) { var t4File = sourceFile.GetTheOnlyPsiFile(T4Language.Instance) as IT4File; if (t4File == null) { return(null); } // TODO: handle VB var cSharpFile = sourceFile.GetTheOnlyPsiFile(CSharpLanguage.Instance) as ICSharpFile; if (cSharpFile == null) { return(null); } var cSharpFileImpl = cSharpFile as IFileImpl; if (cSharpFileImpl == null || cSharpFileImpl.SecondaryRangeTranslator == null) { return(null); } var state = new CSharpCodeStructureProcessingState(CodeStructureOptions.Default); var rootElement = new T4CodeStructureRootElement(t4File); foreach (ITreeNode treeNode in t4File.Children()) { ProcessT4Node(treeNode, rootElement, cSharpFile, cSharpFileImpl.SecondaryRangeTranslator, state); } return(rootElement); }
public CodeStructureRootElement Build(IPsiSourceFile sourceFile, CodeStructureOptions options) { var t4File = sourceFile.GetTheOnlyPsiFile(T4Language.Instance) as IT4File; if (t4File == null) return null; // TODO: handle VB var cSharpFile = sourceFile.GetTheOnlyPsiFile(CSharpLanguage.Instance) as ICSharpFile; var cSharpFileImpl = cSharpFile as IFileImpl; if (cSharpFileImpl == null || cSharpFileImpl.SecondaryRangeTranslator == null) return null; var state = new CSharpCodeStructureProcessingState(CodeStructureOptions.Default); var rootElement = new T4CodeStructureRootElement(t4File); foreach (ITreeNode treeNode in t4File.Children()) ProcessT4Node(treeNode, rootElement, cSharpFile, cSharpFileImpl.SecondaryRangeTranslator, state); return rootElement; }