Search in sources :

Example 1 with StapGraphParser

use of org.eclipse.linuxtools.internal.callgraph.StapGraphParser in project linuxtools by eclipse.

the class MouseListenerTest method test.

@Test
public void test() {
    StapGraphParser parse = new StapGraphParser();
    parse.setSourcePath(Activator.getPluginLocation() + "eag.graph");
    parse.testRun(new NullProgressMonitor(), true);
    CallgraphView cView = (CallgraphView) ViewFactory.createView("org.eclipse.linuxtools.callgraph.callgraphview");
    StapUIJob j = new StapUIJob("Test Graph UI Job", parse, CallGraphConstants.VIEW_ID);
    j.runInUIThread(new NullProgressMonitor());
    StapGraphMouseListener mListener = cView.getGraph().getMouseListener();
    StapGraph g = cView.getGraph();
    g.setProject(parse.project);
    GraphItem[] nodes = { g.getNode(g.getFirstUsefulNode()) };
    g.setSelection(nodes);
    mListener.mouseDownEvent(0, 0);
    g.draw(StapGraph.CONSTANT_DRAWMODE_TREE, StapGraph.CONSTANT_ANIMATION_FASTEST, g.getFirstUsefulNode());
    mListener.mouseUp(null);
}
Also used : StapGraphParser(org.eclipse.linuxtools.internal.callgraph.StapGraphParser) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) StapGraphMouseListener(org.eclipse.linuxtools.internal.callgraph.graphlisteners.StapGraphMouseListener) CallgraphView(org.eclipse.linuxtools.internal.callgraph.CallgraphView) GraphItem(org.eclipse.zest.core.widgets.GraphItem) StapUIJob(org.eclipse.linuxtools.internal.callgraph.core.StapUIJob) StapGraph(org.eclipse.linuxtools.internal.callgraph.StapGraph) Test(org.junit.Test)

Example 2 with StapGraphParser

use of org.eclipse.linuxtools.internal.callgraph.StapGraphParser in project linuxtools by eclipse.

the class StapGraphParserTest method initializeGraph.

// RENDER THE GRAPH
public static StapGraphParser initializeGraph(String filePath) {
    StapGraphParser grph = new StapGraphParser();
    grph.setSourcePath(filePath);
    grph.nonRealTimeParsing();
    return grph;
}
Also used : StapGraphParser(org.eclipse.linuxtools.internal.callgraph.StapGraphParser)

Example 3 with StapGraphParser

use of org.eclipse.linuxtools.internal.callgraph.StapGraphParser in project linuxtools by eclipse.

the class SystemTapGraphTest method testGraphLoading.

@Test
public void testGraphLoading() {
    StapGraphParser parse = new StapGraphParser();
    parse.setSourcePath(Activator.getPluginLocation() + "eag.graph");
    assertEquals(Status.OK_STATUS, parse.testRun(new NullProgressMonitor(), true));
    StapUIJob j = new StapUIJob("Test Graph UI Job", parse, CallGraphConstants.VIEW_ID);
    j.runInUIThread(new NullProgressMonitor());
    CallgraphView cView = (CallgraphView) ViewFactory.createView(CallGraphConstants.VIEW_ID);
    if (!manual) {
        ArrayList<String> tasks = new ArrayList<>();
        tasks.add("(Manually) Maximize CallgraphView");
        tasks.add("Refresh");
        tasks.add("Tree View");
        tasks.add("Aggregate View");
        tasks.add("Box View");
        tasks.add("Animation->Fast");
        tasks.add("Collapse");
        tasks.add("Uncollapse");
        tasks.add("Radial View");
        tasks.add("Collapse.");
        tasks.add("(Manually) Double-click node with no children in TreeViewer");
        tasks.add("(Manually) Expand an arrow in the TreeViewer");
        tasks.add("(Manually) Collapse an arrow in the TreeViewer");
        tasks.add("Save file");
        tasks.add("Reload file");
        tasks.add("Maximize");
        for (int taskNumber = 0; taskNumber < tasks.size(); taskNumber++) {
            Action act = null;
            switch(taskNumber) {
                case 1:
                    break;
                case 2:
                    act = cView.getViewRefresh();
                    break;
                case 3:
                    act = cView.getViewTreeview();
                    break;
                case 4:
                    act = cView.getViewAggregateview();
                    break;
                case 5:
                    act = cView.getViewLevelview();
                    break;
                case 6:
                    act = cView.getAnimationFast();
                    break;
                case 7:
                case 8:
                    act = cView.getModeCollapsednodes();
                    break;
                case 9:
                    act = cView.getViewRadialview();
                    break;
                case 10:
                    act = cView.getModeCollapsednodes();
                    break;
                case 14:
                    String tempLocation = Activator.getPluginLocation() + "eag.graph2";
                    File temp = new File(tempLocation);
                    temp.delete();
                    cView.saveData(tempLocation);
                    temp.delete();
                    break;
                case 15:
                    StapGraphParser new_parser = new StapGraphParser();
                    new_parser.setSourcePath(Activator.getPluginLocation() + "eag.graph");
                    new_parser.testRun(new NullProgressMonitor(), true);
                    break;
                case 16:
                    cView.maximizeIfUnmaximized();
                    break;
                default:
                    break;
            }
            if (act != null) {
                act.run();
            }
        }
        return;
    }
}
Also used : StapGraphParser(org.eclipse.linuxtools.internal.callgraph.StapGraphParser) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Action(org.eclipse.jface.action.Action) CallgraphView(org.eclipse.linuxtools.internal.callgraph.CallgraphView) ArrayList(java.util.ArrayList) StapUIJob(org.eclipse.linuxtools.internal.callgraph.core.StapUIJob) File(java.io.File) Test(org.junit.Test)

Example 4 with StapGraphParser

use of org.eclipse.linuxtools.internal.callgraph.StapGraphParser in project linuxtools by eclipse.

the class StapGraphParserTest method executeGraphTests.

// FOR TESTING THE GRAPH PARSING
public void executeGraphTests() {
    StapGraphParser grph = StapGraphParserTest.initializeGraph(graphDataPath);
    StapGraphParserTest.assertSanity(grph);
    StapGraphParserTest.assertTimes(grph);
    StapGraphParserTest.assertConnectedness(grph);
}
Also used : StapGraphParser(org.eclipse.linuxtools.internal.callgraph.StapGraphParser)

Aggregations

StapGraphParser (org.eclipse.linuxtools.internal.callgraph.StapGraphParser)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 CallgraphView (org.eclipse.linuxtools.internal.callgraph.CallgraphView)2 StapUIJob (org.eclipse.linuxtools.internal.callgraph.core.StapUIJob)2 Test (org.junit.Test)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Action (org.eclipse.jface.action.Action)1 StapGraph (org.eclipse.linuxtools.internal.callgraph.StapGraph)1 StapGraphMouseListener (org.eclipse.linuxtools.internal.callgraph.graphlisteners.StapGraphMouseListener)1 GraphItem (org.eclipse.zest.core.widgets.GraphItem)1