diff options
| author | Robin Stocker | 2011-05-10 12:05:13 +0000 |
|---|---|---|
| committer | Matthias Sohn | 2011-05-10 12:05:13 +0000 |
| commit | 53abd780e442bb117ee22b138a95263fb19e2a5a (patch) | |
| tree | 649bb4ebb9fd755f9ca4e421d0e75d2c1c95fd20 | |
| parent | c70053785dff09aa888d87174bccffa63ff5d206 (diff) | |
| download | egit-53abd780e442bb117ee22b138a95263fb19e2a5a.tar.gz egit-53abd780e442bb117ee22b138a95263fb19e2a5a.tar.xz egit-53abd780e442bb117ee22b138a95263fb19e2a5a.zip | |
Allow preselection in branch selection dialog to enable OK button
In the reset branch selection dialog, the OK button was not enabled when
initially showing the dialog, even though all the user inputs were
already complete. Because of this, the user needed to select the already
selected branch again, to make it possible to press on the OK button.
Change-Id: Ieac356993186af909a0cbadee35227057ea65934
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2 files changed, 13 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java index 55053a8d57..33138267a9 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java @@ -12,7 +12,6 @@ package org.eclipse.egit.ui.test.team.actions; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import java.io.File; @@ -122,14 +121,16 @@ public class CompareActionsTest extends LocalRepositoryTestCase { String compareWithRefActionLabel = util .getPluginLocalizedValue("CompareWithBranchOrTagAction.label"); String dialogTitle = UIText.CompareTargetSelectionDialog_WindowTitle; + SWTBotShell dialog = openCompareWithDialog(compareWithRefActionLabel, dialogTitle); - // use the default (the last commit) -> no changes -> compare button - // disabled - assertFalse(dialog.bot() - .button(UIText.CompareTargetSelectionDialog_CompareButton) - .isEnabled()); + // use the default (the last commit) -> no changes + dialog.bot().button(UIText.CompareTargetSelectionDialog_CompareButton) + .click(); + waitUntilCompareTreeViewTreeHasNodeCount(0); + // use the tag -> should have a change + dialog = openCompareWithDialog(compareWithRefActionLabel, dialogTitle); dialog.bot().tree().getTreeItem(TAGS).expand().getNode("SomeTag") .select(); dialog.bot().button(UIText.CompareTargetSelectionDialog_CompareButton) diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/AbstractBranchSelectionDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/AbstractBranchSelectionDialog.java index c51400e9c9..d9804ad022 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/AbstractBranchSelectionDialog.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/AbstractBranchSelectionDialog.java @@ -255,6 +255,12 @@ public abstract class AbstractBranchSelectionDialog extends TitleAreaDialog { public void create() { super.create(); + // Initially disable OK button, as the required user inputs may not be + // complete after the dialog is first shown. If automatic selections + // happen after this (making the user inputs complete), the button will + // be enabled. + getButton(Window.OK).setEnabled(false); + List<RepositoryTreeNode> roots = new ArrayList<RepositoryTreeNode>(); if ((settings & SHOW_LOCAL_BRANCHES) != 0) roots.add(localBranches); @@ -286,8 +292,6 @@ public abstract class AbstractBranchSelectionDialog extends TitleAreaDialog { } catch (IOException e) { // ignore } - - getButton(Window.OK).setEnabled(false); } /** |
