Changeset 2719
- Timestamp:
- 01/29/10 14:33:03 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.CodeEditor/3.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CodeEditor/3.2/CodeEditor.Designer.cs
r2672 r2719 12 12 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 13 13 protected override void Dispose(bool disposing) { 14 if (InvokeRequired) { 15 Invoke(new Action(() => this.Dispose(disposing))); 16 } else { 17 if (disposing) { 18 if (components != null) { 19 components.Dispose(); 20 } 14 runParser = false; 15 if (disposing) { 16 if (components != null) { 17 components.Dispose(); 21 18 } 22 base.Dispose(disposing);23 19 } 20 base.Dispose(disposing); 24 21 } 25 22 -
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.