Search in sources :

Example 6 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class ResourcesViewTest method testShowMarkers.

/**
 * Test "Show Markers" view menu
 */
@Test
public void testShowMarkers() {
    SWTBotView viewBot = getViewBot();
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);
    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();
    /* select first item */
    timeGraph.getEntry(LttngTraceGenerator.getName()).select();
    assertTrue(viewBot.viewMenu(LOST_EVENTS).isChecked());
    /* check that "Next Marker" and "Previous Marker" are enabled */
    assertTrue(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
    assertTrue(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());
    /* disable Lost Events markers */
    viewBot.viewMenu(LOST_EVENTS).click();
    /* check that "Next Marker" and "Previous Marker" are disabled */
    assertFalse(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
    assertFalse(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());
    /* enable Lost Events markers */
    viewBot.viewMenu(LOST_EVENTS).click();
    /* check that "Next Marker" and "Previous Marker" are enabled */
    assertTrue(viewBot.toolbarButton(NEXT_MARKER).isEnabled());
    assertTrue(viewBot.toolbarButton(PREVIOUS_MARKER).isEnabled());
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 7 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class ResourcesViewTest method testAddRemoveBookmark.

/**
 * Test tool bar button "Add Bookmark..." and "Remove Bookmark"
 */
@Test
public void testAddRemoveBookmark() {
    SWTBotView viewBot = getViewBot();
    /* change window range to 10 ms */
    TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE));
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    fBot.waitUntil(ConditionHelpers.windowRange(range));
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);
    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();
    /* select first CPU resource */
    timeGraph.getEntry(LttngTraceGenerator.getName(), CPU0_THREADS).select();
    /* click "Select Next State Change" 2 times */
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME1, CPU0_TIME1), CPU0_TIME1);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2);
    /* click "Add Bookmark..." and fill Add Bookmark dialog */
    viewBot.toolbarButton(ADD_BOOKMARK).click();
    SWTBot dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
    dialogBot.text().setText("B1");
    dialogBot.button(OK).click();
    /*
         * click "Select Next State Change" 2 times and shift-click "Select Next
         * State Change
         */
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME3, CPU0_TIME3), CPU0_TIME3);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4);
    viewBot.toolbarButton(SELECT_NEXT_STATE_CHANGE).click(SWT.SHIFT);
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);
    /* click "Add Bookmark..." and fill Add Bookmark dialog */
    viewBot.toolbarButton(ADD_BOOKMARK).click();
    dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
    dialogBot.text().setText("B2");
    dialogBot.button(OK).click();
    /* click "Previous Marker" */
    viewBot.toolbarButton(PREVIOUS_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME2, CPU0_TIME2), CPU0_TIME2);
    /* click "Remove Bookmark" */
    viewBot.toolbarButton(REMOVE_BOOKMARK).click();
    /* click "Next Marker" */
    viewBot.toolbarButton(NEXT_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);
    /* click "Remove Bookmark" */
    viewBot.toolbarButton(REMOVE_BOOKMARK).click();
    /* click "Previous Marker" */
    viewBot.toolbarButton(PREVIOUS_MARKER).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME5), CPU0_TIME5);
    /* click "Select Previous State Change" */
    viewBot.toolbarButton(SELECT_PREVIOUS_STATE_CHANGE).click();
    timeGraphIsReadyCondition(new TmfTimeRange(CPU0_TIME4, CPU0_TIME4), CPU0_TIME4);
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 8 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class ResourcesViewTest method testNextPreviousMarker.

private void testNextPreviousMarker(Runnable nextMarker, Runnable shiftNextMarker, Runnable previousMarker, Runnable shiftPreviousMarker) {
    SWTBotView viewBot = getViewBot();
    /* set selection to trace start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME), START_TIME);
    /* set focus on time graph */
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    timeGraph.setFocus();
    /* select first item */
    timeGraph.getEntry(LttngTraceGenerator.getName()).select();
    /* click "Next Marker" 3 times */
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2);
    nextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_TIME3);
    /* shift-click "Previous Marker" 3 times */
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME3), LOST_EVENT_TIME3);
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME2), LOST_EVENT_TIME2);
    shiftPreviousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_TIME1), LOST_EVENT_TIME1);
    /* shift-click "Next Marker" 3 times */
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END1), LOST_EVENT_END1);
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END2), LOST_EVENT_END2);
    shiftNextMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME3, LOST_EVENT_END3), LOST_EVENT_END3);
    /* click "Previous Marker" 3 times */
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME2, LOST_EVENT_END2), LOST_EVENT_TIME2);
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
    previousMarker.run();
    timeGraphIsReadyCondition(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1), LOST_EVENT_TIME1);
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)

Example 9 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class ResourcesViewTest method testMarkerAxis.

/**
 * Test the marker axis
 */
@Test
public void testMarkerAxis() {
    SWTBotView viewBot = getViewBot();
    /* center window range of first lost event range */
    ITmfTimestamp startTime = LOST_EVENT_TIME1.normalize(-10000000L, ITmfTimestamp.NANOSECOND_SCALE);
    ITmfTimestamp endTime = LOST_EVENT_END1.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE);
    TmfTimeRange range = new TmfTimeRange(startTime, endTime);
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
    fBot.waitUntil(ConditionHelpers.windowRange(range));
    /* set selection to window start time */
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, startTime));
    timeGraphIsReadyCondition(new TmfTimeRange(startTime, startTime), startTime);
    /* get marker axis size with one category */
    final TimeGraphMarkerAxis markerAxis = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphMarkerAxis.class));
    final Point size1 = getSize(markerAxis);
    /* add bookmark at window start time */
    viewBot.toolbarButton(ADD_BOOKMARK).click();
    SWTBot dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
    dialogBot.text().setText("B");
    dialogBot.button(OK).click();
    /* get marker axis size with two categories */
    final Point size2 = getSize(markerAxis);
    final int rowHeight = size2.y - size1.y;
    /*
         * get the state area bounds, since we don't know the name space width
         */
    final TimeGraphControl timeGraph = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class));
    int x0 = getXForTime(timeGraph, startTime.toNanos());
    int x1 = getXForTime(timeGraph, endTime.toNanos());
    /*
         * click at the center of the marker axis width and first row height, it
         * should be within the lost event range
         */
    final SWTBotCanvas markerAxisCanvas = new SWTBotCanvas(markerAxis);
    markerAxisCanvas.click((x0 + x1) / 2, TOP_MARGIN + rowHeight / 2);
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1)));
    /*
         * click near the left of the marker axis width and center of second row
         * height, it should be on the bookmark label
         */
    markerAxisCanvas.click(x0 + 2, TOP_MARGIN + rowHeight + rowHeight / 2);
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(startTime, startTime)));
    /* click "Remove Bookmark" */
    viewBot.toolbarButton(REMOVE_BOOKMARK).click();
    assertEquals(size1, getSize(markerAxis));
    /* click the 'expanded' icon to collapse */
    markerAxisCanvas.click(TOGGLE_SIZE.x / 2, TOGGLE_SIZE.y / 2);
    assertEquals(TOGGLE_SIZE.y, getSize(markerAxis).y);
    /* click the 'collapsed' icon to expand */
    markerAxisCanvas.click(TOGGLE_SIZE.x / 2, TOGGLE_SIZE.y / 2);
    assertEquals(size1, getSize(markerAxis));
    /* click on the 'X' icon to hide the 'Lost Events' marker category */
    markerAxisCanvas.click(TOGGLE_SIZE.x + HIDE_SIZE.x / 2, TOP_MARGIN + HIDE_SIZE.y / 2);
    assertEquals(0, getSize(markerAxis).y);
    /* show Lost Events markers */
    viewBot.viewMenu(LOST_EVENTS).click();
    SWTBotUtils.waitUntil(ma -> size1.equals(getSize(ma)), markerAxis, "Lost Events did not reappear");
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) TimeGraphControl(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TimeGraphMarkerAxis(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphMarkerAxis) Point(org.eclipse.swt.graphics.Point) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) SWTBotCanvas(org.eclipse.swtbot.swt.finder.widgets.SWTBotCanvas) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 10 with TmfSelectionRangeUpdatedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoader method selectionChanged.

@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    if ((sel != null) && (sel instanceof StructuredSelection)) {
        StructuredSelection stSel = (StructuredSelection) sel;
        if (stSel.getFirstElement() instanceof TmfSyncMessage) {
            TmfSyncMessage syncMsg = ((TmfSyncMessage) stSel.getFirstElement());
            ITmfTimestamp startTime = syncMsg.getStartTime();
            if (startTime == null) {
                startTime = TmfTimestamp.BIG_BANG;
            }
            broadcast(new TmfSelectionRangeUpdatedSignal(this, startTime, startTime, fTrace));
        }
    }
}
Also used : TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Aggregations

TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)41 Test (org.junit.Test)22 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)18 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)11 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)11 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)11 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)9 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)5 Action (org.eclipse.jface.action.Action)4 IAction (org.eclipse.jface.action.IAction)4 Point (org.eclipse.swt.graphics.Point)3 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)3 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)3 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 ISelection (org.eclipse.jface.viewers.ISelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)2 DefaultCondition (org.eclipse.swtbot.swt.finder.waits.DefaultCondition)2 SWTBotCheckBox (org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox)2 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)2