Reputation: 984
This problem can maybe be generalized as a class communication problem and maybe there is a solution/pattern that solves this specific one.
I am using eclipse forms in a RCP application, each form has many sections.
Most of the sections are dependent i.e. if the user modifies something in section A I want immediately some changes in section B. I do this using listeners and I have all the sections code in the same class but is there any way to communicate these changes without having the all the code together so I can write more clear code?
Upvotes: 1
Views: 186
Reputation: 9535
You should use the Eclipse Databinding to implement dependencies between your Controls.
For example the following snippet binds the selection state of a checkbox to the enabled state of a textfield
ctx = new DataBindingContext();
ISWTObservableValue observe = WidgetProperties.selection().observe(myCheckBox);
ISWTObservableValue observe2 = WidgetProperties.enabled().observe(myTextField);
ctx.bindValue(observe, observe2)
Upvotes: 2