use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider in project tracecompass by tracecompass.
the class Histogram method updateStatusLine.
private void updateStatusLine(long startTime, long endTime, long cursorTime) {
ITimeDataProvider timeProvider = fTimeLineScale.getTimeProvider();
if (timeProvider.getTime0() == timeProvider.getTime1()) {
return;
}
TimeFormat timeFormat = timeProvider.getTimeFormat().convert();
boolean isCalendar = timeFormat == TimeFormat.CALENDAR;
StringBuilder message = new StringBuilder();
// $NON-NLS-1$
String spaces = " ";
if (cursorTime >= 0) {
// $NON-NLS-1$
message.append("T: ");
if (isCalendar) {
message.append(FormatTimeUtils.formatDate(cursorTime) + ' ');
}
message.append(FormatTimeUtils.formatTime(cursorTime, timeFormat, Resolution.NANOSEC));
message.append(spaces);
}
if (startTime == endTime) {
// $NON-NLS-1$
message.append("T1: ");
if (isCalendar) {
message.append(FormatTimeUtils.formatDate(startTime) + ' ');
}
message.append(FormatTimeUtils.formatTime(startTime, timeFormat, Resolution.NANOSEC));
} else {
// $NON-NLS-1$
message.append("T1: ");
if (isCalendar) {
message.append(FormatTimeUtils.formatDate(startTime) + ' ');
}
message.append(FormatTimeUtils.formatTime(startTime, timeFormat, Resolution.NANOSEC));
message.append(spaces);
// $NON-NLS-1$
message.append("T2: ");
if (isCalendar) {
message.append(FormatTimeUtils.formatDate(endTime) + ' ');
}
message.append(FormatTimeUtils.formatTime(endTime, timeFormat, Resolution.NANOSEC));
message.append(spaces);
// $NON-NLS-1$
message.append("\u0394: " + FormatTimeUtils.formatDelta(endTime - startTime, timeFormat, Resolution.NANOSEC));
}
fStatusLineManager.setMessage(message.toString());
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider in project tracecompass by tracecompass.
the class TimeGraphViewTest method testBookmark.
/**
* Test bookmark operations
*/
@Test
public void testBookmark() {
String pg = "Plumber guy";
SWTBotTimeGraph timegraph = fTimeGraph;
resetTimeRange();
SWTBotTimeGraphEntry[] entries = null;
entries = timegraph.getEntries();
assertNotNull(entries);
SWTBotTimeGraphEntry entry1 = timegraph.getEntry(pg, "Hat2");
SWTBotTimeGraphEntry entry2 = timegraph.getEntry(pg, "Head3");
assertNotNull(entry1);
assertNotNull(entry2);
ITimeDataProvider timeprovider = timegraph.widget.getTimeDataProvider();
// initial settings
long unsetTime = 0;
long time0 = 20;
long time1 = 100;
// Bookmark Range
long bookmarkBegin = 40;
long bookmarkEnd = 80;
// Other marker
long previousMarker = 38;
long nextMarker = 44;
Point down = entry1.getPointForTime(bookmarkBegin);
Point up = entry2.getPointForTime(bookmarkEnd);
validateRanges(timeprovider, unsetTime, unsetTime, time0, time1);
fTimeGraph.drag(down, up, SWT.BUTTON1);
// Contiguous time?
validateRanges(timeprovider, bookmarkBegin, bookmarkEnd, time0, time1);
fViewBot.toolbarButton("Add Bookmark...").click();
SWTBotShell bookmarkShell = fBot.shell("Add Bookmark");
bookmarkShell.bot().text().setText("Bookmark");
bookmarkShell.bot().button(OK_BUTTON).click();
fViewBot.toolbarButton("Previous Marker").click();
validateRanges(timeprovider, previousMarker, previousMarker, time0, time1);
fViewBot.toolbarButton("Next Marker").click();
validateRanges(timeprovider, bookmarkBegin, bookmarkEnd, time0, time1);
fViewBot.toolbarButton("Remove Bookmark").click();
validateRanges(timeprovider, bookmarkBegin, bookmarkEnd, time0, time1);
fViewBot.toolbarButton("Previous Marker").click();
validateRanges(timeprovider, previousMarker, previousMarker, time0, time1);
fViewBot.toolbarButton("Next Marker").click();
validateRanges(timeprovider, nextMarker, nextMarker, time0, time1);
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.ITimeDataProvider in project tracecompass by tracecompass.
the class TimeGraphViewTest method testDrag.
/**
* Test Mouse operations, drag, select and middle-drag
*/
@Test
public void testDrag() {
String pg = "Plumber guy";
SWTBotTimeGraph timegraph = fTimeGraph;
resetTimeRange();
SWTBotTimeGraphEntry[] entries = timegraph.getEntries();
assertNotNull(entries);
SWTBotTimeGraphEntry entry1 = timegraph.getEntry(pg, "Hat2");
assertNotNull(entry1);
SWTBotTimeGraphEntry entry2 = timegraph.getEntry(pg, "Head3");
assertNotNull(entry2);
ITimeDataProvider timeprovider = timegraph.widget.getTimeDataProvider();
validateRanges(timeprovider, 0, 0, 20, 100);
// Change selection
Point down = entry1.getPointForTime(40);
Point up = entry2.getPointForTime(80);
fTimeGraph.drag(down, up, SWT.BUTTON1);
validateRanges(timeprovider, 40, 80, 20, 100);
// Zoom window
down = entry1.getPointForTime(70);
up = entry2.getPointForTime(30);
fTimeGraph.drag(down, up, SWT.BUTTON3);
validateRanges(timeprovider, 40, 80, 30, 70);
// Drag window
down = entry1.getPointForTime(65);
up = entry2.getPointForTime(35);
fTimeGraph.drag(down, up, SWT.BUTTON2);
validateRanges(timeprovider, 40, 80, 60, 100);
// Check for aliasing
up = entry1.getPointForTime(99);
for (int selectionDown = 61; selectionDown < 99; selectionDown++) {
down = entry1.getPointForTime(selectionDown);
fTimeGraph.drag(down, up, SWT.BUTTON1);
validateRanges(timeprovider, selectionDown, 99, 60, 100);
}
down = entry1.getPointForTime(61);
for (int selectionUp = 62; selectionUp < 100; selectionUp++) {
// drag the cursor by one ns per cycle
up = entry1.getPointForTime(selectionUp);
fTimeGraph.drag(down, up, SWT.BUTTON1);
down = up;
validateRanges(timeprovider, 61, selectionUp, 60, 100);
}
// drag cursor around
down = entry1.getPointForTime(65);
up = entry1.getPointForTime(85);
fTimeGraph.drag(down, up, SWT.BUTTON1);
validateRanges(timeprovider, 65, 85, 60, 100);
up = entry1.getPointForTime(70);
fTimeGraph.drag(down, up, SWT.BUTTON1);
validateRanges(timeprovider, 70, 85, 60, 100);
}
Aggregations