From 7be41dc1c2cbb3de07ac4c7ebe9393e9c06b6d5b Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 1 Feb 2016 19:24:09 +0300 Subject: [PATCH] vcs: simplify --- .../vcs/history/FileHistoryPanelImpl.java | 34 +++---------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java index c92c83f131e8..0e5d96ee9c0e 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java @@ -297,27 +297,17 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { private final MessageRenderer myRenderer; public MessageColumnInfo(Project project) { - super(FileHistoryPanelImpl.COMMIT_MESSAGE_TITLE); + super(COMMIT_MESSAGE_TITLE); myRenderer = new MessageRenderer(project); } protected String getDataOf(VcsFileRevision object) { final String originalMessage = object.getCommitMessage(); - if (originalMessage != null) { - String commitMessage = originalMessage.trim(); - int index13 = commitMessage.indexOf('\r'); - int index10 = commitMessage.indexOf('\n'); + if (originalMessage == null) return ""; - if (index10 < 0 && index13 < 0) { - return commitMessage; - } - else { - return commitMessage.substring(0, getSuitableIndex(index10, index13)) + "..."; - } - } - else { - return ""; - } + int index = StringUtil.indexOfAny(originalMessage, "\n\r"); + if (index == -1) return originalMessage; + return originalMessage.substring(0, index) + "..."; } @Override @@ -328,22 +318,8 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton { public TableCellRenderer getRenderer(VcsFileRevision p0) { return myRenderer; } - } - private static int getSuitableIndex(int index10, int index13) { - if (index10 < 0) { - return index13; - } - else if (index13 < 0) { - return index10; - } - else { - return Math.min(index10, index13); - } - } - - private final Map myRevisionToVirtualFile = new HashMap(); public FileHistoryPanelImpl(AbstractVcs vcs,