return list;
}
- private ControlFlowEntry findEntry(List<TimeGraphEntry> entryList, ITmfTrace trace, int threadId) {
- for (TimeGraphEntry entry : entryList) {
+ private ControlFlowEntry findEntry(List<? extends ITimeGraphEntry> entryList, ITmfTrace trace, int threadId) {
+ for (ITimeGraphEntry entry : entryList) {
if (entry instanceof ControlFlowEntry) {
ControlFlowEntry controlFlowEntry = (ControlFlowEntry) entry;
if (controlFlowEntry.getThreadId() == threadId && controlFlowEntry.getTrace() == trace) {
}
rEntry.setParent(this);
- getChildren().add(index, rEntry);
+ addChild(index, rEntry);
}
@Override
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.ui.views.timegraph.AbstractTimeGraphView;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.NullTimeEvent;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
refresh();
}
long resolution = Math.max(1, (endTime - ssq.getStartTime()) / getDisplayWidth());
- for (TimeGraphEntry entry : traceEntry.getChildren()) {
+ for (ITimeGraphEntry child : traceEntry.getChildren()) {
if (monitor.isCanceled()) {
return;
}
- List<ITimeEvent> eventList = getEventList(entry, start, endTime, resolution, monitor);
- if (eventList != null) {
- for (ITimeEvent event : eventList) {
- entry.addEvent(event);
+ if (child instanceof TimeGraphEntry) {
+ TimeGraphEntry entry = (TimeGraphEntry) child;
+ List<ITimeEvent> eventList = getEventList(entry, start, endTime, resolution, monitor);
+ if (eventList != null) {
+ for (ITimeEvent event : eventList) {
+ entry.addEvent(event);
+ }
}
+ redraw();
}
- redraw();
}
start = end;
}
entry.setParent(this);
- getChildren().add(index, entry);
+ addChild(index, entry);
}
/**
traceEntry.setEventList(eventList);
redraw();
- for (TimeGraphEntry entry : traceEntry.getChildren()) {
+ for (ITimeGraphEntry entry : traceEntry.getChildren()) {
if (monitor.isCanceled()) {
return;
}
ITmfStateInterval stackInterval = ss.querySingleState(beginTime, quark);
if (beginTime == stackInterval.getStartTime()) {
int stackLevel = stackInterval.getStateValue().unboxInt();
- CallStackEntry selectedEntry = threadEntry.getChildren().get(Math.max(0, stackLevel - 1));
+ ITimeGraphEntry selectedEntry = threadEntry.getChildren().get(Math.max(0, stackLevel - 1));
fTimeGraphCombo.setSelection(selectedEntry);
viewer.getTimeGraphControl().fireSelectionChanged();
break;
refresh();
}
for (ThreadEntry threadEntry : entryList) {
- for (CallStackEntry callStackEntry : threadEntry.getChildren()) {
+ for (ITimeGraphEntry callStackEntry : threadEntry.getChildren()) {
if (monitor.isCanceled()) {
return;
}
- buildStatusEvents(trace, callStackEntry, monitor);
+ buildStatusEvents(trace, (CallStackEntry) callStackEntry, monitor);
}
}
}
continue;
}
long queryTime = Math.max(ss.getStartTime(), Math.min(ss.getCurrentEndTime(), time));
- for (CallStackEntry callStackEntry : threadEntry.getChildren()) {
+ for (ITimeGraphEntry child : threadEntry.getChildren()) {
+ CallStackEntry callStackEntry = (CallStackEntry) child;
try {
ITmfStateInterval stackLevelInterval = ss.querySingleState(queryTime, callStackEntry.getQuark());
ITmfStateValue nameValue = stackLevelInterval.getStateValue();
viewer.setSelectedTimeNotify(newTime, true);
stackInterval = ss.querySingleState(Math.min(ss.getCurrentEndTime(), newTime), quark);
int stackLevel = stackInterval.getStateValue().unboxInt();
- CallStackEntry selectedEntry = threadEntry.getChildren().get(Math.max(0, stackLevel - 1));
+ ITimeGraphEntry selectedEntry = threadEntry.getChildren().get(Math.max(0, stackLevel - 1));
fTimeGraphCombo.setSelection(selectedEntry);
viewer.getTimeGraphControl().fireSelectionChanged();
startZoomThread(viewer.getTime0(), viewer.getTime1());
}
viewer.setSelectedTimeNotify(stackInterval.getStartTime(), true);
int stackLevel = stackInterval.getStateValue().unboxInt();
- CallStackEntry selectedEntry = threadEntry.getChildren().get(Math.max(0, stackLevel - 1));
+ ITimeGraphEntry selectedEntry = threadEntry.getChildren().get(Math.max(0, stackLevel - 1));
fTimeGraphCombo.setSelection(selectedEntry);
viewer.getTimeGraphControl().fireSelectionChanged();
startZoomThread(viewer.getTime0(), viewer.getTime1());
}
}
redraw();
- for (TimeGraphEntry child : entry.getChildren()) {
+ for (ITimeGraphEntry child : entry.getChildren()) {
if (fMonitor.isCanceled()) {
return;
}
- zoom(child, monitor);
+ if (child instanceof TimeGraphEntry) {
+ zoom((TimeGraphEntry) child, monitor);
+ }
}
}
public class TimeGraphEntry implements ITimeGraphEntry {
/** Entry's parent */
- private TimeGraphEntry fParent = null;
+ private ITimeGraphEntry fParent = null;
/** List of child entries */
- private final List<TimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
+ private final List<ITimeGraphEntry> fChildren = new CopyOnWriteArrayList<>();
/** Name of this entry (text to show) */
private String fName;
*
* @param entry The new parent entry
*/
+ /*
+ * TODO: This method can be removed in the next major API version.
+ */
protected void setParent(TimeGraphEntry entry) {
fParent = entry;
}
+ /**
+ * Sets the entry's parent
+ *
+ * @param entry The new parent entry
+ * @since 3.1
+ */
+ /*
+ * TODO: This method should be added to the interface in the next major API version.
+ */
+ protected void setParent(ITimeGraphEntry entry) {
+ fParent = entry;
+ }
+
@Override
public boolean hasChildren() {
return fChildren.size() > 0;
}
@Override
- public List<TimeGraphEntry> getChildren() {
+ public List<? extends ITimeGraphEntry> getChildren() {
return fChildren;
}
* @param child
* The child entry
*/
+ /*
+ * TODO: This method can be removed in the next major API version.
+ */
public void addChild(TimeGraphEntry child) {
child.fParent = this;
fChildren.add(child);
}
+ /**
+ * Add a child entry to this one
+ *
+ * @param child
+ * The child entry
+ * @since 3.1
+ */
+ public void addChild(ITimeGraphEntry child) {
+ if (child instanceof TimeGraphEntry) {
+ ((TimeGraphEntry) child).fParent = this;
+ }
+ fChildren.add(child);
+ }
+
+ /**
+ * Add a child entry to this one at the specified position
+ *
+ * @param index
+ * Index at which the specified entry is to be inserted
+ * @param child
+ * The child entry
+ * @since 3.1
+ */
+ public void addChild(int index, ITimeGraphEntry child) {
+ if (child instanceof TimeGraphEntry) {
+ ((TimeGraphEntry) child).fParent = this;
+ }
+ fChildren.add(index, child);
+ }
+
@Override
public String toString() {
return getClass().getSimpleName() + '(' + fName + ')';