import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphPresentationProvider;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent;
+import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
@Override
public void run() {
final List<ILinkEvent> links = new ArrayList<>();
+ final List<IMarkerEvent> markers = new ArrayList<>();
if (fClearZoomedLists) {
clearZoomedLists();
}
entryList = fSSEntryListMap.get(ss);
}
if (entryList != null) {
- zoomByTime(ss, entryList, links, getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor());
+ zoomByTime(ss, entryList, links, markers, getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor());
}
}
if (!getMonitor().isCanceled()) {
getTimeGraphViewer().setLinks(links);
+ getTimeGraphViewer().getTimeGraphControl().setMarkers(markers);
}
}
}
}
- private void zoomByTime(final ITmfStateSystem ss, final List<TimeGraphEntry> entryList, final List<ILinkEvent> links,
+ private void zoomByTime(final ITmfStateSystem ss, final List<TimeGraphEntry> entryList, final List<ILinkEvent> links, final List<IMarkerEvent> markers,
long startTime, long endTime, long resolution, final @NonNull IProgressMonitor monitor) {
final long start = Math.max(startTime, ss.getStartTime());
final long end = Math.min(endTime, ss.getCurrentEndTime());
}
/* Refresh the arrows when zooming */
links.addAll(getLinkList(ss, fullStates, monitor));
+ /* Refresh the markers when zooming */
+ markers.addAll(getMarkerList(ss, fullStates, monitor));
}
});
refresh();
return new ArrayList<>();
}
+ /**
+ * Gets the list of markers for a given list of full
+ * states. The default implementation returns an empty list.
+ *
+ * @param ss
+ * The state system
+ * @param fullStates
+ * A list of full states
+ * @param monitor
+ * A progress monitor
+ * @return The list of marker events
+ */
+ protected @NonNull List<IMarkerEvent> getMarkerList(ITmfStateSystem ss,
+ @NonNull List<List<ITmfStateInterval>> fullStates, @NonNull IProgressMonitor monitor) {
+ return new ArrayList<>();
+ }
+
/**
* @deprecated The subclass should call {@link #getEntryList(ITmfStateSystem)} instead.
*/
throw new UnsupportedOperationException();
}
+ /**
+ * @deprecated The subclass should implement {@link #getMarkerList(ITmfStateSystem, List, IProgressMonitor)} instead.
+ */
+ @Deprecated
+ @Override
+ protected final List<IMarkerEvent> getMarkerList(long startTime, long endTime, long resolution, IProgressMonitor monitor) {
+ throw new UnsupportedOperationException();
+ }
+
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphTimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphViewer;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent;
+import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
fTimeGraphWrapper.getTimeGraphViewer().setLinks(events);
redraw();
}
+ /* Refresh the markers when zooming */
+ List<IMarkerEvent> markers = getMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor());
+ if (markers != null) {
+ fTimeGraphWrapper.getTimeGraphViewer().getTimeGraphControl().setMarkers(markers);
+ redraw();
+ }
}
private void zoom(@NonNull TimeGraphEntry entry, @NonNull IProgressMonitor monitor) {
return new ArrayList<>();
}
+ /**
+ * Gets the list of markers for a trace in a given time range. Default
+ * implementation returns an empty list.
+ *
+ * @param startTime
+ * Start of the time range
+ * @param endTime
+ * End of the time range
+ * @param resolution
+ * The resolution
+ * @param monitor
+ * The progress monitor object
+ * @return The list of marker events
+ * @since 2.0
+ */
+ protected @Nullable List<IMarkerEvent> getMarkerList(long startTime, long endTime,
+ long resolution, @NonNull IProgressMonitor monitor) {
+ return new ArrayList<>();
+ }
/**
* Refresh the display