Search in sources :

Example 1 with ITimeGraphEntry

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();
}
Also used : ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)

Example 2 with ITimeGraphEntry

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;
}
Also used : ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) NonNull(org.eclipse.jdt.annotation.NonNull) HashSet(java.util.HashSet) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 3 with ITimeGraphEntry

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();
}
Also used : ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 4 with ITimeGraphEntry

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());
}
Also used : ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with ITimeGraphEntry

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;
}
Also used : ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) ModuleEntryModel(org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) StateSystemEntryModel(org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.StateSystemEntryModel) TimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent) ITimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)

Aggregations

ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)53 ITimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent)14 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)11 ArrayList (java.util.ArrayList)10 Point (org.eclipse.swt.graphics.Point)10 List (java.util.List)8 NonNull (org.eclipse.jdt.annotation.NonNull)6 LongPoint (org.eclipse.tracecompass.internal.tmf.ui.widgets.timegraph.TimeGraphRender.LongPoint)6 ILinkEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent)6 ITimeGraphDataProvider (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphDataProvider)5 TimeGraphEntryModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel)4 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 ModuleEntryModel (org.eclipse.tracecompass.internal.tmf.core.statesystem.provider.StateSystemDataProvider.ModuleEntryModel)3 ITimeGraphState (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState)3 SimpleEntry (java.util.AbstractMap.SimpleEntry)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Objects.requireNonNull (java.util.Objects.requireNonNull)2