public static TreeView CreateTreeViewFor_MethodMappingsView(this Control targetControl, ascx_SourceCodeViewer sourceCodeViewer)
        {
            targetControl.clear();
            var treeView = targetControl.add_TreeView()
                           .sort();

            Action <MethodMapping> showMethodMapping =
                (methodMapping) => {
                if (methodMapping.File.valid())
                {
                    sourceCodeViewer.open(methodMapping.File);
                    sourceCodeViewer.editor().clearMarkers();
                    sourceCodeViewer.editor().caret(methodMapping.Start_Line, methodMapping.Start_Column);
                    sourceCodeViewer.editor().selectTextWithColor(methodMapping.Start_Line,
                                                                  methodMapping.Start_Column,
                                                                  methodMapping.End_Line,
                                                                  methodMapping.End_Column);
                }
            };

            treeView.afterSelect <MethodMapping>(showMethodMapping);
            treeView.afterSelect <List <MethodMapping> >(
                (methodMappings) => showMethodMapping(methodMappings[0]));

            return(treeView);
        }
Esempio n. 2
0
        public ascx_HtmlTagViewer buildGui(bool addLoadUrlTextBox, bool addHtmlCodeViewer)
        {
            //return (ascx_HtmlTagViewer)this.invokeOnThread(
            //	()=>{
            var TopPanel = this.add_Panel();

            HtmlTags_TreeView = TopPanel.add_TreeView_for_HtmlTags()
                                .showSelection();

            if (addHtmlCodeViewer)
            {
                HtmlCodeViewer = HtmlTags_TreeView.insert_Left <Panel>(TopPanel.width() / 2).add_SourceCodeViewer();

                HtmlTags_TreeView.after_TagSelect_showIn_SouceCodeViewer(HtmlCodeViewer);

                var optionsPanel = HtmlCodeViewer.insert_Below <Panel>(50);
                optionsPanel.add_CheckBox("View as Xml", 0, 5,
                                          (value) => {
                    ViewAsXml = value;
                    reloadPage();
                })
                .append_Label("Search html code:")
                .top(5)
                .append_TextBox("")
                .onTextChange((text) => HtmlCodeViewer.editor().invoke("searchForTextInTextEditor_findNext", text))
                .onEnter((text) => HtmlCodeViewer.editor().invoke("searchForTextInTextEditor_findNext", text))
                .align_Right(optionsPanel);

                optionsPanel.add_Link("Refresh tags", 30, 0, () => show(HtmlCodeViewer.get_Text()));
            }

            if (addLoadUrlTextBox)
            {
                PageToOpen = TopPanel.insert_Above <Panel>(20).add_TextBox().fill();
                var propertyGrid = HtmlTags_TreeView.insert_Right <Panel>(150).add_PropertyGrid();


                HtmlTags_TreeView.afterSelect <HtmlAgilityPack.HtmlNode>(
                    (htmlNode) => propertyGrid.show(htmlNode));

                PageToOpen.onEnter(
                    (text) => {
                    if (text.fileExists())
                    {
                        show(text.fileContents());
                    }
                    else
                    {
                        show(text.uri());
                    }
                });
            }

            HtmlNodeFilter = HtmlTags_TreeView.insert_Below_HtmlTagFilter((filter) => show(HtmlCode, filter));

            return(this);
            //});
        }
Esempio n. 3
0
 public static SourceCodeDescriptor highlightInCode(this SourceCodeDescriptor sourceCodeDescriptor, ascx_SourceCodeViewer codeViewer)
 {
     if (sourceCodeDescriptor != null)
     {
         var start = sourceCodeDescriptor.Start;
         var stop  = sourceCodeDescriptor.Stop;
         codeViewer.editor().selectTextWithColor(start.Line, start.Char + 1, stop.Line, stop.Char + 1);
         codeViewer.editor().caret(start.Line, start.Char + 1);
     }
     return(sourceCodeDescriptor);
 }
Esempio n. 4
0
 public static ascx_SourceCodeViewer show(this ascx_SourceCodeViewer codeViewer, IO2Trace o2Trace)
 {
     "in show".info();
     codeViewer.open(o2Trace.file);
     if (o2Trace.lineNumber > 0)
     {
         codeViewer.editor().gotoLine((int)o2Trace.lineNumber - 1);
         //codeViewer.editor().caret_Line();
         codeViewer.editor().caret_Line((int)o2Trace.lineNumber - 1);
         codeViewer.editor().caret_Column((int)o2Trace.columnNumber);
     }
     return(codeViewer);
 }
Esempio n. 5
0
 public static Statement highlightInCode(this Statement statement, ascx_SourceCodeViewer codeViewer)
 {
     //"expression: {0}".info(statement);
     codeViewer.editor().clearBookmarksAndMarkers();
     if (statement.Source.notNull())
     {
         statement.Source.highlightInCode(codeViewer);
     }
     else
     {
         statement.firstSourceCodeReference().highlightInCode(codeViewer);
     }
     codeViewer.editor().refresh();
     return(statement);
 }
        private void buildGui()
        {
            //var groupBoxes = this.add_SplitContainer_2x2("Directory","WebEditor","Config","HtmlCode",true, 100,40,40);
            var groupBoxes = this.add_1x1("WebEditor (Edit on page)", "HtmlCode (see results in code)");

            browser  = groupBoxes[0].add_WebBrowserWithLocationBar();
            htmlCode = groupBoxes[1].add_SourceCodeViewer();
            //directory = groupBoxes[0].add_Directory(startDir);
            //browser = groupBoxes[1].add_WebBrowserWithLocationBar();
            //htmlCode = groupBoxes[3].add_SourceCodeViewer();
            htmlCode.astDetails(false);

            // build config

            /*groupBoxes[2].add_Link("toggle edit mode", 20 ,10,()=> setEditMode(!getEditMode()) );
             * groupBoxes[2].add_Link("refresh", 40 ,10,()=> updateHtmlPage() );
             * groupBoxes[2].add_Link("take screenshot", 60 ,10,()=> takeScreenShot() );
             *
             * pictureBox = groupBoxes[2].add_PictureBox(70,10);
             * pictureBox.anchor_All();
             * takeScreenShot();
             * // setup controls events
             * directory._onDirectoryDoubleClick+=selectedFileOrFolder;
             */
            browser.onDocumentCompleted += onDocumentCompleted;
            //htmlCode.eDocumentDataChanged += htmlTextChanged;
            // fine tune loaded controls behaviour
            //directory._WatchFolder = true;
            //directory.AllowDrop = false;
            htmlCode.editor().colorCodeForExtension(".html");

            // remove on next code Sync
            ((O2BrowserIE)browser).AllowWebBrowserDrop = false;
        }
 public static ascx_SourceCodeViewer astDetails(this ascx_SourceCodeViewer sourceCodeViewer, bool value)
 {
     sourceCodeViewer.invokeOnThread(() =>
     {
         sourceCodeViewer.editor()._ShowSearchAndAstDetails = value;
     });
     return(sourceCodeViewer);
 }
 public static ascx_SourceCodeViewer set_ColorsForCSharp(this ascx_SourceCodeViewer sourceCodeViewer)
 {
     sourceCodeViewer.invokeOnThread(() =>
     {
         sourceCodeViewer.editor().setDocumentHighlightingStrategy("aa.cs");
     });
     return(sourceCodeViewer);
 }
Esempio n. 9
0
            public void buildGui()
            {
                AstEngine.HostPanel.clear();

                var topPanel = AstEngine.HostPanel.add_1x1("Methods & Parameters", "Source Code", true, 400);

                //CodeViewer = topPanel[1].add_SourceCodeViewer();

                var tabControl = topPanel[1].add_TabControl();

                CodeViewer = tabControl.add_Tab("Source Code").add_SourceCodeViewer();

                CodeStreamTreeViewTab = tabControl.add_Tab("CodeStream TreeView");
                CodeStreamGraphTab    = tabControl.add_Tab("CodeStream Graph");
                CodeStreamCodeViewer  = CodeStreamTreeViewTab.add_SourceCodeViewer();
                CodeStreamTreeView    = CodeStreamCodeViewer.insert_Left <TreeView>(200);
                CodeStreamGraphPanel  = CodeStreamGraphTab.add_Panel().backColor(Color.White);
                CodeStreamGraph       = CodeStreamGraphPanel.add_Graph();
                CodeStreamGraphScript = CodeStreamGraphPanel.insert_Below <Panel>().add_Script();
                CodeStreamTreeView.afterSelect <O2CodeStreamNode>
                    ((streamNode) => CodeStreamCodeViewer.editor().setSelectionText(streamNode.INode.StartLocation, streamNode.INode.EndLocation));

                MethodsTreeView = topPanel[0].add_TreeView()
                                  .sort()
                                  .showSelection();

                MethodsTreeView.insert_Above <TextBox>(20).onTextChange_AlertOnRegExFail()
                .onEnter((value) => {
                    MethodsFilter = value;
                    loadDataInGui();
                });
                MethodsTreeView.afterSelect <IMethod>(
                    (iMethod) =>
                {
                    createMethodStreamAndShowInGui(iMethod);
                });

                var optionsPanel = MethodsTreeView.insert_Below <Panel>(25);

                optionsPanel.add_CheckBox("Open Graph in New Window", 0, 0, (value) => ShowGraphInNewWindow = value)
                .autoSize();

                optionsPanel.add_CheckBox("Join Graph Data", 0, 200, (value) => JoinGraphData = value)
                .autoSize().bringToFront();

                ParametersTreeView    = MethodsTreeView.insert_Below <TreeView>(100);
                MethodsCalledTreeView = ParametersTreeView.insert_Right <TreeView>(200);

                AstData_MethodStream.afterSelect_ShowInSourceCodeEditor(MethodsCalledTreeView, CodeViewer.editor());
                AstData_MethodStream.afterSelect_ShowInSourceCodeEditor(ParametersTreeView, CodeViewer.editor());

                MethodsCalledTreeView.afterSelect <INode>((iNode) => createAndShowCodeStream(iNode));
                ParametersTreeView.afterSelect <INode>((iNode) => createAndShowCodeStream(iNode));

                MethodsTreeView.beforeExpand_PopulateWithList <ISpecial>();
            }
 public void refresh_AllCodeStreams_TreeView()
 {
     codeStreams.clear();
     codeStreams.add_Nodes(savedMethodStream.CodeStreams, (codeStream) => codeStream.CodeStreamPaths.size() > 0);
     codeViewer.editor().clearMarkers();
     O2.DotNetWrappers.DotNet.O2Thread.mtaThread(
         () => {
         codeStreams.selectFirst();
     });
 }
 public static TreeView afterSelect_ShowMethodSignatureInSourceCode(this TreeView treeView, O2MappedAstData astData, ascx_SourceCodeViewer codeViewer)
 {
     treeView.afterSelect(
         (treeNode) =>
     {
         var text = WinForms_ExtensionMethods_TreeView.get_Text(treeNode);
         var methodDeclaration = astData.methodDeclaration_withSignature(treeNode.get_Text());
         if (methodDeclaration != null)
         {
             treeNode.color(Color.DarkGreen);
             var file = astData.file(methodDeclaration);
             codeViewer.open(file);
             codeViewer.editor().clearBookmarksAndMarkers();
             codeViewer.editor().setSelectionText(methodDeclaration.StartLocation, methodDeclaration.EndLocation);
         }
         else
         {
             treeNode.color(Color.Red);
         }
     });
     return(treeView);
 }
Esempio n. 12
0
 public static TreeView after_TagSelect_showIn_SouceCodeViewer(this TreeView htmlTags_TreeView, ascx_SourceCodeViewer htmlCodeViewer)
 {
     htmlTags_TreeView.afterSelect <HtmlAgilityPack.HtmlNode>(
         (htmlNode) => {
         try
         {
             htmlCodeViewer.showHtmlNodeLocation(htmlNode);
             htmlCodeViewer.editor().caret(htmlNode.Line, htmlNode.LinePosition);
         }
         catch (Exception ex)
         {
             "[after_TagSelect_showIn_SouceCodeViewer] Error: {0}".error(ex.Message);
         }
     });
     return(htmlTags_TreeView);
 }
        public static TreeView getTreeViewToShowMethodsMappings(this O2MappedAstData astData, Control control, ascx_SourceCodeViewer sourceCodeViewer)
        {
            // create GUI
            control.clear();
            var treeView = control.add_TreeView()
                           .showSelection()
                           .sort();

            astData.afterSelect_ShowInSourceCodeEditor(treeView, sourceCodeViewer.editor());
            treeView.afterSelect <IMethod>(
                (iMethod) =>
            {
                var methodDeclaration = astData.MapAstToNRefactory.IMethodToMethodDeclaration[iMethod];
                sourceCodeViewer.set_Text(methodDeclaration.csharpCode());
            });
            return(treeView);
        }
 public static ascx_SourceCodeViewer gotoLine(this ascx_SourceCodeViewer codeViewer, int line, int showLinesBelow)
 {
     codeViewer.editor().gotoLine(line, showLinesBelow);
     return(codeViewer);
 }
 public static ascx_SourceCodeViewer gotoLine(this ascx_SourceCodeViewer codeViewer, int line)
 {
     codeViewer.editor().gotoLine(line);
     return(codeViewer);
 }
 public static ascx_SourceCodeViewer open(this ascx_SourceCodeViewer codeViewer, string file, int line)
 {
     codeViewer.editor().open(file, line);
     return(codeViewer);
 }
 public static ascx_SourceCodeViewer onTextChange(this ascx_SourceCodeViewer codeViewer, Action <string> callback)
 {
     codeViewer.editor().onTextChange(callback);
     return(codeViewer);
 }
Esempio n. 18
0
 public static ascx_TraceTreeView afterSelect_ShowTraceInCodeViewer(this ascx_TraceTreeView traceViewer, ascx_SourceCodeViewer codeViewer)
 {
     return(traceViewer.afterSelect_ShowTraceInCodeEditor(codeViewer.editor()));
 }
Esempio n. 19
0
 public static ascx_SourceCodeViewer show(this ascx_SourceCodeViewer codeViewer, IO2Trace o2Trace)
 {
     codeViewer.editor().show(o2Trace);
     return(codeViewer);
 }
 public static TextEditorControl textEditorControl(this ascx_SourceCodeViewer sourceCodeViewer)
 {
     return(sourceCodeViewer.editor().getObject_TextEditorControl());
 }
Esempio n. 21
0
 public static ascx_FindingsViewer set_CodeViewer(this ascx_FindingsViewer findingsViewer, ascx_SourceCodeViewer codeViewer)
 {
     return(findingsViewer.set_CodeEditor(codeViewer.editor()));
 }
 public static O2CodeCompletion updateCodeComplete(this ascx_SourceCodeViewer sourceCodeViewer, CSharp_FastCompiler csharpFastCompiler)
 {
     return(sourceCodeViewer.editor().updateCodeComplete(csharpFastCompiler));
 }
 public static ascx_SourceCodeViewer load(this ascx_SourceCodeViewer codeViewer, string fileOrCode)
 {
     codeViewer.editor().load(fileOrCode);
     return(codeViewer);
 }
 public static Caret caret(this ascx_SourceCodeViewer codeViewer)
 {
     return(codeViewer.editor().caret());
 }
 public static ascx_SourceCodeViewer set_Text(this ascx_SourceCodeViewer codeViewer, string text, string highlightForExtension)
 {
     codeViewer.editor().set_Text(text, highlightForExtension);
     return(codeViewer);
 }
Esempio n. 26
0
 public static ascx_SourceCodeViewer show(this ascx_SourceCodeViewer codeViewer, IO2Finding o2Finding)
 {
     codeViewer.editor().show(o2Finding);
     return(codeViewer);
 }
        public ascx_CodeStreams buildGui()
        {
            codeViewer       = this.add_SourceCodeViewer();
            codeStreams      = codeViewer.insert_Right().add_GroupBox("All Code Streams").add_TreeView();
            codeStreamViewer = codeStreams.parent().insert_Below().add_GroupBox("Selected Code Stream").add_TreeView();
            //var codeStreamViewer = topPanel.insert_Right().add_TreeView();

            Action <TreeNode, CodeStreamPath> add_CodeStreamPath = null;

            add_CodeStreamPath =
                (treeNode, codeStreamPath) => {
                var newNode = treeNode.add_Node(codeStreamPath);
                foreach (var childPath in codeStreamPath.CodeStreamPaths)
                {
                    add_CodeStreamPath(newNode, childPath);
                }
            };

            Action <TreeView, CodeStreamPath> showCodeStreamPath =
                (treeView, codeStreamPath) => {
                treeView.clear();
                add_CodeStreamPath(treeView.rootNode(), codeStreamPath);
                treeView.expandAll();
                treeView.selectFirst();
            };

            Action <ascx_SourceCodeEditor, CodeStreamPath, bool> colorCodePath =
                (codeEditor, codeStreamPath, clearMarkers) =>
            {
                if (codeEditor.getSourceCode().inValid() || codeStreamPath.Line == 0 && codeStreamPath.Column == 0)
                {
                    return;
                }
                try
                {
                    if (clearMarkers)
                    {
                        codeEditor.clearMarkers();
                        codeEditor.caret(codeStreamPath.Line, codeStreamPath.Column);
                    }
                    codeEditor.selectTextWithColor(codeStreamPath.Line,
                                                   codeStreamPath.Column,
                                                   codeStreamPath.Line_End,
                                                   codeStreamPath.Column_End);
                    codeEditor.refresh();
                }
                catch (Exception ex)
                {
                    ex.log();
                }
            };

            Action <ascx_SourceCodeEditor, List <CodeStreamPath> > colorCodePaths =
                (codeEditor, codeStreamPaths) => {
                foreach (var codeStreamPath in codeStreamPaths)
                {
                    colorCodePath(codeEditor, codeStreamPath, false);
                }
            };

            Action <TreeView, ascx_SourceCodeEditor> set_AfterSelect_SyncWithCodeEditor =
                (treeView, codeEditor) => {
                treeView.afterSelect <CodeStreamPath>(
                    (codeStreamPath) => colorCodePath(codeEditor, codeStreamPath, true));
            };


            set_AfterSelect_SyncWithCodeEditor(codeStreams, codeViewer.editor());
            set_AfterSelect_SyncWithCodeEditor(codeStreamViewer, codeViewer.editor());

            codeStreams.afterSelect <CodeStreamPath>(
                (codeStreamPath) => showCodeStreamPath(codeStreamViewer, codeStreamPath));


            codeStreams.beforeExpand <CodeStreamPath>(
                (treeNode, codeStreamPath) => {
                treeNode.add_Nodes(codeStreamPath.CodeStreamPaths, (codeStream) => codeStream.CodeStreamPaths.size() > 0);
            });


            codeViewer.onClick(
                () => {
                if (savedMethodStream.notNull())
                {
                    codeViewer.editor().clearMarkers();
                    codeStreamViewer.clear();
                    codeStreams.clear();
                    var line   = codeViewer.caret().Line + 1;
                    var column = codeViewer.caret().Column + 1;
                    CodeStreamPath lastMatch = null;
                    foreach (var codeStreamPath in savedMethodStream.CodeStreams)
                    {
                        if (codeStreamPath.Line <= line && codeStreamPath.Line_End >= line &&
                            codeStreamPath.Column <= column && codeStreamPath.Column_End >= column)
                        {
                            codeStreams.add_Node(codeStreamPath);
                            lastMatch = codeStreamPath;
                        }
                    }
                    if (lastMatch.notNull())
                    {
                        showCodeStreamPath(codeStreamViewer, lastMatch);
                        var codeStreamPaths = (from node in codeStreamViewer.allNodes()
                                               select(CodeStreamPath) node.get_Tag()).toList();
                        colorCodePaths(codeViewer.editor(), codeStreamPaths);
                    }
                    else
                    {
                        refresh_AllCodeStreams_TreeView();
                    }
                }
            });
            return(this);
        }
 public static ascx_SourceCodeViewer onCaretMove(this ascx_SourceCodeViewer codeViewer, Action <Caret> callback)
 {
     codeViewer.editor().onCaretMove(callback);
     return(codeViewer);
 }
Esempio n. 29
0
 public static ascx_SourceCodeViewer showInCodeViewer(this ascx_SourceCodeViewer codeViewer, Java_Class _class, Java_Method method)
 {
     codeViewer.editor().showInCodeEditor(_class, method);
     return(codeViewer);
 }
Esempio n. 30
0
 public static ascx_SourceCodeViewer showHtmlNodeLocation(this ascx_SourceCodeViewer codeViewer, HtmlAgilityPack.HtmlNode htmlNode)
 {
     codeViewer.editor().showHtmlNodeLocation(htmlNode);
     return(codeViewer);
 }