Search in sources :

Example 6 with SWTBotRootMenu

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.

the class SWTBotTimeGraphEntry method contextMenu.

@Override
protected SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException {
    Rectangle bounds = absoluteLocation();
    if (bounds == null) {
        return null;
    }
    UIThreadRunnable.syncExec(new VoidResult() {

        @Override
        public void run() {
            final Event event = new Event();
            event.time = (int) System.currentTimeMillis();
            event.display = control.getDisplay();
            event.widget = control;
            event.x = bounds.x + widget.getTimeDataProvider().getNameSpace() / 2;
            event.y = bounds.y + bounds.height / 2;
            control.notifyListeners(SWT.MenuDetect, event);
        }
    });
    select();
    WaitForObjectCondition<Menu> waitForMenu = Conditions.waitForPopupMenu(control);
    new SWTBot().waitUntilWidgetAppears(waitForMenu);
    return new SWTBotRootMenu(waitForMenu.get(0));
}
Also used : VoidResult(org.eclipse.swtbot.swt.finder.results.VoidResult) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotRootMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu) Rectangle(org.eclipse.swt.graphics.Rectangle) Event(org.eclipse.swt.widgets.Event) SWTBotRootMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu) Menu(org.eclipse.swt.widgets.Menu)

Example 7 with SWTBotRootMenu

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.

the class TmfAlignTimeAxisTest method testMenuItem.

/**
 * Test for the "Align Views" menu item
 */
@Test
public void testMenuItem() {
    fBot = new SWTWorkbenchBot();
    switchToPerspective(AlignPerspectiveFactory1.ID);
    SWTBotView viewBot = fBot.viewById(TimeGraphViewStub.ID);
    SWTBotRootMenu viewMenu = viewBot.viewMenu();
    SWTBotMenu menuItems = viewMenu.menu(ALIGN_VIEWS_ACTION_NAME);
    assertTrue("Align views", menuItems.isChecked());
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotRootMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView) Test(org.junit.Test)

Example 8 with SWTBotRootMenu

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.

the class MarkerSetSwtBotTest method insertContent.

private static void insertContent() {
    SWTBotRootMenu viewMenu = fViewBot.viewMenu();
    viewMenu.menu("Marker Set").menu("Edit...").click();
    fBot.waitUntil(ConditionHelpers.isEditorOpened(fBot, EDITOR_TITLE));
    SWTBotEclipseEditor editor = fBot.editorByTitle(EDITOR_TITLE).toTextEditor();
    editor.setText(XML_CONTENT);
    editor.saveAndClose();
    WaitUtils.waitForJobs();
}
Also used : SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) SWTBotRootMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu)

Example 9 with SWTBotRootMenu

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.

the class MarkerSetSwtBotTest method removeContent.

private static void removeContent() {
    SWTBotRootMenu viewMenu = fViewBot.viewMenu();
    viewMenu.menu("Marker Set").menu("Edit...").click();
    fBot.waitUntil(ConditionHelpers.isEditorOpened(fBot, EDITOR_TITLE));
    SWTBotEclipseEditor editor = fBot.editorByTitle(EDITOR_TITLE).toTextEditor();
    editor.setText("<marker-sets></marker-sets>");
    editor.saveAndClose();
    WaitUtils.waitForJobs();
}
Also used : SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) SWTBotRootMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu)

Example 10 with SWTBotRootMenu

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.

the class MarkerSetSwtBotTest method testNavigateBetweenMarkers.

/**
 * Test navigation between markers
 */
@Test
public void testNavigateBetweenMarkers() {
    AbstractTimeGraphView part = (AbstractTimeGraphView) fViewBot.getViewReference().getPart(false);
    TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, fFullRange));
    fBot.waitUntil(ConditionHelpers.windowRange(fFullRange));
    insertContent();
    fViewBot.setFocus();
    SWTBotRootMenu viewMenu = fViewBot.viewMenu();
    viewMenu.menu("Marker Set", "Set A").click();
    fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition(part, new TmfTimeRange(TmfTimestamp.fromNanos(fStart), TmfTimestamp.fromNanos(fStart)), TmfTimestamp.fromNanos(fStart)));
    fViewBot.toolbarButton("Next Marker").click();
    // Marker A-1: period = 10, unit = ns, offset = 0
    long period = 10l;
    long nextStart = fStart + (period - (fStart % period));
    fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TmfTimestamp.fromNanos(nextStart), TmfTimestamp.fromNanos(nextStart + period))));
    viewMenu.menu("Show Markers", "Marker A-1").hide();
    fViewBot.toolbarButton("Previous Marker").click();
    fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition(part, new TmfTimeRange(TmfTimestamp.fromNanos(fStart), TmfTimestamp.fromNanos(nextStart)), TmfTimestamp.fromNanos(fStart)));
    removeContent();
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) SWTBotRootMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Aggregations

SWTBotRootMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu)12 Test (org.junit.Test)6 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)5 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)5 Event (org.eclipse.swt.widgets.Event)3 Nullable (org.eclipse.jdt.annotation.Nullable)2 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)2 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)2 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)2 Chart (org.eclipse.swtchart.Chart)2 Main (aero.minova.rcp.form.menu.mdi.Main)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)1 ECommandService (org.eclipse.e4.core.commands.ECommandService)1 EHandlerService (org.eclipse.e4.core.commands.EHandlerService)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 Menu (org.eclipse.swt.widgets.Menu)1 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)1