Skip to content

Commit c93534f

Browse files
committed
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.
1 parent 2f16b91 commit c93534f

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@
4141
import org.eclipse.swt.widgets.Combo;
4242
import org.eclipse.swt.widgets.Composite;
4343
import org.eclipse.swt.widgets.Label;
44+
import org.eclipse.swt.widgets.Link;
45+
import org.eclipse.swt.widgets.Shell;
4446
import org.eclipse.ui.IWorkbench;
4547
import org.eclipse.ui.IWorkbenchPreferencePage;
4648
import org.eclipse.ui.PlatformUI;
4749
import org.eclipse.ui.console.ConsolePlugin;
4850
import org.eclipse.ui.console.IConsoleConstants;
51+
import org.eclipse.ui.dialogs.PreferencesUtil;
4952

5053
/**
5154
* A page to set the preferences for the console
@@ -127,7 +130,7 @@ public void createControl(Composite parent) {
127130
*/
128131
@Override
129132
public void createFieldEditors() {
130-
133+
createHeaderLink();
131134
fWrapEditor = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_WRAP, DebugPreferencesMessages.ConsolePreferencePage_Wrap_text_1, SWT.NONE, getFieldEditorParent());
132135
addField(fWrapEditor);
133136

@@ -408,4 +411,24 @@ private String processElapsedTimeFormat(String format) {
408411
elapsedTime.toSecondsPart(), elapsedTime.toMillisPart());
409412
return elapsedString;
410413
}
414+
415+
private void createHeaderLink() {
416+
final Shell shell = getFieldEditorParent().getShell();
417+
String text = DebugPreferencesMessages.ConsoleFontSettingsLink;
418+
Link link = new Link(getFieldEditorParent(), SWT.NONE);
419+
link.setText(text);
420+
link.addSelectionListener(new SelectionAdapter() {
421+
@Override
422+
public void widgetSelected(SelectionEvent e) {
423+
if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) { //$NON-NLS-1$
424+
PreferencesUtil.createPreferenceDialogOn(shell, e.text, null,
425+
"selectFont:org.eclipse.debug.ui.consoleFont"); //$NON-NLS-1$
426+
}
427+
}
428+
});
429+
GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
430+
gridData.horizontalSpan = 4;
431+
link.setLayoutData(gridData);
432+
SWTFactory.createVerticalSpacer(getFieldEditorParent(), 2);
433+
}
411434
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,6 @@ public class DebugPreferencesMessages extends NLS {
230230

231231
public static Object ConsoleDisableElapsedTime;
232232

233+
public static String ConsoleFontSettingsLink;
234+
233235
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ConsoleElapsedTimeLabel=Elapsed Time Format (Choose 'None' to disable)
3636
ConsoleDefaultElapsedTimeFormat=%d:%02d:%02d
3737
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
3838
ConsoleDisableElapsedTime=None
39+
ConsoleFontSettingsLink=To configure font style settings, see <a href=\"org.eclipse.ui.preferencePages.ColorsAndFonts\">'Font Styles'</a> preferences
3940

4041
DebugPreferencePage_1=General Settings for Running and Debugging.
4142
DebugPreferencePage_2=Re&use editor when displaying source code

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ConsoleShowPreferencesAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2007 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -33,6 +33,7 @@ public void init(IViewPart view) {}
3333
private static final String PREF_PAGE_NAME = "org.eclipse.debug.ui.ConsolePreferencePage"; //$NON-NLS-1$
3434
private static final String[] PREFS_PAGES_TO_SHOW = {
3535
PREF_PAGE_NAME,
36+
"org.eclipse.ui.preferencePages.ColorsAndFonts", //$NON-NLS-1$
3637
"org.eclipse.debug.ui.DebugPreferencePage", //$NON-NLS-1$
3738
"org.eclipse.ui.internal.console.ansi.preferences.AnsiConsolePreferencePage" //$NON-NLS-1$
3839
};

0 commit comments

Comments
 (0)