Skip to content

Commit 4309121

Browse files
committed
Include Colors & Font pref page in console filtered preference
Added the Colors and Fonts preference page link under Console Filtered Preferences. This allows users to change console font styles and colors directly from the console preferences.
1 parent 018c667 commit 4309121

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

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

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
@@ -228,4 +228,6 @@ public class DebugPreferencesMessages extends NLS {
228228

229229
public static Object ConsoleDisableElapsedTime;
230230

231+
public static String ConsoleFontSettingsLink;
232+
231233
}

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
@@ -35,6 +35,7 @@ ConsoleElapsedTimeLabel=Elapsed Time Format (Choose 'None' to disable)
3535
ConsoleDefaultElapsedTimeFormat=%d:%02d:%02d
3636
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
3737
ConsoleDisableElapsedTime=None
38+
ConsoleFontSettingsLink=To configure font and color settings, see <a href=\"org.eclipse.ui.preferencePages.ColorsAndFonts\">'Colors and Fonts'</a> preferences
3839

3940
DebugPreferencePage_1=General Settings for Running and Debugging.
4041
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)