git: redesign the Update Project confirmation dialog a bit

After removing the stash/shelve selector, the dialog became empty. Adding more information to the Merge/Rebase options seems to solve the issue, and possibly let the options be more clear.

GitOrigin-RevId: 9a8de614084654ab8c828ff2edb75fae9dacac00
This commit is contained in:
Kirill Likhodedov
2019-10-13 15:02:11 +00:00
committed by intellij-monorepo-bot
parent cbddb55125
commit 28fb6e7694
4 changed files with 34 additions and 18 deletions
@@ -7,6 +7,7 @@ import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
import org.jetbrains.annotations.NotNull;
import java.util.LinkedHashMap;
@@ -32,7 +33,13 @@ public interface ActionInfo {
return new UpdateOrStatusOptionsDialog(project, VcsBundle.message("action.display.name.update.scope", scopeName), envToConfMap) {
@Override
protected String getActionNameForDimensions() {
return "update";
return "update-v2";
}
@NotNull
@Override
protected String getDoNotShowMessage() {
return "Don't show again";
}
@Override
@@ -216,7 +216,7 @@ internal class GitVcsPanel(private val project: Project,
EnumComboBoxModel(UpdateMethod::class.java),
{ projectSettings.updateMethod },
{ projectSettings.updateMethod = it!! },
renderer = SimpleListCellRenderer.create<UpdateMethod>("", UpdateMethod::asString)
renderer = SimpleListCellRenderer.create<UpdateMethod>("", UpdateMethod::getName)
)
}
}
@@ -24,24 +24,31 @@ public enum UpdateMethod {
/**
* Use default specified in the config file for the branch
*/
BRANCH_DEFAULT("Branch Default"),
BRANCH_DEFAULT("Branch Default", "Branch Default"),
/**
* Merge fetched commits with local branch
*/
MERGE("Merge"),
MERGE("Merge", "Merge the incoming changes into the current branch"),
/**
* Rebase local commits upon the fetched branch
*/
REBASE("Rebase");
REBASE("Rebase", "Rebase the current branch on top of the incoming changes");
@NotNull private final String myName;
@NotNull private final String myPresentation;
UpdateMethod(@NotNull String presentation) {
UpdateMethod(@NotNull String name, @NotNull String presentation) {
myName = name;
myPresentation = presentation;
}
@NotNull
public String asString() {
public String getName() {
return myName;
}
@NotNull
public String getPresentation() {
return myPresentation;
}
}
@@ -16,7 +16,10 @@
package git4idea.update
import com.intellij.openapi.ui.DialogPanel
import com.intellij.openapi.util.registry.Registry
import com.intellij.ui.layout.*
import com.intellij.ui.scale.JBUIScale
import com.intellij.util.ui.JBUI
import git4idea.config.GitVcsSettings
import git4idea.config.UpdateMethod
import git4idea.config.UpdateMethod.BRANCH_DEFAULT
@@ -24,21 +27,20 @@ import git4idea.config.UpdateMethod.BRANCH_DEFAULT
class GitUpdateOptionsPanel(private val settings: GitVcsSettings) {
val panel = createPanel()
fun createPanel(): DialogPanel =
panel {
titledRow("Update Type") {
buttonGroup {
getUpdateMethods().forEach { method ->
row {
radioButton(method.asString()).withSelectedBinding(PropertyBinding(
get = { settings.updateMethod == method },
set = { selected -> if (selected) settings.updateMethod = method }
))
}
private fun createPanel(): DialogPanel = panel {
row {
buttonGroup {
getUpdateMethods().forEach { method ->
row {
radioButton(method.getPresentation()).withSelectedBinding(PropertyBinding(
get = { settings.updateMethod == method },
set = { selected -> if (selected) settings.updateMethod = method }
))
}
}
}
}
}.withBorder(JBUI.Borders.empty(JBUIScale.scale(16), JBUIScale.scale(5), 0, JBUIScale.scale(5)))
fun isModified(): Boolean = panel.isModified()