summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-19 21:47:02 (EDT)
committer Kevin Sawicki2011-04-19 21:47:02 (EDT)
commit3b977c21418118dbeb2575961e67ba459097ee09 (patch)
tree76657537b57458541843c8892fe947f7e7830725
parent68823579ee9195cf61db8d9cae9fbd629c7aad19 (diff)
downloadegit-3b977c21418118dbeb2575961e67ba459097ee09.zip
egit-3b977c21418118dbeb2575961e67ba459097ee09.tar.gz
egit-3b977c21418118dbeb2575961e67ba459097ee09.tar.bz2
[sync] Correct enablement of synchronize page finish button.refs/changes/80/3180/2
Consolidate validation of page to single method that verifies at least one repository is selected a branch is selected for each repository selected. Bug: 343326 Change-Id: I0ddc92e039f0d5cb6954b503b2344ed2ee357c9a Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitSynchronizeWizardPage.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitSynchronizeWizardPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitSynchronizeWizardPage.java
index 946ac29..412ef4b 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitSynchronizeWizardPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitSynchronizeWizardPage.java
@@ -155,8 +155,7 @@ class GitSynchronizeWizardPage extends WizardPage {
treeViewer.refresh(element, true);
}
- setPageComplete(selectedBranches.size() == selectedRepositories
- .size());
+ validatePage();
}
@Override
@@ -262,13 +261,7 @@ class GitSynchronizeWizardPage extends WizardPage {
selectedProjects.clear();
save();
-
- if (event.getChecked()) {
- setPageComplete(selectedBranches.size() == selectedRepositories
- .size());
- } else if (treeViewer.getCheckedElements().length == 0) {
- setPageComplete(false);
- }
+ validatePage();
}
});
@@ -286,8 +279,7 @@ class GitSynchronizeWizardPage extends WizardPage {
public void handleEvent(Event event) {
treeViewer.setCheckedElements(array);
save();
- setPageComplete(selectedBranches.size() == selectedRepositories
- .size());
+ validatePage();
}
});
selectAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false,
@@ -302,8 +294,7 @@ class GitSynchronizeWizardPage extends WizardPage {
// clear all selection
selectedRepositories.clear();
selectedProjects.clear();
- // mark page as being incomplete
- setPageComplete(false);
+ validatePage();
}
});
deselectAllBtn.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING,
@@ -346,6 +337,17 @@ class GitSynchronizeWizardPage extends WizardPage {
}
}
+ private void validatePage() {
+ boolean complete = !selectedRepositories.isEmpty();
+ if (complete)
+ for (Repository repository : selectedRepositories)
+ if (!selectedBranches.containsKey(repository)) {
+ complete = false;
+ break;
+ }
+ setPageComplete(complete);
+ }
+
Map<Repository, String> getSelectedBranches() {
return selectedBranches;
}