diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/CommitPresentationUtil.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/CommitPresentationUtil.java index 608c46a4a772..d5d155de6cb7 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/CommitPresentationUtil.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/CommitPresentationUtil.java @@ -25,7 +25,6 @@ import org.jetbrains.annotations.Nullable; import javax.swing.event.HyperlinkEvent; import java.awt.*; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Set; import java.util.regex.Matcher; @@ -261,38 +260,29 @@ public class CommitPresentationUtil { public static CommitPresentation buildPresentation(@NotNull Project project, @NotNull VcsFullCommitDetails commit, @NotNull Set unresolvedHashes) { - String fullMessage = commit.getFullMessage(); - - String text = formatCommitText(project, fullMessage, Collections.emptySet()); + String rawMessage = commit.getFullMessage(); String hashAndAuthor = formatCommitHashAndAuthor(commit); - Set unresolvedHashesForCommit = findHashes(project, fullMessage); + Set unresolvedHashesForCommit = findHashes(project, rawMessage); if (unresolvedHashesForCommit.isEmpty()) { - return new CommitPresentation(text, hashAndAuthor, commit.getRoot(), MultiMap.empty()); + return new CommitPresentation(project, commit.getRoot(), rawMessage, hashAndAuthor, MultiMap.empty()); } unresolvedHashes.addAll(unresolvedHashesForCommit); - return new UnresolvedPresentation(project, commit.getRoot(), fullMessage, hashAndAuthor, text); + return new UnresolvedPresentation(project, commit.getRoot(), rawMessage, hashAndAuthor); } private static class UnresolvedPresentation extends CommitPresentation { - @NotNull private final Project myProject; - @NotNull private final String myRawMessage; - public UnresolvedPresentation(@NotNull Project project, @NotNull VirtualFile root, @NotNull String rawMessage, - @NotNull String hashAndAuthor, - @NotNull String formattedMessage) { - super(formattedMessage, hashAndAuthor, root, MultiMap.empty()); - myProject = project; - myRawMessage = rawMessage; + @NotNull String hashAndAuthor) { + super(project, root, rawMessage, hashAndAuthor, MultiMap.empty()); } @NotNull public CommitPresentation resolve(@NotNull MultiMap resolvedHashes) { - String text = formatCommitText(myProject, myRawMessage, resolvedHashes.keySet()); - return new CommitPresentation(text, myHashAndAuthor, myRoot, resolvedHashes); + return new CommitPresentation(myProject, myRoot, myRawMessage, myHashAndAuthor, resolvedHashes); } @Override @@ -302,22 +292,27 @@ public class CommitPresentationUtil { } public static class CommitPresentation { - @NotNull protected final String myFormattedMessage; + @NotNull protected final Project myProject; + @NotNull protected final String myRawMessage; @NotNull protected final String myHashAndAuthor; @NotNull protected final VirtualFile myRoot; @NotNull private final MultiMap myResolvedHashes; - public CommitPresentation(@NotNull String formattedMessage, @NotNull String hashAndAuthor, - @NotNull VirtualFile root, @NotNull MultiMap resolvedHashes) { - myFormattedMessage = formattedMessage; - myHashAndAuthor = hashAndAuthor; + public CommitPresentation(@NotNull Project project, + @NotNull VirtualFile root, + @NotNull String rawMessage, + @NotNull String hashAndAuthor, + @NotNull MultiMap resolvedHashes) { + myProject = project; myRoot = root; + myRawMessage = rawMessage; + myHashAndAuthor = hashAndAuthor; myResolvedHashes = resolvedHashes; } @NotNull public String getText() { - return myFormattedMessage; + return formatCommitText(myProject, myRawMessage, myResolvedHashes.keySet()); } @NotNull diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java index be1b1a3ed2d1..e5e468b145a2 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/DetailsPanel.java @@ -16,8 +16,10 @@ package com.intellij.vcs.log.ui.frame; import com.google.common.primitives.Ints; +import com.intellij.codeInspection.InspectionProfile; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.editor.colors.EditorColorsListener; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.progress.ProgressIndicator; @@ -33,6 +35,8 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.ui.FontUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.profile.ProfileChangeAdapter; +import com.intellij.profile.codeInspection.ProjectInspectionProfileManager; import com.intellij.ui.SeparatorComponent; import com.intellij.ui.components.JBLabel; import com.intellij.ui.components.JBLoadingPanel; @@ -41,6 +45,7 @@ import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.StatusText; +import com.intellij.vcs.commit.CommitMessageInspectionProfile; import com.intellij.vcs.log.CommitId; import com.intellij.vcs.log.Hash; import com.intellij.vcs.log.VcsFullCommitDetails; @@ -57,7 +62,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; -import javax.swing.border.Border; import java.awt.*; import java.util.Arrays; import java.util.Collection; @@ -118,12 +122,26 @@ public class DetailsPanel extends JPanel implements EditorColorsListener, Dispos setLayout(new BorderLayout()); add(myLoadingPanel, BorderLayout.CENTER); + ProjectInspectionProfileManager.getInstance(logData.getProject()).addProfileChangeListener(new ProfileChangeAdapter() { + @Override + public void profileChanged(@Nullable InspectionProfile profile) { + if (CommitMessageInspectionProfile.getInstance(myLogData.getProject()).equals(profile)) { + // only update after settings dialog is closed and settings are actually applied + ApplicationManager.getApplication().invokeLater(DetailsPanel.this::update, ModalityState.NON_MODAL); + } + } + }, this); + myEmptyText.setText("Commit details"); Disposer.register(parent, this); } @Override public void globalSchemeChange(EditorColorsScheme scheme) { + update(); + } + + private void update() { for (int i = 0; i < mySelection.size(); i++) { CommitPanel commitPanel = getCommitPanel(i); commitPanel.update();