Skip to content

Commit 3806a14

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 2ea44c8 commit 3806a14

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-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

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,5 @@ public class DebugPreferencesMessages extends NLS {
232232

233233
public static String ConsolePreferencePage_ConsoleIconUpdate;
234234

235+
public static String ConsoleFontSettingsLink;
235236
}

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
@@ -37,6 +37,7 @@ ConsoleDefaultElapsedTimeFormat=H:MM:SS
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
3939
ConsolePreferencePage_ConsoleIconUpdate=Update Console icon based on currently active page
40+
ConsoleFontSettingsLink=To configure font style settings, see <a href=\"org.eclipse.ui.preferencePages.ColorsAndFonts\">'Font Styles'</a> preferences
4041

4142
DebugPreferencePage_1=General Settings for Running and Debugging.
4243
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, 2026 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)