From 667b23e4c49250ae987f8c8b67041e3871d19058 Mon Sep 17 00:00:00 2001 From: Hong Anh Date: Mon, 1 Dec 2025 14:49:06 +0700 Subject: [PATCH 1/7] tmf.ui: make AbstractSelectTreeViewer2 injectable; add AbstractSelectTreeViewer3 and MultiTreePatternFilter2 for column-aware filtering Signed-off-by: Hong Anh --- .../META-INF/MANIFEST.MF | 8 +-- .../tree/AbstractSelectTreeViewer2.java | 2 +- .../tree/AbstractSelectTreeViewer3.java | 49 +++++++++++++++++++ .../dialogs/MultiTreePatternFilter.java | 13 ++++- .../dialogs/SpecificColumnPatternFilter.java | 46 +++++++++++++++++ 5 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java create mode 100644 tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF index 3ddb659da0..66b85fa764 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF +++ b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor -Bundle-Version: 9.1.2.qualifier +Bundle-Version: 9.2.0 Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ui;singleton:=true Bundle-Activator: org.eclipse.tracecompass.internal.tmf.ui.Activator @@ -30,7 +30,9 @@ Require-Bundle: org.eclipse.core.expressions, org.eclipse.tracecompass.tmf.filter.parser, org.eclipse.e4.ui.css.swt.theme, org.eclipse.ui.themes, - org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional + org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional, + org.eclipse.equinox.p2.ui;bundle-version="2.8.500", + org.eclipse.ui.browser;bundle-version="3.8.300" Export-Package: org.eclipse.tracecompass.internal.provisional.tmf.ui.model;x-internal:=true, org.eclipse.tracecompass.internal.provisional.tmf.ui.viewers.xychart;x-internal:=true, org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets;x-friends:="org.eclipse.tracecompass.analysis.timing.ui", @@ -151,5 +153,5 @@ Import-Package: com.google.common.annotations, org.apache.commons.io, org.eclipse.emf.common.util, org.eclipse.emf.ecore, - org.eclipse.tracecompass.traceeventlogger + org.eclipse.tracecompass.traceeventlogger;resolution:=optional Automatic-Module-Name: org.eclipse.tracecompass.tmf.ui diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java index 3a89939880..6740e36922 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer2.java @@ -220,7 +220,7 @@ public String getColumnText(Object element, int columnIndex) { * @param legendColumnIndex * index of the legend column (-1 if none) */ - private AbstractSelectTreeViewer2(Composite parent, TriStateFilteredCheckboxTree checkboxTree, + protected AbstractSelectTreeViewer2(Composite parent, TriStateFilteredCheckboxTree checkboxTree, int legendIndex, String id) { super(parent, checkboxTree.getViewer()); diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java new file mode 100644 index 0000000000..b2f6e3bf46 --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2017, 2025 Ericsson, Draeger Auriga + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ + +package org.eclipse.tracecompass.tmf.ui.viewers.tree; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataProvider; +import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.SpecificColumnPatternFilter; +import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.TriStateFilteredCheckboxTree; + +/** + * An abstract tree viewer that supports selection with filtering capabilities. + * + * This viewer extends + * {@link AbstractSelectTreeViewer2} + * to allow filtering based on a specific column index. + * + * @author Hong Anh + * @since 9.2 + */ +public abstract class AbstractSelectTreeViewer3 extends AbstractSelectTreeViewer2 { + /** + * Constructor + * + * @param parent + * Parent composite + * @param legendIndex + * index of the legend column (-1 if none) + * @param id + * {@link ITmfTreeDataProvider} ID + * @param indexColumnFilter + * the index of the column to apply the filter on + */ + public AbstractSelectTreeViewer3(Composite parent, int legendIndex, String id, int indexColumnFilter) { + // Initialize the tree viewer with a filtered checkbox tree and column-based filtering + super(parent, new TriStateFilteredCheckboxTree(parent, + SWT.MULTI | SWT.H_SCROLL | SWT.FULL_SELECTION, + new SpecificColumnPatternFilter(indexColumnFilter), true, false), legendIndex, id); + } +} diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/MultiTreePatternFilter.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/MultiTreePatternFilter.java index 73fb40826d..9a0490aeb8 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/MultiTreePatternFilter.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/MultiTreePatternFilter.java @@ -74,8 +74,8 @@ protected boolean isLeafMatch(Viewer viewer, Object element) { // Ensure the tree element and its parent(s) match the filter text for (Predicate p : fPredicates) { - // Retrieve tree element text and make verification. Text is at column 0 - String labelText = labelProvider.getColumnText(node, 0); + // Get the text of the element in the specified column and verify against the predicate + String labelText = labelProvider.getColumnText(node, this.getIndexColumnFilter()); if (labelText == null || !p.test(labelText)) { return false; } @@ -85,4 +85,13 @@ protected boolean isLeafMatch(Viewer viewer, Object element) { } return true; } + + /** + * Returns the index of the column used for filtering. + * @return the column index (default is 0) + * @since 9.2 + */ + protected int getIndexColumnFilter() { + return 0; + } } diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java new file mode 100644 index 0000000000..fcdc1df539 --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2017 Ericsson + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ + +package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs; + + +/** + * A filter that extends {@link MultiTreePatternFilter} to allow filtering + * based on a specific column index. + * + * This implementation enables users to apply multiple patterns (separated by '/') + * while specifying which column of the tree should be used for matching. + * + * @author Hong Anh + * @since 9.2 + */ + +public class SpecificColumnPatternFilter extends MultiTreePatternFilter { + private int index = 0; + + /** + * Creates a new filter with the specified column index. + * @param indexColumnFilter the index of the column to apply the filter on + */ + + public SpecificColumnPatternFilter(int indexColumnFilter) { + this.index = indexColumnFilter; + } + + /** + * Returns the index of the column used for filtering. + * @return the column index specified during construction + */ + @Override + protected int getIndexColumnFilter() { + return this.index; + } +} From f95ff5f00fe33fd6f6afd090f8fdf301dad458fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=93ng=20Anh?= <117706310+ShadowK2494@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:35:02 +0700 Subject: [PATCH 2/7] Update AbstractSelectTreeViewer3.java --- .../tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java index b2f6e3bf46..28c015abb1 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/viewers/tree/AbstractSelectTreeViewer3.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017, 2025 Ericsson, Draeger Auriga + * Copyright (c) 2025 Hong Anh * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License 2.0 which From 416ccd49ca891f1b2a1a1308682c748f62c2e117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=93ng=20Anh?= <117706310+ShadowK2494@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:36:00 +0700 Subject: [PATCH 3/7] Update SpecificColumnPatternFilter.java --- .../widgets/timegraph/dialogs/SpecificColumnPatternFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java index fcdc1df539..bf7d16dab4 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/SpecificColumnPatternFilter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Ericsson + * Copyright (c) 2025 Hong Anh * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License 2.0 which From 617a3ba99a5b56019e8a521d35e237b4567ec1b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=93ng=20Anh?= <117706310+ShadowK2494@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:47:54 +0700 Subject: [PATCH 4/7] Update MANIFEST.MF --- tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF index 66b85fa764..eaf02c4acd 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF +++ b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor -Bundle-Version: 9.2.0 +Bundle-Version: 9.2.0.qualifer Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ui;singleton:=true Bundle-Activator: org.eclipse.tracecompass.internal.tmf.ui.Activator From c9b4f9db1ce01a1e8e558fd7ecf24f8281656ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=93ng=20Anh?= <117706310+ShadowK2494@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:52:36 +0700 Subject: [PATCH 5/7] Update MANIFEST.MF --- tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF index eaf02c4acd..7cd00243cd 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF +++ b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF @@ -30,9 +30,7 @@ Require-Bundle: org.eclipse.core.expressions, org.eclipse.tracecompass.tmf.filter.parser, org.eclipse.e4.ui.css.swt.theme, org.eclipse.ui.themes, - org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional, - org.eclipse.equinox.p2.ui;bundle-version="2.8.500", - org.eclipse.ui.browser;bundle-version="3.8.300" + org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional Export-Package: org.eclipse.tracecompass.internal.provisional.tmf.ui.model;x-internal:=true, org.eclipse.tracecompass.internal.provisional.tmf.ui.viewers.xychart;x-internal:=true, org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets;x-friends:="org.eclipse.tracecompass.analysis.timing.ui", @@ -153,5 +151,5 @@ Import-Package: com.google.common.annotations, org.apache.commons.io, org.eclipse.emf.common.util, org.eclipse.emf.ecore, - org.eclipse.tracecompass.traceeventlogger;resolution:=optional + org.eclipse.tracecompass.traceeventlogger Automatic-Module-Name: org.eclipse.tracecompass.tmf.ui From a33eeeadf1c2b27bec38d4988a3367fe4b549d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=93ng=20Anh?= <117706310+ShadowK2494@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:53:14 +0700 Subject: [PATCH 6/7] Update MANIFEST.MF --- tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF index 7cd00243cd..ac10727697 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF +++ b/tmf/org.eclipse.tracecompass.tmf.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-Vendor: %Bundle-Vendor -Bundle-Version: 9.2.0.qualifer +Bundle-Version: 9.2.0.qualifier Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ui;singleton:=true Bundle-Activator: org.eclipse.tracecompass.internal.tmf.ui.Activator From aaf3da3200d8d3765f5341689502c771b705a006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=E1=BB=93ng=20Anh?= <117706310+ShadowK2494@users.noreply.github.com> Date: Tue, 16 Dec 2025 08:51:23 +0700 Subject: [PATCH 7/7] update pom.xml --- tmf/org.eclipse.tracecompass.tmf.ui/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/pom.xml b/tmf/org.eclipse.tracecompass.tmf.ui/pom.xml index ab8e98c03c..9b6550ddd4 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/pom.xml +++ b/tmf/org.eclipse.tracecompass.tmf.ui/pom.xml @@ -20,7 +20,7 @@ org.eclipse.tracecompass.tmf.ui - 9.1.2-SNAPSHOT + 9.2.0-SNAPSHOT eclipse-plugin