From 5b2259a32f3e6cd7d76d4b098735931d889220b1 Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Fri, 15 Oct 2010 14:37:25 +0200 Subject: [PATCH] Disable checkbox for useContentMerge if 'Fast Forward Only' Disable the checkbox 'Automatically resolve conflicts' in the ProjectInfoScreen if 'Fast Forward Only' is chosen as submit type. Since the setting for the useContentMerge option is ignored if 'Fast Forward Only' is chosen as submit type it is only confusing to the user if this option is editable but has no effect. Change-Id: I963df4d577120e1671dd7e9faf195c600df6ff5e Signed-off-by: Edwin Kempin Signed-off-by: Shawn O. Pearce --- Documentation/config-replication.txt | 2 +- .../client/admin/ProjectInfoScreen.java | 33 +++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Documentation/config-replication.txt b/Documentation/config-replication.txt index 42920017b1..1e20d2b9a2 100644 --- a/Documentation/config-replication.txt +++ b/Documentation/config-replication.txt @@ -145,7 +145,7 @@ By default, 15 seconds. [[remote.name.replicationRetry]]remote..replicationRetry:: + Number of minutes to wait before scheduling a remote push operation -previously failed due offline remote server. +previously failed due to an offline remote server. + If a remote push operation fails because a remote server was offline, all push operations to the same destination URL are diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java index f424bff399..22fd8d9935 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java @@ -21,6 +21,9 @@ import com.google.gerrit.client.ui.OnEditEnabler; import com.google.gerrit.client.ui.SmallHeading; import com.google.gerrit.common.data.ProjectDetail; import com.google.gerrit.reviewdb.Project; +import com.google.gerrit.reviewdb.Project.SubmitType; +import com.google.gwt.event.dom.client.ChangeEvent; +import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Button; @@ -118,6 +121,12 @@ public class ProjectInfoScreen extends ProjectScreen { for (final Project.SubmitType type : Project.SubmitType.values()) { submitType.addItem(Util.toLongString(type), type.name()); } + submitType.addChangeHandler(new ChangeHandler() { + @Override + public void onChange(ChangeEvent event) { + setEnabledForUseContentMerge(); + } + }); saveEnabler.listenTo(submitType); projectOptionsPanel.add(submitType); @@ -132,6 +141,22 @@ public class ProjectInfoScreen extends ProjectScreen { add(projectOptionsPanel); } + /** + * Enables the {@link #useContentMerge} checkbox if the selected submit type + * allows the usage of content merge. + * If the submit type (currently only 'Fast Forward Only') does not allow + * content merge the useContentMerge checkbox gets disabled. + */ + private void setEnabledForUseContentMerge() { + if (SubmitType.FAST_FORWARD_ONLY.equals(Project.SubmitType + .valueOf(submitType.getValue(submitType.getSelectedIndex())))) { + useContentMerge.setEnabled(false); + useContentMerge.setValue(false); + } else { + useContentMerge.setEnabled(true); + } + } + private void initAgreements() { agreementsPanel = new VerticalPanel(); agreementsPanel.add(new SmallHeading(Util.C.headingAgreements())); @@ -148,14 +173,16 @@ public class ProjectInfoScreen extends ProjectScreen { } private void setSubmitType(final Project.SubmitType newSubmitType) { + int index = -1; if (submitType != null) { for (int i = 0; i < submitType.getItemCount(); i++) { if (newSubmitType.name().equals(submitType.getValue(i))) { - submitType.setSelectedIndex(i); - return; + index = i; + break; } } - submitType.setSelectedIndex(-1); + submitType.setSelectedIndex(index); + setEnabledForUseContentMerge(); } }