diff --git a/platform/util/src/com/intellij/xml/util/XmlStringUtil.java b/platform/util/src/com/intellij/xml/util/XmlStringUtil.java
index f96fa4278a0d..e23ec07ef1ab 100644
--- a/platform/util/src/com/intellij/xml/util/XmlStringUtil.java
+++ b/platform/util/src/com/intellij/xml/util/XmlStringUtil.java
@@ -119,6 +119,22 @@ public class XmlStringUtil {
return HTML_START + result + HTML_END;
}
+ /**
+ *
+ * @param lines Text to be used for example in multi-line labels
+ * @return HTML where specified lines separated by <br> and each line wrapped in <nobr> to prevent breaking text inside
+ */
+ @NotNull
+ public static String wrapInHtmlLines(@NotNull CharSequence...lines) {
+ StringBuilder sb = new StringBuilder(HTML_START);
+ for (int i = 0; i < lines.length; i++) {
+ CharSequence sequence = lines[i];
+ if (i >0) sb.append("
");
+ sb.append("").append(sequence).append("");
+ }
+ return sb.append(HTML_END).toString();
+ }
+
public static boolean isWrappedInHtml(@NotNull String tooltip) {
return StringUtil.startsWithIgnoreCase(tooltip, HTML_START) &&
StringUtil.endsWithIgnoreCase(tooltip, HTML_END);
diff --git a/plugins/git4idea/src/git4idea/reset/GitNewResetDialog.java b/plugins/git4idea/src/git4idea/reset/GitNewResetDialog.java
index d9d41cfd56ee..d6c4126a4fa0 100644
--- a/plugins/git4idea/src/git4idea/reset/GitNewResetDialog.java
+++ b/plugins/git4idea/src/git4idea/reset/GitNewResetDialog.java
@@ -75,16 +75,17 @@ public class GitNewResetDialog extends DialogWrapper {
String description = prepareDescription(myProject, myCommits);
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(description)), gb.nextLine().next().coverLine());
- String explanation = "This will reset the current branch head to the selected commit,
" +
- "and update the working tree and the index according to the selected mode:";
- panel.add(new JBLabel(XmlStringUtil.wrapInHtml(explanation), UIUtil.ComponentStyle.SMALL), gb.nextLine().next().coverLine());
+ panel.add(new JBLabel(XmlStringUtil.wrapInHtmlLines(
+ "This will reset the current branch head to the selected commit,",
+ "and update the working tree and the index according to the selected mode:"
+ ), UIUtil.ComponentStyle.SMALL), gb.nextLine().next().coverLine());
for (GitResetMode mode : GitResetMode.values()) {
JBRadioButton button = new JBRadioButton(mode.getName());
button.setMnemonic(mode.getName().charAt(0));
myButtonGroup.add(button);
panel.add(button, gb.nextLine().next());
- panel.add(new JBLabel(XmlStringUtil.wrapInHtml(mode.getDescription()), UIUtil.ComponentStyle.SMALL), gb.next());
+ panel.add(new JBLabel(XmlStringUtil.wrapInHtmlLines(mode.getDescription()), UIUtil.ComponentStyle.SMALL), gb.next());
}
myEnumModel = RadioButtonEnumModel.bindEnum(GitResetMode.class, myButtonGroup);
diff --git a/plugins/git4idea/src/git4idea/reset/GitResetMode.java b/plugins/git4idea/src/git4idea/reset/GitResetMode.java
index 41252b1906b3..81606481bcdb 100644
--- a/plugins/git4idea/src/git4idea/reset/GitResetMode.java
+++ b/plugins/git4idea/src/git4idea/reset/GitResetMode.java
@@ -19,18 +19,18 @@ import org.jetbrains.annotations.NotNull;
public enum GitResetMode {
- SOFT("Soft", "--soft", "Files won't change, differences will be staged for commit."),
- MIXED("Mixed", "--mixed", "Files won't change, differences won't be staged."),
- HARD("Hard", "--hard", "Files will be reverted to the state of the selected commit.
" +
- "Warning: any local changes will be lost."),
- KEEP("Keep", "--keep", "Files will be reverted to the state of the selected commit,
" +
- "but local changes will be kept intact.");
+ SOFT("Soft", "--soft", "Files won't change, differences will be staged for commit."),
+ MIXED("Mixed", "--mixed", "Files won't change, differences won't be staged."),
+ HARD("Hard", "--hard", "Files will be reverted to the state of the selected commit.",
+ "Warning: any local changes will be lost."),
+ KEEP("Keep", "--keep", "Files will be reverted to the state of the selected commit,",
+ "but local changes will be kept intact.");
@NotNull private final String myName;
@NotNull private final String myArgument;
- @NotNull private final String myDescription;
+ @NotNull private final String[] myDescription;
- GitResetMode(@NotNull String name, @NotNull String argument, @NotNull String description) {
+ GitResetMode(@NotNull String name, @NotNull String argument, @NotNull String... description) {
myName = name;
myArgument = argument;
myDescription = description;
@@ -52,7 +52,7 @@ public enum GitResetMode {
}
@NotNull
- public String getDescription() {
+ public String[] getDescription() {
return myDescription;
}