Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 138933

Summary: StructuredViewer.setComparator() is wrong
Product: [Eclipse Project] Platform Reporter: Oliver Albrecht <oliver.albrecht>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Oliver Albrecht CLA 2006-04-27 10:38:00 EDT
The following code can never succeed, because
this.sorter == sorter is always TRUE.
This is a C&P error (see setSorter()).

public void setComparator(ViewerComparator comparator){
		if (this.sorter != sorter){
			this.sorter = comparator;
			refresh();
		}
	}

The correct code is:

public void setComparator(ViewerComparator comparator){
		if (this.sorter != comparator){
			this.sorter = comparator;
			refresh();
		}
	}
Comment 1 Eric Moffatt CLA 2006-04-27 14:09:45 EDT

*** This bug has been marked as a duplicate of 137849 ***