package de.afbb.bibo.ui.form;

import java.net.ConnectException;

import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import de.afbb.bibo.ui.BiboFormToolkit;

/**
 * super class for all forms
 * 
 * @author David Becker
 *
 */
public abstract class AbstractForm<Input> extends Composite {

	protected static final String EMPTY_STRING = "";//$NON-NLS-1$
	protected static final String DOT = ".";//$NON-NLS-1$

	protected final DataBindingContext bindingContext;
	protected final BiboFormToolkit toolkit;

	protected Input input;

	/**
	 * Constructor.<br>
	 * will be invoked by {@link AbstractFormDialog}
	 * 
	 * @param parent
	 *            parent composite
	 * @param input
	 *            input to bind in this form
	 * @param bindingContext
	 *            context that bindings should happen in. can be
	 *            <code>null</code>
	 * @param toolkit
	 * @throws ConnectException
	 */
	public AbstractForm(Composite parent, Input input, DataBindingContext bindingContext, BiboFormToolkit toolkit)
			throws ConnectException {
		this(parent, SWT.NONE, input, bindingContext, toolkit);
	}

	/**
	 * Constructor
	 * 
	 * @param parent
	 *            parent composite
	 * @param style
	 *            the style of widget to construct
	 * @param bindingContext
	 *            context that bindings should happen in. can be
	 *            <code>null</code>
	 * @throws ConnectException
	 */
	public AbstractForm(Composite parent, int style, Input input, DataBindingContext bindingContext,
			BiboFormToolkit toolkit) throws ConnectException {
		super(parent, style);
		this.input = input;
		this.bindingContext = bindingContext != null ? bindingContext : new DataBindingContext();
		this.toolkit = toolkit != null ? toolkit : new BiboFormToolkit(Display.getCurrent());
		createUi();
		initBinding();
	}

	/**
	 * creates a composite around the form that will expand automatically
	 * 
	 * @param parent
	 */
	protected void createUi() {
		GridLayout layoutOuter = new GridLayout(1, false);
		layoutOuter.marginHeight = layoutOuter.marginWidth = 0;
		setLayout(layoutOuter);
		initUi(this);
	}

	/**
	 * initializes the user interface of the editor
	 */
	protected abstract void initUi(final Composite parent);

	/**
	 * initializes the databinding for this form
	 * 
	 * @throws ConnectException
	 */
	protected abstract void initBinding() throws ConnectException;

	/**
	 * @return the input
	 */
	public Input getInput() {
		return input;
	}

	/**
	 * @param input
	 *            the input to set
	 */
	public void setInput(Input input) {
		this.input = input;
	}

	/**
	 * @return the bindingContext
	 */
	public DataBindingContext getBindingContext() {
		return bindingContext;
	}

}

@@ -1185,20 +1185,21 @@
 ion %7B%0A%09%09
-this
+super
 (parent,
@@ -1211,516 +1211,8 @@
 NONE
-, input, bindingContext, toolkit);%0A%09%7D%0A%0A%09/**%0A%09 * Constructor%0A%09 * %0A%09 * @param parent%0A%09 *            parent composite%0A%09 * @param style%0A%09 *            the style of widget to construct%0A%09 * @param bindingContext%0A%09 *            context that bindings should happen in. can be%0A%09 *            %3Ccode%3Enull%3C/code%3E%0A%09 * @throws ConnectException%0A%09 */%0A%09public AbstractForm(Composite parent, int style, Input input, DataBindingContext bindingContext,%0A%09%09%09BiboFormToolkit toolkit) throws ConnectException %7B%0A%09%09super(parent, style
 );%0A%09

remove second constructor in abstract form