Changeset 2719 for trunk/sources/HeuristicLab.CodeEditor/3.2/CodeEditor.cs
- Timestamp:
- 01/29/10 14:33:03 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CodeEditor/3.2/CodeEditor.cs
r2673 r2719 306 306 } 307 307 308 private bool runParser = true; 308 309 private void ParserThread() { 309 310 BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading mscorlib..."; })); … … 311 312 ParseStep(); 312 313 BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Ready"; })); 314 while (runParser && !IsDisposed) { 315 ParseStep(); 316 Thread.Sleep(2000); 317 } 318 } 319 320 private void ParseStep() { 313 321 try { 314 while (!IsDisposed) { 315 ParseStep(); 316 Thread.Sleep(2000); 317 } 322 string code = null; 323 Invoke(new MethodInvoker(delegate { code = textEditor.Text; })); 324 TextReader textReader = new StringReader(code); 325 Dom.ICompilationUnit newCompilationUnit; 326 NRefactory.SupportedLanguage supportedLanguage; 327 supportedLanguage = NRefactory.SupportedLanguage.CSharp; 328 using (NRefactory.IParser p = NRefactory.ParserFactory.CreateParser(supportedLanguage, textReader)) { 329 p.ParseMethodBodies = false; 330 p.Parse(); 331 newCompilationUnit = ConvertCompilationUnit(p.CompilationUnit); 332 } 333 projectContent.UpdateCompilationUnit(lastCompilationUnit, newCompilationUnit, DummyFileName); 334 lastCompilationUnit = newCompilationUnit; 335 parseInformation.SetCompilationUnit(newCompilationUnit); 318 336 } catch { } 319 }320 321 private void ParseStep() {322 string code = null;323 Invoke(new MethodInvoker(delegate {324 code = textEditor.Text;325 }));326 TextReader textReader = new StringReader(code);327 Dom.ICompilationUnit newCompilationUnit;328 NRefactory.SupportedLanguage supportedLanguage;329 supportedLanguage = NRefactory.SupportedLanguage.CSharp;330 using (NRefactory.IParser p = NRefactory.ParserFactory.CreateParser(supportedLanguage, textReader)) {331 p.ParseMethodBodies = false;332 p.Parse();333 newCompilationUnit = ConvertCompilationUnit(p.CompilationUnit);334 }335 projectContent.UpdateCompilationUnit(lastCompilationUnit, newCompilationUnit, DummyFileName);336 lastCompilationUnit = newCompilationUnit;337 parseInformation.SetCompilationUnit(newCompilationUnit);338 337 } 339 338
Note: See TracChangeset
for help on using the changeset viewer.