diff --git a/bundles/org.eclipse.ui.editors/.settings/.api_filters b/bundles/org.eclipse.ui.editors/.settings/.api_filters
index c062b4ac10e0..39392e409f01 100644
--- a/bundles/org.eclipse.ui.editors/.settings/.api_filters
+++ b/bundles/org.eclipse.ui.editors/.settings/.api_filters
@@ -17,4 +17,12 @@
+
+
+
+
+
+
+
+
diff --git a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java
index 12bb922768ef..cd0c9518e2c8 100644
--- a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java
+++ b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/StickyScrollingControl.java
@@ -21,6 +21,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CaretEvent;
import org.eclipse.swt.custom.CaretListener;
+import org.eclipse.swt.custom.LineBackgroundEvent;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ControlEvent;
@@ -185,6 +186,7 @@ private void createControls() {
GridDataFactory.fillDefaults().grab(true, true).applyTo(stickyLineText);
stickyLineText.setEnabled(false);
stickyLineText.setBackground(settings.stickyLineBackgroundColor());
+ stickyLineText.addLineBackgroundListener(this::styleStickyLineBackground);
bottomSeparator= new Composite(stickyLinesCanvas, SWT.NONE);
GridDataFactory.fillDefaults().hint(0, 3).grab(true, false).span(2, 1).applyTo(bottomSeparator);
@@ -260,6 +262,12 @@ private void styleStickyLines() {
stickyLineText.setLeftMargin(textWidget.getLeftMargin());
}
+ private void styleStickyLineBackground(LineBackgroundEvent event) {
+ int lineIndex = stickyLineText.getLineAtOffset(event.lineOffset);
+ IStickyLine line = stickyLines.get(lineIndex);
+ event.lineBackground = line.getBackgroundColor();
+ }
+
private void layoutStickyLines() {
if (getNumberStickyLines() == 0) {
stickyLinesCanvas.setVisible(false);
diff --git a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/stickyscroll/IStickyLine.java b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/stickyscroll/IStickyLine.java
index bc8cb26380bb..43bb790df13b 100644
--- a/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/stickyscroll/IStickyLine.java
+++ b/bundles/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/stickyscroll/IStickyLine.java
@@ -14,6 +14,7 @@
package org.eclipse.ui.texteditor.stickyscroll;
import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.Color;
/**
* Representation of a sticky line.
@@ -43,4 +44,23 @@ public interface IStickyLine {
*/
StyleRange[] getStyleRanges();
+ /**
+ * Returns the background color of the sticky line.
+ *
+ * The background color is drawn for the full-width of the line. The text
+ * background color if defined in a StyleRange ({@link #getStyleRanges()})
+ * overlays the line background color.
+ *
+ *
+ * {@code null} (the default), if the line has no special background color.
+ *
+ *
+ * @return the background color of the sticky line or {@code null} for no
+ * special color
+ * @since 3.22
+ */
+ default Color getBackgroundColor() {
+ return null;
+ }
+
}