Bug 407927 - [Bidi] New API Combo#addSegmentListener(SegmentListener)
Summary: [Bidi] New API Combo#addSegmentListener(SegmentListener)
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.4 M6   Edit
Assignee: Lina Kemmel CLA
QA Contact: Lina Kemmel CLA
URL:
Whiteboard:
Keywords:
Depends on: 230854
Blocks: 427794
  Show dependency tree
 
Reported: 2013-05-13 13:14 EDT by Markus Keller CLA
Modified: 2014-03-06 11:35 EST (History)
7 users (show)

See Also:


Attachments
Combo win32 patch (26.61 KB, patch)
2013-10-24 08:48 EDT, Lina Kemmel CLA
Lina.Kemmel: review+
Details | Diff
Test case (8.77 KB, text/plain)
2013-10-24 08:52 EDT, Lina Kemmel CLA
no flags Details
JUnit tests (5.37 KB, patch)
2014-02-26 09:11 EST, Lina Kemmel CLA
no flags Details | Diff
Addition for N&N (8.03 KB, text/html)
2014-03-06 07:10 EST, Lina Kemmel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2013-05-13 13:14:25 EDT
The Combo#addSegmentListener(SegmentListener) API was dropped at some point in bug 230854. For bug 407865, we'd need that.
Comment 1 Daniel Rolka CLA 2013-10-10 09:07:11 EDT
We need it fixed for Bug 178081

Daniel
Comment 2 Lina Kemmel CLA 2013-10-24 08:48:11 EDT
Created attachment 236840 [details]
Combo win32 patch

Initial version of win32 patch.
Should be in sync with what we did in bug 230854 for Text, plus contain changes specific to list items of a Combo.
Comment 3 Lina Kemmel CLA 2013-10-24 08:52:56 EDT
Created attachment 236841 [details]
Test case
Comment 4 Lina Kemmel CLA 2014-01-30 08:51:52 EST
Please note that some functionality/code common to Text and Combo can be extracted to some shared location and reused by both.
Comment 5 Lina Kemmel CLA 2014-01-30 08:55:01 EST
Any comments on the patch? Lakshmi? Markus?
Comment 6 Markus Keller CLA 2014-01-30 14:48:10 EST
Sorry, I'm completely absorbed by Java 8 work, and I'm also not a master of SWT/win32 internals. CCing Arun.
Comment 7 Lina Kemmel CLA 2014-02-10 08:13:37 EST
Thanks, Markus.

Hi Arun,

The proposed API changes are only:
   - addSegmentListener (SegmentListener listener)
   - removeSegmentListener (SegmentListener listener)

==========
And I just noticed a problem here: https://bugs.eclipse.org/bugs/attachment.cgi?id=236840&action=diff#a/bundles/org.eclipse.swt/Eclipse_sec10

It was supposed to be:
    if (hooks (SWT.Segments) || filters (SWT.Segments)) return items [index];
(logical OR, not AND)

Thanks!
Comment 8 Lina Kemmel CLA 2014-02-26 09:11:49 EST
Created attachment 240334 [details]
JUnit tests

Hi Arun,
The new JUnit test I am uploading fails with the last Combo patch at Combo#removeAll, since OS.CB_RESETCONTENT should also reset the internal item list. I have fixed this problem locally and will reupload the Combo patch. I think it should include any other fixes that would be necessary.
Comment 9 Arun Thondapu CLA 2014-02-26 15:42:19 EST
Hi Lina,

Thanks for coming up with those very comprehensive unit tests! I'll run these against the new patch once you upload it. As for testing the RTL orientation of the Combo itself, the test_setOrientationI() test probably covers it already and we would not need to add anything new, isn't it?

Regarding the changes that are in the currently uploaded patch, with my limited knowledge of the SWT win32 code, I could not find any major issues as such. There are a few minor comments I wanted to add though.

The API javadoc should be modified as it states that the API is available on Windows and GTK which is not the case as of now. 

Is it okay to remove the line of commented code in applyListSegments () ?
//if ((style & SWT.H_SCROLL) != 0) setScrollWidth (buffer, true);

At https://bugs.eclipse.org/bugs/attachment.cgi?id=236840&action=diff#a/bundles/org.eclipse.swt/Eclipse_sec25 - the else check can probably be removed from case OS.EM_CANUNDO.

At https://bugs.eclipse.org/bugs/attachment.cgi?id=236840&action=diff#a/bundles/org.eclipse.swt/Eclipse_sec26 - there seems to be some indentation problem at line number 2636.

In the switch case code that is introduced in multiple places, it would be better to indent the case statements so that it is more consistent with the existing switch case statements. This is not a must fix, so feel free to ignore if you think its alright.

Like I said, all these changes are mostly cosmetic, the actual patch itself seems to be in very good shape already and seems to work as expected too. So, I'm fine if you want to go ahead and commit the patch with these minor modifications without another review. However, if you want me to take another look at a new patch, please let me know. Thanks!
Comment 10 Arun Thondapu CLA 2014-02-27 13:41:18 EST
Hi Lina,

Let me know when you're planning to upload/push your new patch. We should try to get it done by end of Friday as next week would be the M6 milestone week...
Comment 11 Lina Kemmel CLA 2014-02-28 06:12:22 EST
Hi Arun, thank you so much for your review! I hope I addressed all your comments. I am doing some more manual testing with various |SegmentListener|s and will upload/push the new patch by Sunday. Thanks!
Comment 12 Lina Kemmel CLA 2014-02-28 06:16:17 EST
(In reply to Arun Thondapu from comment #9)
> As for testing the RTL orientation of the Combo itself, the
> test_setOrientationI() test probably covers it already and we would not need 
> to add anything new, isn't it?

Yes, I also think so. (However, I added setOrientation to the manual test to make sure SegmentListener behaves correctly in both of the orientations.)
Comment 14 Tomer Mahlin CLA 2014-03-03 05:28:07 EST
Hi Arun, do you have any outstanding comments ? If not, can you please deliver this patch ? 
 For functionality provided in this bug to be properly leveraged we must extend additional API in BidiUtil (for more details please see bug 427794 ).
Plugins (Eclipse components in general) are going to leverage functionality from this bug only through this API - applyBidiProcessing.
Due to this dependency it would help a lot if the current patch is delivered asap (unless you have outstanding comments of course). 

Many thank in advance for your help and support.
Comment 15 Lina Kemmel CLA 2014-03-03 05:44:58 EST
Hi Tomer, the changes are delivered already.
Comment 16 Tomer Mahlin CLA 2014-03-03 05:54:23 EST
Sorry for the ignorance :-)) Many thanks Lina & Arun.
Comment 17 Arun Thondapu CLA 2014-03-03 06:12:41 EST
(In reply to Lina Kemmel from comment #15)
> Hi Tomer, the changes are delivered already.

Yep, it would be a good idea to test them in the latest available I-build here - http://download.eclipse.org/eclipse/downloads/drops4/I20140302-2000/

The newly added unit test has failed on Mac and Linux as expected, I'll add some guarding code to the test to make sure it executes only on Windows.

Lina, we need to include this new API in the New & Noteworthy for M6. Can you please provide me a brief summary of the API that I can add to the N&N? Thanks in advance!
Comment 18 Lina Kemmel CLA 2014-03-03 09:30:44 EST
(In reply to Arun Thondapu from comment #17)
> Yep, it would be a good idea to test them in the latest available I-build
> here - http://download.eclipse.org/eclipse/downloads/drops4/I20140302-2000/
> 
I will test that, thanks.

> The newly added unit test has failed on Mac and Linux as expected, I'll add
> some guarding code to the test to make sure it executes only on Windows.
> 
Yes, it fails at listenerCalled checks, since a SegmentEvent is not sent and the listener is not called on those platforms. Sorry, I had to take this into account.

	if (!SwtTestUtil.isWindows) {
		// TODO Fix GTK and Cocoa failure.
		if (SwtTestUtil.verbose) {
			System.out
					.println("Excluded test_consistency_Segments(org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Text).");
		}
		return;
	}

> Lina, we need to include this new API in the New & Noteworthy for M6. Can
> you please provide me a brief summary of the API that I can add to the N&N?
> Thanks in advance!
Yes sure.
Comment 19 Arun Thondapu CLA 2014-03-03 10:15:17 EST
(In reply to Lina Kemmel from comment #18)
> Yes, it fails at listenerCalled checks, since a SegmentEvent is not sent and
> the listener is not called on those platforms. Sorry, I had to take this
> into account.

Yes, this is the guarding code I was meaning to add too. Are you going to commit the change? We can verify in the next I-build's test runs.

> 
> 	if (!SwtTestUtil.isWindows) {
> 		// TODO Fix GTK and Cocoa failure.
> 		if (SwtTestUtil.verbose) {
> 			System.out
> 					.println("Excluded
> test_consistency_Segments(org.eclipse.swt.tests.junit.
> Test_org_eclipse_swt_widgets_Text).");

This should be changed to Combo.

> 		}
> 		return;
> 	}
> 

Thanks!
Comment 20 Arun Thondapu CLA 2014-03-03 14:04:08 EST
Disabled the test for GTK+ and Cocoa - http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=c750b3a5a941178a0d38e5a0532e6c1b936c0c50

Marking the bug as resolved.
Comment 21 Lina Kemmel CLA 2014-03-04 15:08:13 EST
(In reply to Arun Thondapu from comment #17)

> Yep, it would be a good idea to test them in the latest available I-build
> here - http://download.eclipse.org/eclipse/downloads/drops4/I20140302-2000/
> 

It seems to behave properly in the I20140302-2000 build. Marking as Verified.
Thanks, Arun, for all your help and guidance.
Comment 22 Arun Thondapu CLA 2014-03-05 08:06:58 EST
(In reply to Lina Kemmel from comment #21)
> (In reply to Arun Thondapu from comment #17)
> 
> > Yep, it would be a good idea to test them in the latest available I-build
> > here - http://download.eclipse.org/eclipse/downloads/drops4/I20140302-2000/
> > 
> 
> It seems to behave properly in the I20140302-2000 build. Marking as Verified.
> Thanks, Arun, for all your help and guidance.

You're welcome Lina! Do you have the content for the N&N ready yet? We need to submit it by tomorrow.
Comment 23 Lina Kemmel CLA 2014-03-06 07:10:19 EST
Created attachment 240587 [details]
Addition for N&N

Arun, please let me know if it's okay for N&N.
I would also like to add a snippet referenced in the N&N.
Comment 24 Arun Thondapu CLA 2014-03-06 08:55:50 EST
(In reply to Lina Kemmel from comment #23)
> Created attachment 240587 [details]
> Addition for N&N
> 
> Arun, please let me know if it's okay for N&N.
> I would also like to add a snippet referenced in the N&N.

Looks good to me. Please push the snippet as well as the N&N content (along with the screenshot) directly to the git repo. Thanks!
Comment 25 Lina Kemmel CLA 2014-03-06 11:35:29 EST
Thank you, done!