use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent in project tracecompass by tracecompass.
the class TimeGraphViewer method updateMarkerList.
private void updateMarkerList() {
List<IMarkerEvent> markers = new ArrayList<>();
for (IMarkerEvent marker : fMarkers) {
if (!fHiddenMarkerCategories.contains(marker.getCategory())) {
markers.add(marker);
}
}
if (!fHiddenMarkerCategories.contains(IMarkerEvent.BOOKMARKS)) {
markers.addAll(fBookmarks);
}
Collections.sort(markers, new MarkerComparator());
fTimeGraphCtrl.setMarkers(markers);
fMarkerAxisCtrl.setMarkers(markers);
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent in project tracecompass by tracecompass.
the class TimeGraphViewer method getBookmarkAtSelection.
private IMarkerEvent getBookmarkAtSelection() {
final long time = Math.min(fSelectionBegin, fSelectionEnd);
final long duration = Math.max(fSelectionBegin, fSelectionEnd) - time;
for (IMarkerEvent bookmark : fBookmarks) {
if (bookmark.getTime() == time && bookmark.getDuration() == duration) {
return bookmark;
}
}
return null;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent in project tracecompass by tracecompass.
the class TimeGraphViewer method selectNextMarker.
/**
* Select the next marker that begins at or after the current selection
* begin time. Markers that begin at the same time are ordered by end time.
*/
private void selectNextMarker() {
List<IMarkerEvent> markers = getTimeGraphControl().getMarkers();
if (markers == null) {
return;
}
for (IMarkerEvent marker : markers) {
final long time = Math.min(fSelectionBegin, fSelectionEnd);
final long duration = Math.max(fSelectionBegin, fSelectionEnd) - time;
if ((marker.getTime() > time || (marker.getTime() == time && marker.getDuration() > duration)) && !fSkippedMarkerCategories.contains(marker.getCategory())) {
setSelectionRangeNotify(marker.getTime(), marker.getTime() + marker.getDuration(), false);
ensureVisible(marker.getTime());
notifyRangeListeners();
fTimeGraphCtrl.updateStatusLine();
return;
}
}
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent in project tracecompass by tracecompass.
the class TimeGraphViewer method getToggleBookmarkAction.
/**
* Get the toggle bookmark action.
*
* @return The Action object
* @since 2.0
*/
public Action getToggleBookmarkAction() {
if (fToggleBookmarkAction == null) {
fToggleBookmarkAction = new Action() {
@Override
public void runWithEvent(Event event) {
IMarkerEvent selectedBookmark = getBookmarkAtSelection();
if (selectedBookmark == null) {
final long time = Math.min(fSelectionBegin, fSelectionEnd);
final long duration = Math.max(fSelectionBegin, fSelectionEnd) - time;
final AddBookmarkDialog dialog = new AddBookmarkDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null);
if (dialog.open() == Window.OK) {
final String label = dialog.getValue();
final RGBA rgba = dialog.getColorValue();
IMarkerEvent bookmark = new MarkerEvent(null, time, duration, IMarkerEvent.BOOKMARKS, rgba, label, true);
fBookmarks.add(bookmark);
updateMarkerList();
updateMarkerActions();
getControl().redraw();
fireBookmarkAdded(bookmark);
}
} else {
fBookmarks.remove(selectedBookmark);
updateMarkerList();
updateMarkerActions();
getControl().redraw();
fireBookmarkRemoved(selectedBookmark);
}
}
};
fToggleBookmarkAction.setText(Messages.TmfTimeGraphViewer_BookmarkActionAddText);
fToggleBookmarkAction.setToolTipText(Messages.TmfTimeGraphViewer_BookmarkActionAddText);
fToggleBookmarkAction.setImageDescriptor(ADD_BOOKMARK);
}
return fToggleBookmarkAction;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent in project tracecompass by tracecompass.
the class TimeGraphViewer method extendToPrevMarker.
/**
* Extend the selection to the closest previous marker start time.
*/
private void extendToPrevMarker() {
List<IMarkerEvent> markers = getTimeGraphControl().getMarkers();
if (markers == null) {
return;
}
for (int i = markers.size() - 1; i >= 0; i--) {
IMarkerEvent marker = markers.get(i);
if (marker.getTime() < fSelectionEnd && !fSkippedMarkerCategories.contains(marker.getCategory())) {
setSelectionRangeNotify(fSelectionBegin, marker.getTime(), true);
fTimeGraphCtrl.updateStatusLine();
return;
}
}
}
Aggregations