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));
}
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());
}
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();
}
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();
}
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();
}
Aggregations