DESCRIPTION

Bug 475689 - Use Lambdas expression in JFace 

Change-Id: I31b47634f75e5707ff9ba303cd2516f6cd2e0556
Signed-off-by: Zaid Mosley xxx@xxx.xxx

COMMENTS

author: Zaid Mosley
date: 2015-08-24 08:55:03.000000000

Uploaded patch set 1.

-------------------------------------
author: Mariela Flores
date: 2015-08-24 09:14:53.000000000

Patch Set 1:

(11 comments)

I've added some comments where you can replace lamdas with method refs - I might have overlooked one but I guess I've found most of them

Line:76, bundles/org.eclipse.jface/src/org/eclipse/jface/commands/ActionHandler.java -> the indentation is wrong!

Line:1271, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java -> make it a method ref: StructuredViewer.this::handleOpen

Line:203, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java -> make it a method ref: this::clearCaches

Line:337, bundles/org.eclipse.jface/src/org/eclipse/jface/util/BidiUtils.java -> make it a method ref: listener::getSegments

Line:115, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/Viewer.java -> make it a method ref

Line:56, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerColumn.java -> make it a method ref

Line:82, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java -> make it a method ref this::clearCaches

Line:92, bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ImageAndMessageArea.java -> use a method ref: this::paint

Line:57, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java -> make it a method ref this::dispose

Line:273, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TextCellEditor.java -> make it a method ref: this::editOccurred

Line:221, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ContentViewer.java -> make it a method ref: this::handleDispose

-------------------------------------
author: Brenden Conley
date: 2015-08-24 09:28:05.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/6388/

-------------------------------------
author: Zaid Mosley
date: 2015-08-24 09:40:53.000000000

Patch Set 1:

Thanks Tom for the fast review. I'm still learning Java 8, can you give a short summary, why method references are better? If not, no worries, I can also find out myself.

-------------------------------------
author: Mariela Flores
date: 2015-08-24 09:45:29.000000000

Patch Set 1:

> Thanks Tom for the fast review. I'm still learning Java 8, can you
 > give a short summary, why method references are better? If not, no
 > worries, I can also find out myself.

They are not better but they make your code even more readable - in my custom code I fairly never use lamdas for event listeners unless they are only a line of code. In short your changes are fine but code be ever more java8ish ;-)

From a performance point of view you have one method indirection less (this is a guess!) but I think performance can be completely neglected in the code in question

-------------------------------------
author: Brenden Conley
date: 2015-08-24 09:50:40.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/6388/ : SUCCESS

-------------------------------------
author: Zaid Mosley
date: 2015-08-24 09:51:43.000000000

Patch Set 1:

Thanks Tom for the clarification. I will adjust the code according to your suggestion.

-------------------------------------
author: Zaid Mosley
date: 2015-08-26 07:10:52.000000000

Patch Set 2: Patch Set 1 was rebased

-------------------------------------
author: Zaid Mosley
date: 2015-08-26 08:00:23.000000000

Patch Set 1:

(11 comments)

Line:76, bundles/org.eclipse.jface/src/org/eclipse/jface/commands/ActionHandler.java -> Done

Line:1271, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java -> Done

Line:203, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java -> Done

Line:203, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java -> Done

Line:203, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java -> Done

Line:56, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerColumn.java -> Done

Line:82, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorRegistry.java -> Done

Line:92, bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ImageAndMessageArea.java -> Done

Line:57, bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java -> Done

Line:273, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TextCellEditor.java -> Done

Line:221, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ContentViewer.java -> Done

-------------------------------------
author: Gerrit Code Review
date: 2015-08-27 12:01:51.000000000

Project policy requires all submissions to be a fast-forward.

Please rebase the change locally and upload again for review.

-------------------------------------
author: Gerrit Code Review
date: 2015-09-03 18:42:17.000000000

Change has been successfully merged into the git repository by Zaid Mosley

-------------------------------------
