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>
This commit is contained in:

committed by
Shawn O. Pearce

parent
b17fa7d95e
commit
5b2259a32f
@@ -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
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user