From 7fbf5afb447cd81cc5b498407c0a66ec20c9a42f Mon Sep 17 00:00:00 2001 From: Heiko Klare Date: Fri, 16 Oct 2026 18:39:21 +0200 Subject: [PATCH] Console: publish the page's text viewer as an adapter The console page exposes its find/replace target and its text widget, but not the viewer that both of them come from. Clients that need to know where the console renders its text therefore have to ask for the widget, which describes how the text is presented rather than what presents it, and which leaves the viewer's document and selection handling out of reach. Answering ITextViewer closes that gap, and costs nothing: the console's viewer is a SourceViewer and therefore already an ITextViewer, so the page merely publishes what it has. The Find/Replace overlay, which places itself on the text viewer of the part it is opened in, can thereby be used in the console the same way as in a text editor. The existing Widget adapter stays in place for clients relying on it. Assisted-by: Claude Opus 5 --- .../src/org/eclipse/ui/console/TextConsolePage.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java b/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java index 7c009a0deda..de410096d4a 100644 --- a/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java +++ b/debug/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsolePage.java @@ -33,6 +33,7 @@ import org.eclipse.jface.text.IFindReplaceTarget; import org.eclipse.jface.text.ITextListener; import org.eclipse.jface.text.ITextOperationTarget; +import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -309,6 +310,9 @@ public T getAdapter(Class required) { if (IFindReplaceTarget.class.equals(required)) { return (T) fViewer.getFindReplaceTarget(); } + if (ITextViewer.class.equals(required)) { + return (T) fViewer; + } if (Widget.class.equals(required)) { return (T) fViewer.getTextWidget(); }