mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: add API to customize presentation of annotation column
GitOrigin-RevId: f59dc4d53c6cd7ba3f6cee423c7ad4b5c5fe9e07
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8fb9c3e5f5
commit
b950589b47
@@ -15,9 +15,13 @@
|
||||
*/
|
||||
package com.intellij.openapi.vcs.annotate;
|
||||
|
||||
import com.intellij.openapi.editor.colors.ColorKey;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.vcs.VcsBundle;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -62,4 +66,28 @@ public interface LineAnnotationAspect {
|
||||
* @return {@code true} if this aspect will be shown on Annotate action
|
||||
*/
|
||||
boolean isShowByDefault();
|
||||
|
||||
/**
|
||||
* Used to override default text style
|
||||
*/
|
||||
@Nullable
|
||||
default EditorFontType getStyle(int line) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to override default text color
|
||||
*/
|
||||
@Nullable
|
||||
default ColorKey getColor(int line) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to override default background color
|
||||
*/
|
||||
@Nullable
|
||||
default Color getBgColor(int line) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+27
-3
@@ -17,6 +17,8 @@ package com.intellij.openapi.vcs.actions;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorGutterAction;
|
||||
import com.intellij.openapi.editor.colors.ColorKey;
|
||||
import com.intellij.openapi.editor.colors.EditorFontType;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.openapi.vcs.annotate.FileAnnotation;
|
||||
import com.intellij.openapi.vcs.annotate.LineAnnotationAspect;
|
||||
@@ -62,9 +64,8 @@ public class AspectAnnotationFieldGutter extends AnnotationFieldGutter {
|
||||
@Nullable
|
||||
@Override
|
||||
public String getToolTip(final int line, final Editor editor) {
|
||||
if (myAspect.getTooltipText(line) != null) {
|
||||
return myAspect.getTooltipText(line);
|
||||
}
|
||||
String text = myAspect.getTooltipText(line);
|
||||
if (text != null) return text;
|
||||
return isAvailable() ? myAnnotation.getHtmlToolTip(line) : null;
|
||||
}
|
||||
|
||||
@@ -83,6 +84,29 @@ public class AspectAnnotationFieldGutter extends AnnotationFieldGutter {
|
||||
return super.getCursor(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditorFontType getStyle(int line, Editor editor) {
|
||||
EditorFontType style = myAspect.getStyle(line);
|
||||
if (style != null) return style;
|
||||
return super.getStyle(line, editor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ColorKey getColor(int line, Editor editor) {
|
||||
ColorKey color = myAspect.getColor(line);
|
||||
if (color != null) return color;
|
||||
return super.getColor(line, editor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Color getBgColor(int line, Editor editor) {
|
||||
Color color = myAspect.getBgColor(line);
|
||||
if (color != null) return color;
|
||||
return super.getBgColor(line, editor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShowByDefault() {
|
||||
return myAspect.isShowByDefault();
|
||||
|
||||
Reference in New Issue
Block a user