Community
Participate
Working Groups
The reveal method does not always properly scroll when the last item in the list is specified. The reveal method seems to have several coding errors. A portion of the code (from 3.0RC3) is listed below: [a] int visibleCount = Math.max ((rect.x + rect.height) / height, 1); [b] int bottomIndex = Math.min (topIndex + visibleCount + 1, count - 1); if ((topIndex <= index) && (index <= bottomIndex)) return; [c] int newTop = Math.min (Math.max (index - (visibleCount / 2), 0), count - 1); list.setTopIndex(newTop); We note the following problems: [a]: rect.x in this expression seems wrong. In fact we think that rect.x + rect.height should be replaced simply with rect.height [b]: We believe that topIndex + visibleCount + 1 is incorrect, and should be topIndex + visibleCount - 1. This seems to be the source of the error. [c]: The outer "min" expression is superfluous. The max expression is proveably >= count-1. Larry Bergman and Tessa Lau
This is a bug in the code we copied from SWT, which has since been fixed (see bug 68950). I have only fixed [a] and [b], I did not change [c]. Released for builds >20051108.
Reopening because we have a test failure on MacOS. junit.framework.AssertionFailedError: topIndex should not change on setSelection expected:<19> but was:<18> at org.eclipse.jface.tests.viewers.ListViewerTest.testRevealBug69076(ListViewerTest.java:66) at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:330) at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:204) at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:35) at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
I have changed the test so that it does not run on Mac OS until bug 116105 is fixed.
Opened bug 120167 to track the issue with the test so that I can close this one.
Trying again to mark this as fixed.
Verified on Windows XP using I20051213-0010. The test is part of the suite and passes.