Search in sources :

Example 1 with ActiveThreadsFilter

use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.ActiveThreadsFilter in project tracecompass by tracecompass.

the class ControlFlowView method createDynamicFilterConfigureAction.

private IAction createDynamicFilterConfigureAction() {
    return new Action(PackageMessages.ControlFlowView_DynamicFiltersConfigureLabel, IAction.AS_PUSH_BUTTON) {

        @Override
        public void run() {
            DynamicFilterDialog dialog = new DynamicFilterDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), fActiveThreadsFilter, getTrace());
            if (dialog.open() == Window.OK) {
                /* Remove the previous Active Threads filter */
                checkNotNull(getTimeGraphViewer()).removeFilter(fActiveThreadsFilter);
                ActiveThreadsFilter newFilter = dialog.getActiveThreadsResult();
                ActiveThreadsFilter previousFilter = fActiveThreadsFilter;
                /* Set the filter to the view */
                fActiveThreadsFilter = newFilter;
                boolean enabled = fActiveThreadsFilter.isEnabled();
                if (enabled) {
                    checkNotNull(getTimeGraphViewer()).addFilter(newFilter);
                }
                /*
                     * Prevent double refresh from change state of setChecked
                     * and ensure that a refresh is done if the mode of the
                     * filter is changed or options are changed
                     */
                if (previousFilter.isEnabled() && newFilter.isEnabled()) {
                    boolean changed = !Objects.equals(previousFilter.getCpuRanges(), newFilter.getCpuRanges()) || previousFilter.isCpuRangesBased() != newFilter.isCpuRangesBased();
                    if (changed) {
                        refresh();
                    }
                } else {
                    fActiveThreadsRapidToggle.setChecked(enabled);
                }
            }
        }
    };
}
Also used : IAction(org.eclipse.jface.action.IAction) FollowThreadAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction) Action(org.eclipse.jface.action.Action) DynamicFilterDialog(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.DynamicFilterDialog) ActiveThreadsFilter(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.ActiveThreadsFilter)

Example 2 with ActiveThreadsFilter

use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.ActiveThreadsFilter in project tracecompass by tracecompass.

the class ControlFlowView method traceSelected.

@TmfSignalHandler
@Override
public void traceSelected(TmfTraceSelectedSignal signal) {
    super.traceSelected(signal);
    /* Update the Flat and Hierarchical actions */
    synchronized (fFlatTraces) {
        if (fFlatTraces.contains(signal.getTrace())) {
            fHierarchicalAction.setChecked(false);
            fFlatAction.setChecked(true);
        } else {
            fFlatAction.setChecked(false);
            fHierarchicalAction.setChecked(true);
        }
    }
    /* Update the Dynamic Filters related actions */
    ViewerFilter activeThreadFilter = null;
    ViewerFilter[] traceFilters = getFiltersMap().get(signal.getTrace());
    if (traceFilters != null) {
        activeThreadFilter = getActiveThreadsFilter(traceFilters);
    }
    if (activeThreadFilter instanceof ActiveThreadsFilter) {
        fActiveThreadsFilter = (ActiveThreadsFilter) activeThreadFilter;
    } else {
        fActiveThreadsFilter = new ActiveThreadsFilter(null, false, getTrace());
    }
    fActiveThreadsRapidToggle.setChecked(fActiveThreadsFilter.isEnabled());
}
Also used : ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ActiveThreadsFilter(org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.ActiveThreadsFilter) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Aggregations

ActiveThreadsFilter (org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.ActiveThreadsFilter)2 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 FollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction)1 DynamicFilterDialog (org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.filters.DynamicFilterDialog)1 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)1