From aced78ab292f182281e429e29ac391cfb8bf8311 Mon Sep 17 00:00:00 2001 From: "shahzaib.ibrahim" Date: Mon, 22 Apr 2024 10:56:24 +0200 Subject: [PATCH] Code Review Changes --- .../ui/dialogs/filteredtree/FilteredTree.java | 27 +++++++-------- .../org/eclipse/ui/dialogs/FilteredTree.java | 33 ++++++++++--------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/bundles/org.eclipse.e4.ui.dialogs/src/org/eclipse/e4/ui/dialogs/filteredtree/FilteredTree.java b/bundles/org.eclipse.e4.ui.dialogs/src/org/eclipse/e4/ui/dialogs/filteredtree/FilteredTree.java index a7ece0071d8..383024c9c44 100644 --- a/bundles/org.eclipse.e4.ui.dialogs/src/org/eclipse/e4/ui/dialogs/filteredtree/FilteredTree.java +++ b/bundles/org.eclipse.e4.ui.dialogs/src/org/eclipse/e4/ui/dialogs/filteredtree/FilteredTree.java @@ -103,9 +103,10 @@ public class FilteredTree extends Composite { private static final long SOFT_MAX_EXPAND_TIME = 200; /** - * Time for refresh job delay in terms of expansion in long value + * Time delay after which the search is triggered, acting as a debounce + * mechanism. */ - private final long refreshJobDelay; + private final long refreshJobDelayInMillis; /** * Default time for refresh job delay in ms @@ -115,16 +116,16 @@ public class FilteredTree extends Composite { /** * Create a new instance of the receiver. * - * @param parent the parent Composite - * @param treeStyle the style bits for the Tree - * @param filter the filter to be used - * @param refreshDelayInMillis refresh delay in ms, the time to expand the tree - * after debounce - * @since 1.4 - */ - public FilteredTree(Composite parent, int treeStyle, PatternFilter filter, long refreshDelayInMillis) { + * @param parent the parent Composite + * @param treeStyle the style bits for the Tree + * @param filter the filter to be used + * @param refreshDelayTime refresh delay in ms, the time to expand the tree + * after debounce + * @since 1.5 + */ + public FilteredTree(Composite parent, int treeStyle, PatternFilter filter, long refreshDelayTime) { super(parent, SWT.NONE); - this.refreshJobDelay = refreshDelayInMillis; + this.refreshJobDelayInMillis = refreshDelayTime; init(treeStyle, filter); } @@ -148,7 +149,7 @@ public FilteredTree(Composite parent, int treeStyle, PatternFilter filter) { */ protected FilteredTree(Composite parent) { super(parent, SWT.NONE); - this.refreshJobDelay = DEFAULT_REFRESH_TIME; + this.refreshJobDelayInMillis = DEFAULT_REFRESH_TIME; } /** @@ -560,7 +561,7 @@ protected void textChanged() { * @since 3.5 */ protected long getRefreshJobDelay() { - return refreshJobDelay; + return refreshJobDelayInMillis; } /** diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java index aa63c952107..24e2d884217 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredTree.java @@ -150,7 +150,7 @@ public class FilteredTree extends Composite { /** * Time for refresh job delay in terms of expansion in long value */ - private final long refreshJobDelay; + private final long refreshJobDelayInMillis; /** * Default time for refresh job delay in ms @@ -181,7 +181,7 @@ public class FilteredTree extends Composite { public FilteredTree(Composite parent, boolean useNewLook, boolean useFastHashLookup) { super(parent, SWT.NONE); this.parent = parent; - this.refreshJobDelay = DEFAULT_REFRESH_TIME; + this.refreshJobDelayInMillis = DEFAULT_REFRESH_TIME; if (treeViewer != null) { treeViewer.setUseHashlookup(useFastHashLookup); } @@ -210,23 +210,24 @@ public FilteredTree(Composite parent, int treeStyle, PatternFilter filter, boole * *

* - * @param parent the parent Composite - * @param treeStyle the style bits for the Tree - * @param filter the filter to be used - * @param useNewLook ignored, keep for API compliance - * @param useFastHashLookup true, if tree should use fast hash lookup, false, - * if the tree should be slow but working for data - * with mutable or broken hashcode implementation. - * Only used if treeViewer is already initialized - * @param refreshDelayInMillis refresh delay in ms, the time to expand the tree - * after debounce + * @param parent the parent Composite + * @param treeStyle the style bits for the Tree + * @param filter the filter to be used + * @param useNewLook ignored, keep for API compliance + * @param useFastHashLookup true, if tree should use fast hash lookup, + * false, if the tree should be slow but working + * for data with mutable or broken hashcode + * implementation. Only used if treeViewer is + * already initialized + * @param refreshJobDelayInMillis refresh delay in ms, the time to expand the + * tree after debounce * @since 3.132 */ public FilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook, - boolean useFastHashLookup, long refreshDelayInMillis) { + boolean useFastHashLookup, long refreshJobDelayInMillis) { super(parent, SWT.NONE); this.parent = parent; - this.refreshJobDelay = refreshDelayInMillis; + this.refreshJobDelayInMillis = refreshJobDelayInMillis; init(treeStyle, filter); if (treeViewer != null) { treeViewer.setUseHashlookup(useFastHashLookup); @@ -257,7 +258,7 @@ public FilteredTree(Composite parent, int treeStyle, PatternFilter filter, boole @Deprecated protected FilteredTree(Composite parent) { super(parent, SWT.NONE); - this.refreshJobDelay = DEFAULT_REFRESH_TIME; + this.refreshJobDelayInMillis = DEFAULT_REFRESH_TIME; this.parent = parent; } @@ -778,7 +779,7 @@ protected void textChanged() { * @since 3.5 */ protected long getRefreshJobDelay() { - return refreshJobDelay; + return refreshJobDelayInMillis; } /**