Search in sources :

Example 1 with PerfDoubleClickAction

use of org.eclipse.linuxtools.internal.perf.ui.PerfDoubleClickAction in project linuxtools by eclipse.

the class ModelTest method testDoubleClickAction.

@Test
public void testDoubleClickAction() {
    TreeParent invisibleRoot = buildModel("resources/defaultevent-data/perf.data", "resources/defaultevent-data/perf.data.txt", "resources/defaultevent-data/perf.data.err.log");
    PerfPlugin.getDefault().setModelRoot(invisibleRoot);
    // update the model root for the view
    PerfCore.refreshView("resources/defaultevent-data/perf.data");
    // number of parents excluding invisibleRoot
    int numOfParents = getNumberOfParents(invisibleRoot) - 1;
    // create a double click action to act on the tree viewer
    try {
        PerfProfileView view = (PerfProfileView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PerfPlugin.VIEW_ID);
        TreeViewer tv = view.getTreeViewer();
        PerfDoubleClickAction dblClick = new PerfDoubleClickAction(tv);
        // double click every element
        doubleClickAllChildren(invisibleRoot, tv, dblClick);
        // If all elements are expanded, this is the number of elements
        // in our model that have children.
        assertEquals(numOfParents, tv.getExpandedElements().length);
    } catch (PartInitException e) {
        fail("Failed to open the Profiling View.");
    }
}
Also used : PerfProfileView(org.eclipse.linuxtools.internal.perf.ui.PerfProfileView) TreeParent(org.eclipse.linuxtools.internal.perf.model.TreeParent) TreeViewer(org.eclipse.jface.viewers.TreeViewer) PartInitException(org.eclipse.ui.PartInitException) PerfDoubleClickAction(org.eclipse.linuxtools.internal.perf.ui.PerfDoubleClickAction) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Aggregations

TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 TreeParent (org.eclipse.linuxtools.internal.perf.model.TreeParent)1 PerfDoubleClickAction (org.eclipse.linuxtools.internal.perf.ui.PerfDoubleClickAction)1 PerfProfileView (org.eclipse.linuxtools.internal.perf.ui.PerfProfileView)1 AbstractTest (org.eclipse.linuxtools.profiling.tests.AbstractTest)1 PartInitException (org.eclipse.ui.PartInitException)1 Test (org.junit.Test)1