From 27d1f6d53ca2f60d94c5f958177c8aa7477a4c44 Mon Sep 17 00:00:00 2001 From: sougandhs Date: Thu, 30 Oct 2025 08:27:39 +0530 Subject: [PATCH] Include Font style pref page in console filtered preference Added the font style preference page link under Console Preferences. This allows users to change console font styles directly from the console filtered preferences. --- .../ui/preferences/ConsolePreferencePage.java | 25 ++++++++++++++++++- .../preferences/DebugPreferencesMessages.java | 2 ++ .../DebugPreferencesMessages.properties | 1 + .../console/ConsoleShowPreferencesAction.java | 3 ++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java index b339991b156..0fc804c7cfc 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java @@ -41,11 +41,14 @@ import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.console.ConsolePlugin; import org.eclipse.ui.console.IConsoleConstants; +import org.eclipse.ui.dialogs.PreferencesUtil; /** * A page to set the preferences for the console @@ -127,7 +130,7 @@ public void createControl(Composite parent) { */ @Override public void createFieldEditors() { - + createHeaderLink(); fWrapEditor = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_WRAP, DebugPreferencesMessages.ConsolePreferencePage_Wrap_text_1, SWT.NONE, getFieldEditorParent()); addField(fWrapEditor); @@ -408,4 +411,24 @@ private String processElapsedTimeFormat(String format) { elapsedTime.toSecondsPart(), elapsedTime.toMillisPart()); return elapsedString; } + + private void createHeaderLink() { + final Shell shell = getFieldEditorParent().getShell(); + String text = DebugPreferencesMessages.ConsoleFontSettingsLink; + Link link = new Link(getFieldEditorParent(), SWT.NONE); + link.setText(text); + link.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) { //$NON-NLS-1$ + PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, + "selectFont:org.eclipse.debug.ui.consoleFont"); //$NON-NLS-1$ + } + } + }); + GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + gridData.horizontalSpan = 4; + link.setLayoutData(gridData); + SWTFactory.createVerticalSpacer(getFieldEditorParent(), 2); + } } diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java index cf401c4152e..9003999293f 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java @@ -230,4 +230,6 @@ public class DebugPreferencesMessages extends NLS { public static Object ConsoleDisableElapsedTime; + public static String ConsoleFontSettingsLink; + } diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties index e29da0fd839..0e6d92c9d29 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties @@ -36,6 +36,7 @@ ConsoleElapsedTimeLabel=Elapsed Time Format (Choose 'None' to disable) ConsoleDefaultElapsedTimeFormat=%d:%02d:%02d ConsoleElapsedTimeToolTip=Supports formats like: 'H:MM:SS.mmm', 'MMm SSs', 'H:MM:SS' \nYou can also use positional parameters \n%1$ = (H)hours\n%2$ = (M)minutes\n%3$ = (S)seconds\n%4$ = (mmm)milliseconds ConsoleDisableElapsedTime=None +ConsoleFontSettingsLink=To configure font style settings, see 'Font Styles' preferences DebugPreferencePage_1=General Settings for Running and Debugging. DebugPreferencePage_2=Re&use editor when displaying source code diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java index 6817be7f183..6ca56cc5d9f 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -33,6 +33,7 @@ public void init(IViewPart view) {} private static final String PREF_PAGE_NAME = "org.eclipse.debug.ui.ConsolePreferencePage"; //$NON-NLS-1$ private static final String[] PREFS_PAGES_TO_SHOW = { PREF_PAGE_NAME, + "org.eclipse.ui.preferencePages.ColorsAndFonts", //$NON-NLS-1$ "org.eclipse.debug.ui.DebugPreferencePage", //$NON-NLS-1$ "org.eclipse.ui.internal.console.ansi.preferences.AnsiConsolePreferencePage" //$NON-NLS-1$ };