Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360069

Summary: WindowBuilder Databindings replaces existing usage of PojoProperties by BeanProperties
Product: z_Archived Reporter: Timo Rohrberg <timo.rohrberg>
Component: WindowBuilderAssignee: Andrey Sablin <sablin.andrey>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: clayberg
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Sample project to reproduce. none

Description Timo Rohrberg CLA 2011-10-06 03:17:45 EDT
Build Identifier: M20110909-1335

When using WindowBuilder to define databindings between a pojo and a WritableValue object via the "Bindings" tab, WindowBuilder replaces originally generated usages of "PojoProperties.value()" by "BeanProperties.value()". This happens every time when defining the databindings step-by-step, i.e. first defining one binding, returning to the code, and then subsequently defining the second, third, ... binding. This seems to be wrong since the pojo did not change and remains a pojo.

Reproducible: Always

Steps to Reproduce:
1. Create a simple pojo with at least to fields.
2. Create a view with at least to edit fields.
3. Define a WritableValue object within the view.
4. Create databinding between the pojo's first field and the first edit field using the WindowBuilder's "Bindings" feature.
5. Save changes, and return to code to inspect what WindowBuilder did: It created a databinding using "PojoProperties.value()".
6. Create the second databinding between the pojo's second field and the second edit field using the WindowBuilder's "Bindings" feature.
7. Save changes, and inspect code: WindowBuilder now replaced "PojoProperties.value()" by "BeanProperties.value()" in the first databinding, but created the second databinding with a "PojoProperties.value()".
Comment 1 Eric Clayberg CLA 2011-10-08 12:46:28 EDT
Please provide sample test code for this case.
Comment 2 Timo Rohrberg CLA 2011-10-10 02:26:54 EDT
Created attachment 204854 [details]
Sample project to reproduce.

Steps to reproduce error with included sample project:
1. Extract sample project within a new workspace.
2. Make sure option "Generate observables code for version 1.3 (over properties)" is enabled in Preferences > WindowBuilder > SWT > Code Generation > JFace Data Bindings.
3. Delete the following parts of code from SampleView class:
- private member m_bindingContext
- initialization of m_bindingContext in createPartControl() method
- method initDataBindings()
4. Open Bindings tab of WindowBuilder.
5. Define first binding (see first and second screenshot).
6. Save changes and switch back to code.
7. Observe that WindowBuilder created databinding using a PojoProperties.value() call.
8. Open Bindings tab of WindowBuilder again.
9. Define second binding (see third and fourth screenshot).
10. Save changes and switch back to code.
11. Observe that WindowBuilder now created second databinding using a PojoProperties.value(), but changed first databinding using a BeanProperties.value().
Comment 3 Andrey Sablin CLA 2011-10-26 04:48:37 EDT
Fixed in trunk.
Comment 4 Eric Clayberg CLA 2011-11-11 20:54:10 EST
Fixed