mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] replace XmlStringUtil usages
GitOrigin-RevId: b7affdc46a4f861dcf1e9c6a9c9319388571f806
This commit is contained in:
committed by
intellij-monorepo-bot
parent
712d561108
commit
ff8ca4960c
@@ -13,6 +13,8 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.openapi.util.text.HtmlBuilder;
|
||||
import com.intellij.openapi.util.text.HtmlChunk;
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManager;
|
||||
import com.intellij.openapi.vcs.changes.ui.PlusMinus;
|
||||
@@ -31,7 +33,6 @@ import com.intellij.util.treeWithCheckedNodes.TreeNodeState;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.VcsLogBundle;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -237,10 +238,13 @@ public class VcsStructureChooser extends DialogWrapper {
|
||||
selectedLabel.setText("");
|
||||
}
|
||||
else {
|
||||
String errorText = "<font color=red>(" +
|
||||
VcsLogBundle.message("vcs.log.filters.structure.max.selected.error.message", MAX_FOLDERS) +
|
||||
")</font>";
|
||||
selectedLabel.setText(XmlStringUtil.wrapInHtml(VcsLogBundle.message("vcs.log.filters.structure.label", errorText)));
|
||||
HtmlChunk.Element errorText =
|
||||
HtmlChunk.text("(" + VcsLogBundle.message("vcs.log.filters.structure.max.selected.error.message", MAX_FOLDERS) + ")")
|
||||
.wrapWith(HtmlChunk.tag("font").attr("color", "red"));
|
||||
selectedLabel.setText(new HtmlBuilder()
|
||||
.appendRaw((VcsLogBundle.message("vcs.log.filters.structure.label", errorText.toString())))
|
||||
.wrapWith("html")
|
||||
.toString());
|
||||
}
|
||||
selectedLabel.revalidate();
|
||||
}
|
||||
|
||||
+14
-13
@@ -2,22 +2,22 @@
|
||||
package com.intellij.vcs.log.ui.frame;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.HtmlBuilder;
|
||||
import com.intellij.openapi.util.text.HtmlChunk;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.ui.FontUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.text.DateFormatUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.commit.message.CommitMessageInspectionProfile;
|
||||
import com.intellij.vcs.commit.message.SubjectLimitInspection;
|
||||
import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.util.VcsUserUtil;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
import com.intellij.xml.CommonXmlStrings;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -98,7 +98,7 @@ public final class CommitPresentationUtil {
|
||||
String hash = matcher.group();
|
||||
|
||||
if (resolvedHashes.contains(hash)) {
|
||||
hash = XmlStringUtil.formatLink(GO_TO_HASH + hash, hash);
|
||||
hash = HtmlChunk.link(GO_TO_HASH + hash, hash).toString();
|
||||
}
|
||||
matcher.appendReplacement(result, hash);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public final class CommitPresentationUtil {
|
||||
if (commitTime == null) {
|
||||
boolean withEmail = !committer.getEmail().isEmpty();
|
||||
String by = VcsUserUtil.getShortPresentation(committer) +
|
||||
(withEmail ? "</span>" + getEmailText(committer) + graySpan : "");
|
||||
(withEmail ? "</span>" + " " + getEmailLink(committer) + graySpan : "");
|
||||
builder.append(VcsLogBundle.message("vcs.log.details.committer.info.user", by));
|
||||
builder.append("</span>");
|
||||
return builder.toString();
|
||||
@@ -225,7 +225,7 @@ public final class CommitPresentationUtil {
|
||||
if (committer != null) {
|
||||
boolean withEmail = !committer.getEmail().isEmpty();
|
||||
String by = VcsUserUtil.getShortPresentation(committer) +
|
||||
(withEmail ? "</span>" + getEmailText(committer) + graySpan : "");
|
||||
(withEmail ? "</span>" + (" " + getEmailLink(committer)) + graySpan : "");
|
||||
String committedBy = VcsLogBundle.message("vcs.log.details.committer.info.user.date.time", by, date, time);
|
||||
builder.append(committedBy);
|
||||
}
|
||||
@@ -240,13 +240,12 @@ public final class CommitPresentationUtil {
|
||||
@NotNull
|
||||
private static String getAuthorName(@NotNull VcsUser user) {
|
||||
String username = VcsUserUtil.getShortPresentation(user);
|
||||
return user.getEmail().isEmpty() ? username : username + getEmailText(user);
|
||||
return user.getEmail().isEmpty() ? username : username + " " + getEmailLink(user);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNls
|
||||
private static String getEmailText(@NotNull VcsUser user) {
|
||||
return " " + XmlStringUtil.formatLink("mailto:" + user.getEmail(), CommonXmlStrings.LT + user.getEmail() + CommonXmlStrings.GT);
|
||||
private static HtmlChunk.Element getEmailLink(@NotNull VcsUser user) {
|
||||
return HtmlChunk.link("mailto:" + user.getEmail(), "<" + user.getEmail() + ">");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -279,11 +278,13 @@ public final class CommitPresentationUtil {
|
||||
String head = VcsLogBundle.message("vcs.log.details.in.branches", branches.size()) + " ";
|
||||
|
||||
if (expanded) {
|
||||
return head + XmlStringUtil.formatLink(SHOW_HIDE_BRANCHES, VcsLogBundle.message("vcs.log.details.in.branches.hide")) +
|
||||
UIUtil.BR + StringUtil.join(branches, UIUtil.BR);
|
||||
return new HtmlBuilder().append(head)
|
||||
.append(HtmlChunk.link(SHOW_HIDE_BRANCHES, VcsLogBundle.message("vcs.log.details.in.branches.hide")))
|
||||
.append(HtmlChunk.br())
|
||||
.appendWithSeparators(HtmlChunk.br(), ContainerUtil.map(branches, s -> HtmlChunk.text(s))).toString();
|
||||
}
|
||||
|
||||
String tail = "… " + XmlStringUtil.formatLink(SHOW_HIDE_BRANCHES, VcsLogBundle.message("vcs.log.details.in.branches.show.all"));
|
||||
String tail = "… " + HtmlChunk.link(SHOW_HIDE_BRANCHES, VcsLogBundle.message("vcs.log.details.in.branches.show.all")).toString();
|
||||
int headWidth = metrics.stringWidth(head);
|
||||
int tailWidth = metrics.stringWidth(StringUtil.removeHtmlTags(tail));
|
||||
if (availableWidth <= headWidth + tailWidth) {
|
||||
|
||||
+3
-4
@@ -4,6 +4,7 @@ package com.intellij.vcs.log.ui.table;
|
||||
import com.intellij.ide.IdeTooltip;
|
||||
import com.intellij.ide.IdeTooltipManager;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.util.text.HtmlChunk;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.components.panels.Wrapper;
|
||||
import com.intellij.util.text.DateFormatUtil;
|
||||
@@ -21,7 +22,6 @@ import com.intellij.vcs.log.paint.GraphCellPainter;
|
||||
import com.intellij.vcs.log.statistics.VcsLogUsageTriggerCollector;
|
||||
import com.intellij.vcs.log.ui.frame.CommitPresentationUtil;
|
||||
import com.intellij.vcs.log.util.VcsLogUiUtil;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -158,9 +158,8 @@ public abstract class GraphCommitCellController implements VcsLogCellController
|
||||
}
|
||||
else {
|
||||
long time = details.getAuthorTime();
|
||||
String commitMessage = XmlStringUtil.wrapInHtmlTag("\"" +
|
||||
StringUtil.shortenTextWithEllipsis(details.getSubject(), 50, 0, "...")
|
||||
+ "\"", "b");
|
||||
String shortenedSubject = StringUtil.shortenTextWithEllipsis(details.getSubject(), 50, 0, "...");
|
||||
String commitMessage = HtmlChunk.text("\"" + shortenedSubject + "\"").bold().toString();
|
||||
return VcsLogBundle.message("vcs.log.graph.arrow.tooltip.jump.to.subject.author.date.time",
|
||||
commitMessage,
|
||||
CommitPresentationUtil.getAuthorPresentation(details),
|
||||
|
||||
@@ -5,10 +5,10 @@ import com.intellij.codeInsight.highlighting.TooltipLinkHandler;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.HtmlChunk;
|
||||
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.impl.HashImpl;
|
||||
import com.intellij.xml.util.XmlStringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class GitCommitTooltipLinkHandler extends TooltipLinkHandler {
|
||||
public static String createLink(@NotNull String text, @NotNull VcsRevisionNumber revisionNumber) {
|
||||
Hash hash = tryCreateHash(revisionNumber.asString());
|
||||
if (hash == null) return null;
|
||||
return XmlStringUtil.formatLink("#git_commit/" + hash.asString(), XmlStringUtil.escapeString(text));
|
||||
return HtmlChunk.link("#git_commit/" + hash.asString(), text).toString();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user