Ejemplo n.º 1
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>();
            }
Ejemplo n.º 2
0
        public ascx_ManualMethodStreams buildGui(bool addLogViewer)
        {
            //AstEngine.HostPanel.clear();
            var topPanel   = this.add_1x1("Methods & Parameters", "Source Code", true);
            var tabControl = topPanel[1].add_TabControl();

            //CodeViewer = tabControl.add_Tab("Source Code").add_SourceCodeViewer();
            CodeViewer = topPanel[0].add_SourceCodeViewer();
            CodeViewer.editor().colorCodeForExtension(".cs");
            CodeStreamTreeViewTab = tabControl.add_Tab("CodeStream TreeView");
            TaintRulesTab         = tabControl.add_Tab("Taint Rules");
            //CodeStreamGraphTab = tabControl.add_Tab("CodeStream Graph");
            //CodeStreamGraphTab.backColor(Color.White);
            //CodeStreamCodeViewer = CodeStreamTreeViewTab.add_SourceCodeViewer();
            //CodeStreamTreeView = CodeStreamCodeViewer.insert_Left<TreeView>(200);
            CodeStreamTreeView = CodeStreamTreeViewTab.add_TreeView();
            TaintRulesList     = TaintRulesTab.add_GroupBox("Taint Propagators").add_TextArea();
            //CodeStreamGraph = CodeStreamGraphTab.add_Panel().add_Graph();

            ParametersTreeView = CodeViewer.insert_Below <TreeView>(100)
                                 .showSelection()
                                 .sort();
            MethodsCalledTreeView = ParametersTreeView.insert_Right <TreeView>(250)
                                    .showSelection()
                                    .sort();
            var commandsPanel = CodeViewer.insert_Below <Panel>(20);

            SaveCodeLink      = commandsPanel.add_Link("save code", 0, 0, () => saveEditorContents());
            showINodeLink     = commandsPanel.add_Link("show INode CodeStream", 0, 60, () => showCurrentINodeCodeStream());
            CurrentINodeLabel = commandsPanel.add_Label("current INode: ", 0, 200);
            commandsPanel.add_Label("Search:", 0, 350)
            .top(2)
            .append_TextBox("")
            .top(0)
            .onTextChange((text) => CodeViewer.editor().invoke("searchForTextInTextEditor_findNext", text))
            .onEnter((text) => CodeViewer.editor().invoke("searchForTextInTextEditor_findNext", text))
            .align_Right(commandsPanel);

            // context menu

            CodeStreamTreeView.add_ContextMenu()
            .add_MenuItem("Expand Selectd Node",
                          () => {
                var selectedNode = CodeStreamTreeView.selected();
                if (selectedNode.notNull())
                {
                    selectedNode.ExpandAll();
                }
                selectedNode.selected();
            });

            /*MethodsCalledTreeView.add_ContextMenu()
             *                                   .add_MenuItem("Show Method Stream Details", ()=> showMethodStreamDetails(CodeViewer.get_Text()));
             */
            //events

            CodeStreamTreeView.afterSelect <O2CodeStreamNode>
                ((streamNode) => CodeViewer.editor().setSelectionText(streamNode.INode.StartLocation, streamNode.INode.EndLocation));

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

            CodeViewer.onCaretMove((caret) => findINodeAtCaretLocation(caret));
            //CodeViewer.editor().eDocumentDataChanged += (text)=> saveEditorContents();
            if (addLogViewer)
            {
                this.insert_Below <Panel>(100).add_LogViewer();
            }

            commandsPanel.onDrop(
                (file) => {
                if (file.fileExists())
                {
                    loadFile(file);
                }
            });

            loadDefaultTaintRules();
            return(this);
        }