aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 55053a8d5..33138267a 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 c51400e9c..d9804ad02 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);
}
/**