-
Notifications
You must be signed in to change notification settings - Fork 210
Add cycle detection for e4.ui.dialogs.filteredtree.PatternFilter #2982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add cycle detection for e4.ui.dialogs.filteredtree.PatternFilter #2982
Conversation
Enabling it, prevents stack-overflows when handling trees/tables with recurring elements (which are not trees from a graph-theory point of view as these graphs have cycles).
Test Results 1 824 files ±0 1 824 suites ±0 1h 37m 44s ⏱️ -14s For more details on these failures, see this check. Results for commit 8d4263d. ± Comparison against base commit 13d5c4f. |
Does it really make sense to bake this check directly into the PatternFilter? From my understanding, cycles in a tree are the exception, rather than the norm. |
I expect the same, but for those cases where it happens I think it's better to have it available for all. But since if should be the exception I intend it as optional/opt-in feature with low overhead if not used. |
A tree is by definition an acyclic, directed graph. So running into a cycle indicates a flaw in the implementation (in this case the dependency viewer) and my concern is that this is now something encouraged by the Platform, rather than discouraged. You can then also enable this cycle check for a PatternFilter that is used in combination with a TableViewer (i.e. where cycles are impossible), which I think is weird... |
You really can't apply graph theory to an UI element, a In the case of the Dependency viewer many bundles can depend on the same package. So this package needs to appear more than once in a given tree as it is obviously a child of the bundle importing it. Now the provider of this package might be displayed then also multiple times and be a part of the tree as well. There might be other examples where you display a file system tree and if the file system allows symbolic links you also might show the "same" as a child when following this symbolic links. |
Which then makes this a disjoint union of trees.
But this is not what this issue is about. This is perfectly valid:
This is problematic:
Latter is also bad from a UX perspective, because for a non-trivial example, it's not obvious whether a bundle has just a really deep dependency chain or whether you have a cycle. But if you still think that this is a good idea, I can only encourage you to run |
If you have a real cycle A->B -> A PDE will complain as this is invalid in OSGi. Anyways whatever we do here it should not lead to endless recursion so it is e.g valid to simply break out and ignore further items. |
Whether this is supported by OSGi has nothing to do with this. The dependency viewer will still generate an infinite tree:
I agree. But this is something that should happen at the content provider, not the pattern filter. |
Enabling it, prevents stack-overflows when handling trees/tables with recurring elements (which are not trees from a graph-theory point of view as these graphs have cycles).
This is useful for example in
As far as I can tell, there are no testes for this class yet, I only found
PatternFilterTest
which tests the equivalentPatternFilter
from the packageorg.eclipse.ui.dialogs
. I'll check if the latter can be used as a foundation for this case.