use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.
the class FlameChartViewTest method goToTime.
private static void goToTime(long timestamp) {
ITmfTimestamp time = TmfTimestamp.fromNanos(timestamp);
SWTBotTable table = sfBot.activeEditor().bot().table();
table.setFocus();
WaitUtils.waitForJobs();
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(table.widget, time));
sfBot.waitUntil(ConditionHelpers.selectionInEventsTable(sfBot, timestamp));
final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
IWorkbenchPart part = viewBot.getViewReference().getPart(false);
sfBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, new TmfTimeRange(time, time), time));
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.
the class BookmarksViewTest method bookmarkTest.
private static void bookmarkTest(String editorName) throws IOException {
SWTBotView fViewBot = fBot.viewByPartName("Bookmarks");
fViewBot.setFocus();
WaitUtils.waitForJobs();
assertEquals("Failed to show the Bookmarks View", "Bookmarks", fViewBot.getTitle());
/**
* Add a bookmark: a) Double click to select an event in the event
* editor b) Go to the Edit > Add Bookmark... menu c) Enter the bookmark
* description in dialog box
*/
SWTBotEditor editorBot = SWTBotUtils.activateEditor(fBot, editorName);
SWTBotTable tableBot = editorBot.bot().table();
SWTBotTableItem tableItem = tableBot.getTableItem(7);
String expectedTimeStamp = tableItem.getText(1);
assertNull("The image should not be bookmarked yet", getBookmarkImage(tableItem));
tableItem.select();
tableItem.doubleClick();
fBot.menu("Edit").menu("Add Bookmark...").click();
WaitUtils.waitForJobs();
SWTBotShell addBookmarkShell = fBot.shell("Add Bookmark");
addBookmarkShell.bot().text().setText(BOOKMARK_NAME);
addBookmarkShell.bot().button("OK").click();
assertNotNull("Failed to add bookmark in event editor", getBookmarkImage(tableItem));
fViewBot.setFocus();
WaitUtils.waitForJobs();
SWTBotTree bookmarkTree = fViewBot.bot().tree();
WaitUtils.waitForJobs();
/**
* throws WidgetNotFoundException - if the node was not found, nothing
* to assert
*/
SWTBotTreeItem bookmark = bookmarkTree.getTreeItem(BOOKMARK_NAME);
assertEquals(BOOKMARK_NAME, bookmark.cell(0));
/**
* Scroll within event table so that bookmark is not visible anymore and
* then double-click on bookmark in Bookmarks View
*/
UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(null, TmfTimestamp.fromMicros(22))));
bookmark.doubleClick();
WaitUtils.waitUntil(TABLE_NOT_EMPTY, tableBot, "Table is still empty");
TableCollection selection = tableBot.selection();
TableRow row = selection.get(0);
assertNotNull(selection.toString(), row);
assertEquals("Wrong event was selected " + selection, expectedTimeStamp, row.get(1));
/**
* Open another trace #2 and then double-click on bookmark in Bookmarks
* view
*/
SWTBotUtils.openTrace(PROJECT_NAME, FileLocator.toFileURL(TmfTraceStub.class.getResource("/testfiles/E-Test-10K")).getPath(), TRACE_TYPE);
WaitUtils.waitForJobs();
bookmark.doubleClick();
editorBot = SWTBotUtils.activeEventsEditor(fBot, editorName);
WaitUtils.waitUntil(TABLE_NOT_EMPTY, tableBot, "Table is still empty");
selection = tableBot.selection();
row = selection.get(0);
assertNotNull(selection.toString(), row);
assertEquals("Wrong event was selected " + selection, expectedTimeStamp, row.get(1));
/**
* Close the trace #1 and then double-click on bookmark in Bookmarks
* view
*/
editorBot.close();
WaitUtils.waitUntil(eb -> !eb.isActive(), editorBot, "Waiting for the editor to close");
bookmark.doubleClick();
editorBot = SWTBotUtils.activeEventsEditor(fBot, editorName);
WaitUtils.waitUntil(eb -> eb.bot().table().selection().rowCount() > 0, editorBot, "Selection is still empty");
tableBot = editorBot.bot().table();
WaitUtils.waitUntil(tb -> !Objects.equal(tb.selection().get(0).get(1), "<srch>"), tableBot, "Header is still selected");
selection = tableBot.selection();
row = selection.get(0);
assertNotNull(selection.toString(), row);
assertEquals("Wrong event was selected " + selection, expectedTimeStamp, row.get(1));
/**
* Select bookmarks icon in bookmark view right-click on icon and select
* "Remove Bookmark"
*/
bookmark.select();
bookmark.contextMenu("Delete").click();
SWTBotShell deleteBookmarkShell = fBot.shell("Delete Selected Entries");
SWTBotUtils.anyButtonOf(deleteBookmarkShell.bot(), "Delete", "Yes").click();
fBot.waitUntil(Conditions.treeHasRows(bookmarkTree, 0));
tableItem = editorBot.bot().table().getTableItem(7);
assertNull("Bookmark not deleted from event table", getBookmarkImage(tableItem));
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.
the class AbstractSegmentsStatisticsViewer method appendToTablePopupMenu.
/**
* Method to add commands to the context sensitive menu.
*
* @param manager
* the menu manager
* @param sel
* the current selection
*/
protected void appendToTablePopupMenu(IMenuManager manager, IStructuredSelection sel) {
Object element = sel.getFirstElement();
if (element instanceof TmfGenericTreeEntry) {
IAction gotoStartTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMinAction) {
@Override
public void run() {
long start;
long end;
if (element instanceof TmfGenericTreeEntry) {
SegmentStoreStatisticsModel model = ((TmfGenericTreeEntry<SegmentStoreStatisticsModel>) element).getModel();
start = model.getMinStart();
end = model.getMinEnd();
} else {
return;
}
broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentsStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end), getTrace()));
updateContent(start, end, true);
}
};
IAction gotoEndTime = new Action(Messages.SegmentStoreStatisticsViewer_GotoMaxAction) {
@Override
public void run() {
long start;
long end;
if (element instanceof TmfGenericTreeEntry) {
SegmentStoreStatisticsModel model = ((TmfGenericTreeEntry<SegmentStoreStatisticsModel>) element).getModel();
start = model.getMaxStart();
end = model.getMaxEnd();
} else {
return;
}
broadcast(new TmfSelectionRangeUpdatedSignal(AbstractSegmentsStatisticsViewer.this, TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end), getTrace()));
updateContent(start, end, true);
}
};
manager.add(gotoStartTime);
manager.add(gotoEndTime);
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.
the class TmfEventsTable method gotoMarker.
@Override
public void gotoMarker(final IMarker marker) {
ITmfTimestamp tsBegin = null;
ITmfTimestamp tsEnd = null;
/* try location as an integer for backward compatibility */
long rank = marker.getAttribute(IMarker.LOCATION, -1);
if (rank == -1) {
String rankString = marker.getAttribute(ITmfMarker.MARKER_RANK, (String) null);
try {
rank = Long.parseLong(rankString);
} catch (NumberFormatException e) {
/* ignored */
}
}
try {
String timeString = marker.getAttribute(ITmfMarker.MARKER_TIME, (String) null);
long time = Long.parseLong(timeString);
tsBegin = TmfTimestamp.fromNanos(time);
String durationString = marker.getAttribute(ITmfMarker.MARKER_DURATION, (String) null);
long duration = Long.parseLong(durationString);
tsEnd = TmfTimestamp.fromNanos(time + duration);
} catch (NumberFormatException e) {
/* ignored */
}
if (rank == -1 && tsBegin != null) {
final ITmfContext context = fTrace.seekEvent(tsBegin);
rank = context.getRank();
context.dispose();
}
if (rank != -1) {
int index = (int) rank;
if (fTable.getData(Key.FILTER_OBJ) != null) {
// +1 for top filter status row
index = fCache.getFilteredEventIndex(rank) + 1;
} else if (rank >= fTable.getItemCount()) {
fPendingGotoRank = rank;
}
fSelectedRank = rank;
fSelectedBeginRank = fSelectedRank;
// +1 for header row
fTable.setSelection(index + 1);
updateStatusLine(null);
if (tsBegin != null) {
if (tsEnd != null) {
broadcast(new TmfSelectionRangeUpdatedSignal(TmfEventsTable.this, tsBegin, tsEnd, fTrace));
} else {
broadcast(new TmfSelectionRangeUpdatedSignal(TmfEventsTable.this, tsBegin, tsBegin, fTrace));
}
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal in project tracecompass by tracecompass.
the class ImportAndReadPcapTest method testStreamView.
private void testStreamView(IViewReference viewPart) {
SWTBotView botView = new SWTBotView(viewPart, fBot);
StreamListView slv = (StreamListView) getViewPart("Stream List");
botView.setFocus();
SWTBotTree botTree = fBot.tree();
assertNotNull(botTree);
final TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(slv, fDesired1.getTimestamp());
slv.broadcast(signal);
WaitUtils.waitForJobs();
// FIXME This is a race condition:
// TmfEventsTable launches an async exec that may be run after the wait
// for jobs. This last delay catches it.
SWTBotUtils.delay(1000);
}
Aggregations