summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Kempin <edwin.kempin@sap.com>2010-10-15 14:37:25 +0200
committerShawn O. Pearce <sop@google.com>2010-10-29 15:42:45 -0700
commit5b2259a32f3e6cd7d76d4b098735931d889220b1 (patch)
tree0f787c82ca7ff0884709d619096e643bcaff570c
parentb17fa7d95e3522d0c7a922b2f3843942281a8f25 (diff)
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 <edwin.kempin@gmail.com> Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--Documentation/config-replication.txt2
-rw-r--r--gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java33
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.<name>.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();
}
}