use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry in project tracecompass by tracecompass.
the class TimeGraphViewer method selectAndReveal.
/**
* Select an entry and reveal it
*
* @param entry
* The entry to select
* @since 2.0
*/
public void selectAndReveal(@NonNull ITimeGraphEntry entry) {
final ITimeGraphEntry parent = entry.getParent();
if (parent != null) {
fTimeGraphCtrl.setExpandedState(parent, true);
}
fSelectedEntry = entry;
fTimeGraphCtrl.selectItem(entry, false);
adjustVerticalScrollBar();
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry in project tracecompass by tracecompass.
the class TimeGraphViewer method getAllCollapsedElements.
/**
* Get the collapsed (visible or not) time graph entries.
*
* @return The array of collapsed time graph entries
* @since 3.1
*/
@NonNull
public Set<@NonNull ITimeGraphEntry> getAllCollapsedElements() {
@NonNull Set<@NonNull ITimeGraphEntry> collapsedEntries = new HashSet<>();
ITimeGraphEntry[] elements = fTimeGraphContentProvider.getElements(getInput());
for (ITimeGraphEntry entry : elements) {
if (entry != null) {
getAllCollapsedElements(entry, collapsedEntries);
}
}
return collapsedEntries;
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry in project tracecompass by tracecompass.
the class TimeGraphViewer method setSelection.
@Override
public void setSelection(ISelection selection, boolean reveal) {
/* if there is a pending selection, ignore this one */
if (fListenerNotifier != null && fListenerNotifier.hasSelectionChanged()) {
return;
}
Object element = selection;
if (selection instanceof IStructuredSelection) {
element = ((IStructuredSelection) selection).getFirstElement();
}
if (!(element instanceof ITimeGraphEntry)) {
return;
}
ITimeGraphEntry entry = (ITimeGraphEntry) element;
fSelectedEntry = entry;
fTimeGraphCtrl.selectItem(entry, false, reveal);
adjustVerticalScrollBar();
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry in project tracecompass by tracecompass.
the class SWTBotTimeGraphEntry method getEntry.
/**
* Get the child entry of this entry with the given name
*
* @param name
* the name of the entry
*
* @return the child entry
*/
public SWTBotTimeGraphEntry getEntry(String name) {
AtomicReference<ITimeGraphEntry> found = new AtomicReference<>();
SWTBotUtils.waitUntil(timegraph -> {
List<ITimeGraphEntry> entries = syncExec(new ListResult<ITimeGraphEntry>() {
@Override
public List<ITimeGraphEntry> run() {
return Arrays.asList(timegraph.getExpandedElements());
}
});
ITableLabelProvider labelProvider = timegraph.getLabelProvider();
for (ITimeGraphEntry entry : entries) {
if (fEntry.equals(entry.getParent())) {
String label = labelProvider == null ? entry.getName() : labelProvider.getColumnText(entry, 0);
if (name.equals(label)) {
found.set(entry);
return true;
}
}
}
return false;
}, widget, () -> "Timed out waiting for time graph entry " + name);
return new SWTBotTimeGraphEntry(widget, found.get());
}
use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry in project tracecompass by tracecompass.
the class StateSystemPresentationProvider method getStateTableIndex.
@Override
public int getStateTableIndex(ITimeEvent event) {
if (event instanceof TimeEvent) {
TimeEvent timeEvent = (TimeEvent) event;
Object value = timeEvent.getLabel();
if (value != null) {
return Math.floorMod(value.hashCode(), NUM_COLORS);
}
ITimeGraphEntry entry = event.getEntry();
if (entry != null) {
ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel();
if (model instanceof StateSystemEntryModel || model instanceof ModuleEntryModel) {
// tooltip
return INVISIBLE;
}
}
// grey
return NUM_COLORS;
}
return INVISIBLE;
}
Aggregations