package org.eclipse.bpmn2.modeler.ui.property.tabs.builder;

import org.eclipse.bpmn2.BaseElement;
import org.eclipse.graphiti.ui.platform.GFPropertySection;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

/**
 * Base class for all factories
 * 
 * @author nico.rehwaldt
 */
public abstract class AbstractPropertiesBuilder<T extends BaseElement> {
	
	protected GFPropertySection section;
	protected T bo;
	protected Composite parent;

	public AbstractPropertiesBuilder(Composite parent, GFPropertySection section, T bo) {
		this.section = section;
		this.bo = bo;
		this.parent = parent;
	}

	/**
	 * Perform the actual create operation
	 */
	public abstract void create();

	/**
	 * 
	 * @param control
	 */
	public void relayout() {
		if (!parent.isDisposed()) {
			relayoutAll(parent);
		}
	}
	
	/**
	 * 
	 * @param parent
	 * @return
	 */
	private Composite relayoutAll(Composite parent) {
		parent.layout(true, true);
		parent.redraw();
		
		if (parent instanceof ScrolledComposite) {
			return parent;
		} else {
			return relayoutAll(parent.getParent());
		}
	}
}

@@ -151,16 +151,44 @@
 ection;%0A
+import org.eclipse.swt.SWT;%0A
 import o
@@ -305,15 +305,13 @@
 ets.
-Control
+Event
 ;%0A%0A/
@@ -791,27 +791,64 @@
 %09 * 
-%0A%09 * @param
+Relayout the properties after changes in the%0A%09 *
  control
 %0A%09 *
@@ -843,16 +843,19 @@
  control
+s. 
 %0A%09 */%0A%09p
@@ -882,59 +882,443 @@
 ) %7B%0A
-%09%09if (!parent.isDisposed()) %7B%0A%09%09%09relayoutAll(parent
+%0A%09%09// General challenge: We want the scroll panel to %0A%09%09// to update after the change in child elements %0A%09%09// The trick to achive this is to send the resize event%0A%09%09// to that particular composite.%0A%09%09if (!parent.isDisposed()) %7B%0A%09%09%09Composite scrollableComposite = getScrollableComposite(parent);%0A%0A%09%09%09Event e = new Event();%0A%09%09%09e.type = SWT.Resize;%0A%09%09%09%0A%09%09%09scrollableComposite.notifyListeners(SWT.Resize, e);%0A%09%09%09scrollableComposite.redraw(
 );%0A%09
@@ -1325,16 +1325,18 @@
 %09%7D%0A%09%7D%0A%09%0A
+%09%0A
 %09/**%0A%09 *
@@ -1340,145 +1340,174 @@
 %09 * 
-%0A%09 * @param parent%0A%09 * @return%0A%09 */%0A%09private Composite relayoutAll(Composite parent) %7B%0A%09%09parent.layout(true, true);%0A%09%09parent.redraw();%0A%09%09
+Returns the layout container directly contained in a scrollable.%0A%09 * %0A%09 * @param parent%0A%09 * @return%0A%09 */%0A%09private Composite getScrollableComposite(Composite parent) %7B
 %0A%09%09i
@@ -1591,19 +1591,30 @@
 urn 
-relayoutAll
+getScrollableComposite
 (par

Fix scrollable update