Search in sources :

Example 1 with TmfStatisticsViewer

use of org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.TmfStatisticsViewer in project tracecompass by tracecompass.

the class TmfStatisticsViewImpl method traceSelected.

/**
 * Handler called when an trace is selected. Checks if the trace
 * has changed and requests the selected trace if it has not yet been
 * cached.
 *
 * @param signal
 *            Contains the information about the selection.
 */
@TmfSignalHandler
public void traceSelected(TmfTraceSelectedSignal signal) {
    // Does not reload the same trace if already opened
    if (signal.getTrace() != fTrace) {
        /*
             * Dispose the current viewer and adapt the new one to the trace
             * type of the trace selected
             */
        fStatsViewers.clear();
        // Update the current trace
        fTrace = signal.getTrace();
        createStatisticsViewers();
        fStatsViewers.layout();
        TmfTraceRangeUpdatedSignal updateSignal = new TmfTraceRangeUpdatedSignal(this, fTrace, fTrace.getTimeRange());
        for (ITmfViewer viewer : fStatsViewers.getViewers()) {
            TmfStatisticsViewer statsViewer = (TmfStatisticsViewer) viewer;
            statsViewer.sendPartialRequestOnNextUpdate();
            statsViewer.traceRangeUpdated(updateSignal);
        }
    } else {
        /*
             * If the same trace is reselected, sends a notification to
             * the viewers to make sure they reload correctly their partial
             * event count.
             */
        for (ITmfViewer viewer : fStatsViewers.getViewers()) {
            TmfStatisticsViewer statsViewer = (TmfStatisticsViewer) viewer;
            // Will update the partial event count if needed.
            statsViewer.sendPartialRequestOnNextUpdate();
        }
    }
}
Also used : TmfTraceRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal) TmfStatisticsViewer(org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.TmfStatisticsViewer) ITmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.ITmfViewer) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 2 with TmfStatisticsViewer

use of org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.TmfStatisticsViewer in project tracecompass by tracecompass.

the class TmfStatisticsViewImpl method createStatisticsViewers.

/**
 * Creates the statistics viewers for all traces in an experiment and
 * populates a viewer folder. Each viewer is placed in a different tab and
 * the first one is selected automatically.
 *
 * It uses the extension point that defines the statistics viewer to build
 * from the trace type. If no viewer is defined, another tab won't be
 * created, since the global viewer already contains all the basic
 * statistics. If there is no trace selected, a global statistics viewer will
 * still be created.
 */
protected void createStatisticsViewers() {
    // Default style for the tabs that will be created
    int defaultStyle = SWT.NONE;
    // The folder composite that will contain the tabs
    Composite folder = fStatsViewers.getParentFolder();
    // Instantiation of the global viewer
    if (fTrace != null) {
        // Shows the name of the trace in the global tab
        // $NON-NLS-1$
        TmfStatisticsViewer globalViewer = new TmfStatisticsViewer(folder, Messages.TmfStatisticsView_GlobalTabName + " - " + fTrace.getName(), fTrace);
        fStatsViewers.addTab(globalViewer, Messages.TmfStatisticsView_GlobalTabName, defaultStyle);
    } else {
        // There is no trace selected. Shows an empty global tab
        TmfStatisticsViewer globalViewer = new TmfStatisticsViewer(folder, Messages.TmfStatisticsView_GlobalTabName, fTrace);
        fStatsViewers.addTab(globalViewer, Messages.TmfStatisticsView_GlobalTabName, defaultStyle);
    }
    // Makes the global viewer visible
    fStatsViewers.setSelection(0);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) TmfStatisticsViewer(org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.TmfStatisticsViewer)

Aggregations

TmfStatisticsViewer (org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.TmfStatisticsViewer)2 Composite (org.eclipse.swt.widgets.Composite)1 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)1 TmfTraceRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal)1 ITmfViewer (org.eclipse.tracecompass.tmf.ui.viewers.ITmfViewer)1