/*******************************************************************************
 * Copyright (C) 2010, Robin Stocker <robin@nibor.org>
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.egit.ui.internal.preferences;

import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.UIText;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

/** Preferences for commit dialog. */
public class CommitDialogPreferencePage extends FieldEditorPreferencePage
		implements IWorkbenchPreferencePage {

	/** */
	public CommitDialogPreferencePage() {
		super(GRID);
		setTitle(UIText.CommitDialogPreferencePage_title);
	}

	public void init(IWorkbench workbench) {
		// Nothing to do
	}

	@Override
	protected IPreferenceStore doGetPreferenceStore() {
		return Activator.getDefault().getPreferenceStore();
	}

	@Override
	protected void createFieldEditors() {
		Composite main = getFieldEditorParent();

		Group formattingGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
		formattingGroup.setText(UIText.CommitDialogPreferencePage_formatting);
		GridDataFactory.fillDefaults().grab(true, false).span(3, 1)
				.applyTo(formattingGroup);

		BooleanFieldEditor hardWrap = new BooleanFieldEditor(
				UIPreferences.COMMIT_DIALOG_HARD_WRAP_MESSAGE,
				UIText.CommitDialogPreferencePage_hardWrapMessage, formattingGroup);
		hardWrap.getDescriptionControl(formattingGroup).setToolTipText(
				UIText.CommitDialogPreferencePage_hardWrapMessageTooltip);
		addField(hardWrap);

		Group footersGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
		footersGroup.setText(UIText.CommitDialogPreferencePage_footers);
		GridDataFactory.fillDefaults().grab(true, false).span(3, 1)
				.applyTo(footersGroup);

		BooleanFieldEditor createChangeId = new BooleanFieldEditor(
				UIPreferences.COMMIT_DIALOG_CREATE_CHANGE_ID,
				UIText.CommitDialogPreferencePage_createChangeId,
				footersGroup);
		createChangeId
				.getDescriptionControl(footersGroup)
				.setToolTipText(
						UIText.CommitDialogPreferencePage_createChangeIdTooltip);
		addField(createChangeId);

		BooleanFieldEditor signedOffBy = new BooleanFieldEditor(
				UIPreferences.COMMIT_DIALOG_SIGNED_OFF_BY,
				UIText.CommitDialogPreferencePage_signedOffBy,
				footersGroup);
		signedOffBy
				.getDescriptionControl(footersGroup)
				.setToolTipText(
						UIText.CommitDialogPreferencePage_signedOffByTooltip);
		addField(signedOffBy);
	}
}

@@ -876,16 +876,58 @@
 wt.SWT;%0A
+import org.eclipse.swt.layout.GridLayout;%0A
 import o
@@ -960,16 +960,16 @@
 posite;%0A
-
 import o
@@ -2196,16 +2196,50 @@
 rdWrap);
+%0A%09%09updateMargins(formattingGroup);
 %0A%0A%09%09Grou
@@ -3114,32 +3114,32 @@
 dOffByTooltip);%0A
-
 %09%09addField(signe
@@ -3147,13 +3147,292 @@
 OffBy);%0A
+%09%09updateMargins(footersGroup);%0A%09%7D%0A%0A%09private void updateMargins(Group group) %7B%0A%09%09// make sure there is some room between the group border%0A%09%09// and the controls in the group%0A%09%09GridLayout layout = (GridLayout) group.getLayout();%0A%09%09layout.marginWidth = 5;%0A%09%09layout.marginHeight = 5;%0A
 %09%7D%0A%7D%0A

Add some margins to "Commit Dialog" preference page