From 9b2fdbcd3d0af54ee1d7f9f7c1288af77c595f92 Mon Sep 17 00:00:00 2001 From: Irina Chernushina Date: Fri, 31 Jul 2009 13:52:19 +0400 Subject: [PATCH] SVN: IDEA-23867 (SVN annotations: Check-in comments do not display when mousing over merge source revisions) --- .../com/intellij/cvsSupport2/annotate/CvsFileAnnotation.java | 6 +++--- .../com/intellij/openapi/vcs/annotate/LineAnnotationAspect.java | 8 ++++++++ .../openapi/vcs/annotate/LineAnnotationAspectAdapter.java | 7 +++++++ .../com/intellij/openapi/vcs/actions/AnnotateToggleAction.java | 4 ++++ 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspectAdapter.java diff --git a/plugins/cvs2/source/com/intellij/cvsSupport2/annotate/CvsFileAnnotation.java b/plugins/cvs2/source/com/intellij/cvsSupport2/annotate/CvsFileAnnotation.java index 058371f1f8..c8429b27b5 100644 --- a/plugins/cvs2/source/com/intellij/cvsSupport2/annotate/CvsFileAnnotation.java +++ b/plugins/cvs2/source/com/intellij/cvsSupport2/annotate/CvsFileAnnotation.java @@ -53,7 +53,7 @@ public class CvsFileAnnotation implements FileAnnotation{ private final VirtualFile myFile; private final List myListeners = new ArrayList(); - private final LineAnnotationAspect USER = new LineAnnotationAspect() { + private final LineAnnotationAspect USER = new LineAnnotationAspectAdapter() { public String getValue(int lineNumber) { if (lineNumber < 0 || lineNumber >= myAnnotations.length) { return ""; @@ -64,7 +64,7 @@ public class CvsFileAnnotation implements FileAnnotation{ } }; - private final LineAnnotationAspect DATE = new LineAnnotationAspect() { + private final LineAnnotationAspect DATE = new LineAnnotationAspectAdapter() { public String getValue(int lineNumber) { if (lineNumber < 0 || lineNumber >= myAnnotations.length) { return ""; @@ -75,7 +75,7 @@ public class CvsFileAnnotation implements FileAnnotation{ } }; - private final LineAnnotationAspect REVISION = new LineAnnotationAspect() { + private final LineAnnotationAspect REVISION = new LineAnnotationAspectAdapter() { public String getValue(int lineNumber) { if (lineNumber < 0 || lineNumber >= myAnnotations.length) { return ""; diff --git a/vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspect.java b/vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspect.java index ea7dcb6165..7b7edc7172 100644 --- a/vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspect.java +++ b/vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspect.java @@ -15,6 +15,8 @@ */ package com.intellij.openapi.vcs.annotate; +import org.jetbrains.annotations.Nullable; + /** * Represents one part of a line annotation which is shown in the editor when the "Annotate" * action is invoked. Classes implementing this interface can also implement @@ -29,4 +31,10 @@ public interface LineAnnotationAspect { * @return the annotation text */ String getValue(int lineNumber); + + /** + * used if return value is not null + */ + @Nullable + String getTooltipText(int lineNumber); } diff --git a/vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspectAdapter.java b/vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspectAdapter.java new file mode 100644 index 0000000000..c48bac4c4b --- /dev/null +++ b/vcs-api/src/com/intellij/openapi/vcs/annotate/LineAnnotationAspectAdapter.java @@ -0,0 +1,7 @@ +package com.intellij.openapi.vcs.annotate; + +public abstract class LineAnnotationAspectAdapter implements LineAnnotationAspect { + public String getTooltipText(int lineNumber) { + return null; + } +} diff --git a/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java b/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java index 17fcc6a8d0..fde8eda18d 100644 --- a/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java +++ b/vcs-impl/src/com/intellij/openapi/vcs/actions/AnnotateToggleAction.java @@ -245,6 +245,10 @@ public class AnnotateToggleAction extends ToggleAction implements DumbAware { @Override public String getToolTip(int line, Editor editor) { + final String aspectTooltip = myAspect.getTooltipText(line); + if (aspectTooltip != null) { + return aspectTooltip; + } final String text = getLineText(line, editor); return ((text == null) || (text.length() == 0)) ? "" : VcsBundle.message("annotation.original.revision.text", text); } -- 2.11.4.GIT