DESCRIPTION

Bug 442343 - Additional cleanup work in the JFace snippets

Removed unneccessary null check of ISelection and instead check if the
selection is empty

Change-Id: I1d04a66ff6955770f21c5fa08d9257b772e6eabd
Signed-off-by: Krista Shepherd xxx@xxx.xxx

COMMENTS

author: Krista Shepherd
date: 2014-08-23 22:13:59.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2014-08-23 22:14:04.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-08-23 22:23:45.000000000

Patch Set 1: Verified+1

Build Successful 

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

-------------------------------------
author: Teagan Marsh
date: 2014-08-24 15:45:33.000000000

Patch Set 1: Code-Review-1

You're right that the code has a bug, but there's no guarantee that Viewer#getSelection() doesn't return null.  Indeed AbstractViewer#getSelection() returns null.  You need both a not-null and not-empty.

-------------------------------------
author: Krista Shepherd
date: 2014-08-25 07:11:09.000000000

Patch Set 1:

Thank you Brian. So I will also add the null check again. But in my opinion every viewer should follow the Null-Pattern(http://en.wikipedia.org/wiki/Null_Object_pattern).
I also had this change: https://git.eclipse.org/r/#/c/32074/1 in the back of my mind, where the getStructuredSelection() method is used.
But you´re right because we cannot guarantee that this is always the case, as clients may override the getSelection() or getStructuredSelection() method and return null.

-------------------------------------
author: Zaid Mosley
date: 2014-08-25 12:06:26.000000000

Patch Set 1:

Ah, no unfortunately as Dani was faster than me. :-)

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