2 * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 package org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.provider
.statesystem
;
12 import java
.util
.concurrent
.FutureTask
;
14 import org
.eclipse
.jdt
.annotation
.Nullable
;
15 import org
.eclipse
.tracecompass
.statesystem
.core
.ITmfStateSystem
;
16 import org
.eclipse
.tracecompass
.tmf
.core
.statesystem
.TmfStateSystemAnalysisModule
;
17 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
18 import org
.lttng
.scope
.tmf2
.views
.core
.TimeRange
;
19 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.provider
.arrows
.TimeGraphModelArrowProvider
;
20 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.arrows
.TimeGraphArrowRender
;
21 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.arrows
.TimeGraphArrowSeries
;
22 import org
.lttng
.scope
.tmf2
.views
.core
.timegraph
.model
.render
.tree
.TimeGraphTreeRender
;
25 * Basic implementation of a {@link TimeGraphModelArrowProvider} backed by a
28 * @author Alexandre Montplaisir
30 public abstract class StateSystemModelArrowProvider
extends TimeGraphModelArrowProvider
{
32 private final String fStateSystemModuleId
;
34 private transient @Nullable ITmfStateSystem fStateSystem
= null;
40 * The arrow series that will be represented by this arrow
42 * @param stateSystemModuleId
43 * The ID of the state system from which the information should
46 public StateSystemModelArrowProvider(TimeGraphArrowSeries arrowSeries
,
47 String stateSystemModuleId
) {
49 fStateSystemModuleId
= stateSystemModuleId
;
52 * Change listener which will take care of keeping the target state
55 traceProperty().addListener((obs
, oldValue
, newValue
) -> {
56 ITmfTrace trace
= newValue
;
62 // FIXME Remove the extra thread once we move to Jabberwocky
63 Thread thread
= new Thread(() -> {
64 fStateSystem
= TmfStateSystemAnalysisModule
.getStateSystem(trace
, fStateSystemModuleId
);
71 * The state system from which the data should be fetched. This will be kept
72 * in sync with the {@link #traceProperty}.
74 * @return The target state system. It will be null if the current trace is
77 protected final @Nullable ITmfStateSystem
getStateSystem() {
82 public abstract TimeGraphArrowRender
getArrowRender(TimeGraphTreeRender treeRender
, TimeRange timeRange
, @Nullable FutureTask
<?
> task
);