Bug 578605

Summary: [performance] add java.nio.file.FileVisitor like ElementTreeIterator
Product: [Eclipse Project] Platform Reporter: Jörg Kubitz <jkubitz-eclipse>
Component: ResourcesAssignee: Platform-Resources-Inbox <platform-resources-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: loskutov
Version: 4.23   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Jörg Kubitz CLA 2022-02-06 15:47:00 EST
Some Visitors like that in "MarkerManager.visitorFindMaxSeverity" could stop early if some condition apply (in that case max Severity reached). But the IElementContentVisitor does not allow an early stop. It only allows to stop that further "*children* should be visited". Siblings (and there descendends!) are still executed leading to unnecessary work.
Would be good to add a new API or extend ElementTreeIterator like java.nio.file.FileVisitor which does allow to stop at various situations.
Also it would look nicer in stacktraces if it's not recursive but iterative like in java.nio.file.Files.walkFileTree().

... and then use it for findMaxProblemSeverity!
Comment 1 Andrey Loskutov CLA 2022-02-06 16:45:34 EST
Haven't checked code yet, but widely used pattern would be to throw OperationCancelledException from visitor and catch in the iterator.