DESCRIPTION

Bug 434283 - Update the JFace databinding snippets

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

COMMENTS

author: Krista Shepherd
date: 2014-10-01 09:55:22.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2014-10-01 09:55:28.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-10-01 10:10:48.000000000

Patch Set 1: Verified+1

Build Successful 

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

-------------------------------------
author: Zaid Mosley
date: 2014-10-01 10:20:46.000000000

Patch Set 1: Code-Review-1

(1 comment)

Please advoid casts to Class and use toClass http://docs.oracle.com/javase/tutorial/reflect/class/classNew.html

Line:265, examples/org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/nestedselection/TestMasterDetail.java -> I think the "normal" way of doing this is to use the toClass() method.

-------------------------------------
author: Krista Shepherd
date: 2014-10-01 10:27:53.000000000

Patch Set 1:

Unfortunately the getValueType() method may return null. Therefore I use this cast, because null can also be cast to (Class), but you cannot invoke a toClass() method on null.

-------------------------------------
author: Zaid Mosley
date: 2014-10-01 10:36:32.000000000

Patch Set 1:

I think BeanProperties does handle the null check internally. See public static IBeanValueProperty value(Class beanClass,
			String propertyName, Class valueType)

-------------------------------------
author: Krista Shepherd
date: 2014-10-01 11:39:50.000000000

Patch Set 1:

Yes it does, but nevertheless a Class object is expected by the method so that a cast is necessary.

This is the code, which the deprecated BeanObservables uses:

Class beanClass = null;
	if (master.getValueType() instanceof Class)
		beanClass = (Class) master.getValueType();
		return return BeanProperties.value(masterType, propertyName, propertyType)
				.observeDetail(master);

I tried to shorten this by using a direct cast.

-------------------------------------
author: Zaid Mosley
date: 2014-10-01 12:42:18.000000000

Patch Set 2: Patch Set 1 was rebased

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