public void buildGui() { var topPanel = this.add_Panel(); Path = topPanel.insert_Above<TextBox>(20); sourceCode = topPanel.add_SourceCodeEditor(); dataGridView = sourceCode.insert_Above<Panel>(100).add_DataGridView(); leftPanel = topPanel.insert_Left<Panel>(300); Path.onEnter(loadFiles); Path.onDrop( (fileOrFolder)=>{ Path.set_Text(fileOrFolder); loadFiles(fileOrFolder); }); dataGridView.SelectionChanged+= (sender,e) => { if (dataGridView.SelectedRows.size() == 1) { var selectedRow = dataGridView.SelectedRows[0]; var filePath = selectedRow.Cells[0].Value.str(); var filename = selectedRow.Cells[1].Value.str(); var lineNumber = selectedRow.Cells[2].Value.str(); "opening up source code: {0}".info(filePath); sourceCode.open(filePath.pathCombine(filename)); sourceCode.gotoLine(lineNumber.toInt() + 1); dataGridView.focus(); } }; }
public static O2CodeStream show(this O2CodeStream o2CodeStream, ascx_SourceCodeEditor codeEditor) { if (o2CodeStream != null) { codeEditor.open(o2CodeStream.SourceFile); codeEditor.colorINodes(o2CodeStream.iNodes()); } //var iNodes = //var file = o2CodeStream.O2MappedAstData.file(node.INode); //if (iNodes.size() > 0 //{ //} /*foreach(var node in o2CodeStream.Nodes) { var file = o2CodeStream.O2MappedAstData.file(node.INode); "{0}".format(file).error(); codeEditor.open(file); codeEditor.selectTextWithColor( //return o2CodeStream; }*/ return o2CodeStream; }
public static ascx_FindingsViewer set_CodeEditor(this ascx_FindingsViewer findingsViewer, ascx_SourceCodeEditor codeEditor) { findingsViewer._onTraceSelected += (trace)=>{ codeEditor.show(trace); findingsViewer.controls<ascx_TraceTreeView>().focus(); }; findingsViewer._onFindingSelected += (finding)=> { findingsViewer.invokeOnThread( ()=>{ codeEditor.textEditor().LineViewerStyle = ICSharpCode.TextEditor.Document.LineViewerStyle.None; codeEditor.open(finding.file); //"Going to line: {0}".info(finding.lineNumber); codeEditor.editor().gotoLine((int)finding.lineNumber); }); O2Thread.mtaThread( ()=>{ findingsViewer.sleep(100,false); findingsViewer.getResultsTreeView().focus(); }); }; return findingsViewer; }