Search in sources :

Example 1 with TmfFilterObjectNode

use of org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterObjectNode in project tracecompass by tracecompass.

the class TmfEventsTable method removeFilter.

/**
 * Remove a filter. Any other existing filters remain applied.
 *
 * @param filter
 *            The filter to remove
 * @since 2.0
 */
protected void removeFilter(ITmfFilter filter) {
    ITmfFilterTreeNode rootFilter = (ITmfFilterTreeNode) fTable.getData(Key.FILTER_OBJ);
    if (rootFilter == null) {
        return;
    }
    stopFilterThread();
    stopSearchThread();
    fFilterMatchCount = 0;
    fFilterCheckCount = 0;
    if (filter instanceof TmfCollapseFilter) {
        fCollapseFilterEnabled = false;
    } else if (filter instanceof ITmfFilterTreeNode) {
        rootFilter.removeChild((ITmfFilterTreeNode) filter);
    } else {
        for (ITmfFilterTreeNode child : rootFilter.getChildren()) {
            if (child instanceof TmfFilterObjectNode) {
                if (((TmfFilterObjectNode) child).getFilter().equals(filter)) {
                    rootFilter.removeChild(child);
                    break;
                }
            }
        }
    }
    if (!rootFilter.hasChildren() && !fCollapseFilterEnabled) {
        clearFilters();
        return;
    }
    fCache.applyFilter(rootFilter, fCollapseFilterEnabled);
    fHeaderBar.removeFilter(filter);
    fTable.clearAll();
    fTable.setData(Key.FILTER_OBJ, rootFilter);
    /* +1 for header row, +2 for top and bottom filter status rows */
    fTable.setItemCount(3);
    startFilterThread();
    fireFilterApplied(rootFilter);
    // Set original width
    fTable.getColumns()[MARGIN_COLUMN_INDEX].setWidth(0);
    packMarginColumn();
}
Also used : ITmfFilterTreeNode(org.eclipse.tracecompass.tmf.core.filter.model.ITmfFilterTreeNode) TmfCollapseFilter(org.eclipse.tracecompass.internal.tmf.core.filter.TmfCollapseFilter) TmfFilterObjectNode(org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterObjectNode)

Example 2 with TmfFilterObjectNode

use of org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterObjectNode in project tracecompass by tracecompass.

the class TmfEventsTable method applyEventFilter.

private ITmfFilterTreeNode applyEventFilter(ITmfFilter filter) {
    stopFilterThread();
    stopSearchThread();
    fFilterMatchCount = 0;
    fFilterCheckCount = 0;
    ITmfFilterTreeNode rootFilter = (ITmfFilterTreeNode) fTable.getData(Key.FILTER_OBJ);
    if (rootFilter == null) {
        rootFilter = new TmfFilterRootNode();
    }
    if (filter instanceof TmfFilterRootNode) {
        TmfFilterRootNode parentFilter = (TmfFilterRootNode) filter;
        for (ITmfFilterTreeNode child : parentFilter.getChildren()) {
            rootFilter.addChild(child);
        }
    } else if (filter instanceof TmfCollapseFilter) {
        fCollapseFilterEnabled = true;
    } else if (filter instanceof ITmfFilterTreeNode) {
        rootFilter.addChild((ITmfFilterTreeNode) filter);
    } else {
        rootFilter.addChild(new TmfFilterObjectNode(filter));
    }
    fCache.applyFilter(rootFilter, fCollapseFilterEnabled);
    fHeaderBar.addFilter(filter);
    fTable.clearAll();
    fTable.setData(Key.FILTER_OBJ, rootFilter);
    /* +1 for header row, +2 for top and bottom filter status rows */
    fTable.setItemCount(3);
    startFilterThread();
    return rootFilter;
}
Also used : ITmfFilterTreeNode(org.eclipse.tracecompass.tmf.core.filter.model.ITmfFilterTreeNode) TmfFilterRootNode(org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterRootNode) TmfCollapseFilter(org.eclipse.tracecompass.internal.tmf.core.filter.TmfCollapseFilter) TmfFilterObjectNode(org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterObjectNode)

Aggregations

TmfCollapseFilter (org.eclipse.tracecompass.internal.tmf.core.filter.TmfCollapseFilter)2 ITmfFilterTreeNode (org.eclipse.tracecompass.tmf.core.filter.model.ITmfFilterTreeNode)2 TmfFilterObjectNode (org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterObjectNode)2 TmfFilterRootNode (org.eclipse.tracecompass.tmf.core.filter.model.TmfFilterRootNode)1