I have a TreeView control whose nodes represent code files. When each node is added to the TreeView control a SyntaxEditor object is generated and the code file's text is assigned to the SyntaxEditor.Document object's Text property. Each SyntaxEditor object is then assigned to its corresponding TreeView node's Tag property. I'm doing this so that when I 'link' multiple code files, I can easily check that each code file contains no syntax errors before I continue the 'link' process.
Here is the code to make all of this happen:The problem I'm having is that I need the semantic parser for each new SyntaxEditor to be invoked at the time it is created (when it is assigned to each TreeView node's Tag property). This way I'll have immediate access to each code file's syntax errors. It seems that the semantic parser is only invoked when the SyntaxEditor object is visible. I've tried invoking Invalidate() but that didn't work either. The semantic parser is only getting invoked when I display the SyntaxEditor objects in their respective TabPage.
By the way, I'm using the SemanticParserService to Parse my documents in a separate thread.
Thanks in advance.
Here is the code to make all of this happen:
if (this.dlgAddFiles.ShowDialog() == DialogResult.OK)
{
foreach (string strFileNameWithPath in dlgAddFiles.FileNames)
{
TreeNode oRootTreeNode = this.treeView.Nodes[0];
TreeNode oNewTreeNode = new TreeNode(System.IO.Path.GetFileName(strFileNameWithPath));
FileStream streamInput = new FileStream(strFileNameWithPath, FileMode.Open);
TextReader reader = new System.IO.StreamReader(streamInput);
string strFileText = reader.ReadToEnd();
reader.Close();
streamInput.Close();
SyntaxEditor oSyntaxEditor = new SyntaxEditor();
oSyntaxEditor.Document.Text = strFileText;
MyFileNode oFileNode = new MyFileNode(strFileNameWithPath, oSyntaxEditor);
oNewTreeNode.Tag = oFileNode;
oRootTreeNode.Nodes.Add(oNewTreeNode);
}
this.treeView.ExpandAll();
}
By the way, I'm using the SemanticParserService to Parse my documents in a separate thread.
Thanks in advance.