Search in sources :

Example 1 with ITimeGraphStylePresentationProvider

use of org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets.timegraph.ITimeGraphStylePresentationProvider in project tracecompass by tracecompass.

the class TimeGraphControl method getElementStyle.

@Nullable
private OutputElementStyle getElementStyle(@NonNull ITimeEvent event) {
    OutputElementStyle elementStyle;
    if (fTimeGraphProvider instanceof ITimeGraphStylePresentationProvider) {
        ITimeGraphStylePresentationProvider provider = (ITimeGraphStylePresentationProvider) fTimeGraphProvider;
        elementStyle = provider.getElementStyle(event);
        if (elementStyle == null) {
            return null;
        }
        if (elementStyle.getParentKey() == null && elementStyle.getStyleValues().isEmpty()) {
            return elementStyle;
        }
        return new OutputElementStyle(elementStyle.getParentKey(), applyEventStyleProperties(new HashMap<>(elementStyle.getStyleValues()), event));
    }
    if (!(event instanceof MarkerEvent)) {
        int colorIdx = fTimeGraphProvider.getStateTableIndex(event);
        if (colorIdx == ITimeGraphPresentationProvider.INVISIBLE) {
            return null;
        }
        if (colorIdx == ITimeGraphPresentationProvider.TRANSPARENT) {
            return new OutputElementStyle(null, new HashMap<>());
        }
    }
    Map<@NonNull String, @NonNull Object> styleMap = StylePropertiesUtils.updateEventStyleProperties(fTimeGraphProvider.getEventStyle(event));
    return new OutputElementStyle(null, applyEventStyleProperties(styleMap, event));
}
Also used : OutputElementStyle(org.eclipse.tracecompass.tmf.core.model.OutputElementStyle) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) MarkerEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.MarkerEvent) IMarkerEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent) Point(org.eclipse.swt.graphics.Point) LongPoint(org.eclipse.tracecompass.internal.tmf.ui.widgets.timegraph.TimeGraphRender.LongPoint) ITimeGraphStylePresentationProvider(org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets.timegraph.ITimeGraphStylePresentationProvider) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 Point (org.eclipse.swt.graphics.Point)1 ITimeGraphStylePresentationProvider (org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets.timegraph.ITimeGraphStylePresentationProvider)1 LongPoint (org.eclipse.tracecompass.internal.tmf.ui.widgets.timegraph.TimeGraphRender.LongPoint)1 OutputElementStyle (org.eclipse.tracecompass.tmf.core.model.OutputElementStyle)1 IMarkerEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.IMarkerEvent)1 MarkerEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.MarkerEvent)1