Summary: | [Viewers] DeferredContentProvider should use a stable sort algorithm | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Mario Winterer <mario.winterer> |
Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
Status: | NEW --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P4 | CC: | bjorn.arnelid, loskutov |
Version: | 3.8.2 | Keywords: | helpwanted |
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 509006 |
Description
Mario Winterer
2006-01-10 14:09:31 EST
Currently, we don't have the resources to address this. Patches (including JUnit test cases) would be welcome! Hitesh is now responsible for watching bugs in the [Viewers] component area. Bug still exists in Eclipse Neon.3 (4.6.3). (In reply to Mario Winterer from comment #3) > Bug still exists in Eclipse Neon.3 (4.6.3). And we still accept patches... I started to look at this defect, but im not so sure this is something that should be implemented. Since the responsibility of sorting lies on the Comparator i think the reasonable thing would be if the Comparator remembers previous sort orders instead of making the content provider care about sorting. In java 8 you could use the thenCompare method to add previous Comparators. No, that's not true. Stability is usually a property of the sort algorithm itself and has nothing to do with the comparison operator. E.g. Merge Sort is stable, while Quick Sort isn't. The question is if equal elements might switch their (relative) positions during sorting or not. I'm not sure if common partial sorting algorithms are usually stable or not. Possibly solving this issue might require a total new implementation of the sorting strategy. By the way - this issue is so old, I don't really care any more. But there is a easy workaround for this issue: We use a meta-comparator that delegates to a list of comparators for comparison. This list holds the current sort order comparator in its first place as well as all previously used comparators. Whenever a "current" comparator is set on the meta-comparator, it is inserted at the first position or, if already in the list, moved to the first position in the list. |