views:

69

answers:

1

I have a View class (extends ViewPart) that contains a ScrolledForm created from a FormToolkit. When certain events happen in other views in the app I want to change the form in this view and have it update in real time to the user.

I have property change support support added now and the following method in the View

    public void propertyChange(PropertyChangeEvent event) {
    form.dispose();
    toolkit.dispose();
    createForm( event );
    form.redraw();
}

where createForm( event ) recreates the form based on the event.

The problem is that the UI does not display the new form after this. I know the form is created OK because if I drag the border between the View and another view to resize it then the View is immediately updated to show the new form. How can I programmatically force the refresh of the view in the UI?

+1  A: 

Have you tried: form.reflow(true); ?

This will recompute the layout of the form.

If this fails than try calling xxx.layout(true) where 'xxx' is the variable mame of the SWT Composite that is the parent of the form instance. I assume the form is created against its parent composite in your createForm( event ) method?

tbone
Thanks! your assumption was correct about the parent is correct. Calling reflow alone did not work, but the call to layout(true) on the parent has solved the problem.
Alb