diff options
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/MergeTargetSelectionDialog.java')
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/MergeTargetSelectionDialog.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/MergeTargetSelectionDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/MergeTargetSelectionDialog.java index 38ec3d506f..a0247e5a12 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/MergeTargetSelectionDialog.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/MergeTargetSelectionDialog.java @@ -1,5 +1,7 @@ /******************************************************************************* * Copyright (c) 2010 SAP AG. + * Copyright (C) 2012, Tomasz Zarna <Tomasz.Zarna@pl.ibm.com> + * * 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 @@ -8,6 +10,7 @@ * Contributors: * Stefan Lay (SAP AG) - initial implementation * Mathias Kinzler (SAP AG) - use the abstract super class + * Tomasz Zarna (IBM) - merge squash, bug 382720 *******************************************************************************/ package org.eclipse.egit.ui.internal.dialogs; @@ -15,10 +18,17 @@ import java.io.IOException; import java.text.MessageFormat; import org.eclipse.egit.ui.UIText; +import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.window.Window; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Repository; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; /** @@ -27,6 +37,8 @@ import org.eclipse.swt.widgets.Shell; */ public class MergeTargetSelectionDialog extends AbstractBranchSelectionDialog { + private boolean mergeSquash = false; + /** * @param parentShell * @param repo @@ -86,4 +98,41 @@ public class MergeTargetSelectionDialog extends AbstractBranchSelectionDialog { getButton(Window.OK).setEnabled( !currentSelected && (branchSelected || tagSelected)); } + + @Override + protected void createCustomArea(Composite parent) { + Composite main = new Composite(parent, SWT.NONE); + main.setLayout(new GridLayout(1, false)); + GridDataFactory.fillDefaults().grab(true, false).applyTo(main); + Group g = new Group(main, SWT.NONE); + g.setText(UIText.MergeTargetSelectionDialog_MergeTypeGroup); + GridDataFactory.fillDefaults().grab(true, false).applyTo(g); + g.setLayout(new GridLayout(1, false)); + + Button commit = new Button(g, SWT.RADIO); + commit.setSelection(true); + commit.setText(UIText.MergeTargetSelectionDialog_MergeTypeCommitButton); + commit.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + if (((Button) event.widget).getSelection()) + mergeSquash = false; + } + }); + + Button squash = new Button(g, SWT.RADIO); + squash.setText(UIText.MergeTargetSelectionDialog_MergeTypeSquashButton); + squash.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + if (((Button) event.widget).getSelection()) + mergeSquash = true; + } + }); + } + + /** + * @return whether the merge is to be squashed + */ + public boolean isMergeSquash() { + return mergeSquash; + } } |