From 0f986e11ef3a315d1d62f92bf51235c4caf462f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=8A?= =?UTF-8?q?=D1=80=20=D0=9A=D1=83=D1=80=D1=82=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Tue, 23 Sep 2025 10:24:57 +0300 Subject: [PATCH] Allow getting StyledText content as html via getData The key is simply StyledText.getData Let's have this one as hidden "gem" for testing purposes to ease both testing the implementation and may one day it would be worth exposing as proper API. --- .../common/org/eclipse/swt/custom/StyledText.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java index b6766be528f..a17621f365e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java @@ -10935,4 +10935,13 @@ public static void updateAndRefreshCarets(StyledText styledText, Consumer } +@Override +public Object getData(String key) { + if ("StyledText.htmlText".equals(key)) { + HTMLWriter htmlWriter = new HTMLWriter(this, 0, content.getCharCount(), content); + return getPlatformDelimitedText(htmlWriter); + } + return super.getData(key); +} + }