summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRobin Stocker2011-05-10 08:05:13 (EDT)
committer Matthias Sohn2011-05-10 08:05:13 (EDT)
commit53abd780e442bb117ee22b138a95263fb19e2a5a (patch)
tree649bb4ebb9fd755f9ca4e421d0e75d2c1c95fd20
parentc70053785dff09aa888d87174bccffa63ff5d206 (diff)
downloadegit-53abd780e442bb117ee22b138a95263fb19e2a5a.zip
egit-53abd780e442bb117ee22b138a95263fb19e2a5a.tar.gz
egit-53abd780e442bb117ee22b138a95263fb19e2a5a.tar.bz2
Allow preselection in branch selection dialog to enable OK buttonrefs/changes/58/3358/3
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>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java13
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/AbstractBranchSelectionDialog.java8
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 55053a8..3313826 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 c51400e..d9804ad 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);
}
/**