Exemplo n.º 1
0
        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();
                }
            };
        }
Exemplo n.º 2
0
        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, SourceCodeEditor codeEditor)
 {
     if (o2CodeStream != null)
     {
         codeEditor.open(o2CodeStream.SourceFile);
         codeEditor.colorINodes(o2CodeStream.iNodes());
     }
     return o2CodeStream;
 }
Exemplo n.º 4
0
        public void loadFiles(string filesPath, List <string> filesToLoad)
        {
            sourceCode.set_Text("Loading files from: {0}".format(filesPath));
            Path.set_Text(filesPath);
            var filesContent   = new Dictionary <string, string>();
            var nonBinaryFiles = new List <string>();

            foreach (var file in filesToLoad)
            {
                if (file.isBinaryFormat().isFalse())
                {
                    nonBinaryFiles.add(file);
                }
            }

            foreach (var file in nonBinaryFiles)
            {
                filesContent.add(file.remove(filesPath), file.contents());
            }

            searchEngine = new SearchEngine();
            searchEngine.loadFiles(nonBinaryFiles);

            //searchEngine.fixH2FileLoadingIssue();

            leftPanel.clear();
            treeView = leftPanel.add_TreeViewWithFilter(filesContent);
            treeView.afterSelect <string>(
                (fileContents) => {
                sourceCode.open(filesPath + treeView.selected().get_Text());
            });
            sourceCode.colorCodeForExtension(treeView.selected().str());
            sourceCode.set_Text("");
            textSearch_TextBox = leftPanel.controls <TextBox>(true)[1];
            textSearch_TextBox.onEnter(
                (text) => {
                var searchResults = searchEngine.searchFor(text);
                SearchUtils.loadInDataGridView_textSearchResults(searchResults, dataGridView);
            });
        }
        public static ascx_FindingsViewer set_CodeEditor(this ascx_FindingsViewer findingsViewer, 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;							
        }