Skip to content

Commit 09dcbd4

Browse files
committed
Add preference page for console icon update
This commit adds a preference option in console preference for enable/disable dynamic console update based on active console page Fixes : #2434
1 parent 56e8969 commit 09dcbd4

6 files changed

Lines changed: 27 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 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
@@ -181,6 +181,10 @@ public void widgetSelected(SelectionEvent e) {
181181
DebugPreferencesMessages.ConsolePreferencePage_ConsoleAutoPinEnable, SWT.NONE, getFieldEditorParent());
182182
autoPinEditor.setPreferenceStore(ConsolePlugin.getDefault().getPreferenceStore());
183183
addField(autoPinEditor);
184+
BooleanFieldEditor consoleIconUpdate = new BooleanFieldEditor(IConsoleConstants.UPDATE_CONSOLE_ICON,
185+
DebugPreferencesMessages.ConsolePreferencePage_ConsoleIconUpdate, SWT.NONE, getFieldEditorParent());
186+
consoleIconUpdate.setPreferenceStore(ConsolePlugin.getDefault().getPreferenceStore());
187+
addField(consoleIconUpdate);
184188
Label comboLabel = new Label(getFieldEditorParent(), SWT.NONE);
185189
comboLabel.setText(DebugPreferencesMessages.ConsoleElapsedTimeLabel);
186190
fElapsedFormat = new ComboViewer(getFieldEditorParent(), SWT.DROP_DOWN | SWT.BORDER);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2025 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
@@ -230,4 +230,6 @@ public class DebugPreferencesMessages extends NLS {
230230

231231
public static Object ConsoleDisableElapsedTime;
232232

233+
public static String ConsolePreferencePage_ConsoleIconUpdate;
234+
233235
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2000, 2025 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
@@ -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+
ConsolePreferencePage_ConsoleIconUpdate=Update Console icon based on currently active page
3940

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

debug/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2020 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
@@ -197,4 +197,11 @@ public interface IConsoleConstants {
197197
*/
198198
String COMMAND_ID_CLEAR_CONSOLE = "org.eclipse.debug.ui.commands.console.clear"; //$NON-NLS-1$
199199

200+
/**
201+
* The preference for updating console icon based on active console page
202+
*
203+
* @since 3.16
204+
*/
205+
String UPDATE_CONSOLE_ICON = "org.eclipse.console.autoUpdateIcon"; //$NON-NLS-1$
206+
200207
}

debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018, 2020 Andrey Loskutov <loskutov@gmx.de> and others.
2+
* Copyright (c) 2018, 2026 Andrey Loskutov <loskutov@gmx.de> and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -31,6 +31,7 @@ public void initializeDefaultPreferences() {
3131
prefs.setDefault(IConsoleConstants.P_CONSOLE_WORD_WRAP, false);
3232
prefs.setDefault(IConsoleConstants.AUTO_PIN_ENABLED_PREF_NAME, true);
3333
prefs.setDefault(IConsoleConstants.REMEMBER_AUTO_PIN_DECISION_PREF_NAME, false);
34+
prefs.setDefault(IConsoleConstants.UPDATE_CONSOLE_ICON, true);
3435
}
3536

3637
}

debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.jface.action.IToolBarManager;
2929
import org.eclipse.jface.action.Separator;
3030
import org.eclipse.jface.action.ToolBarManager;
31+
import org.eclipse.jface.preference.IPreferenceStore;
3132
import org.eclipse.jface.resource.ImageDescriptor;
3233
import org.eclipse.jface.resource.JFaceResources;
3334
import org.eclipse.jface.resource.LocalResourceManager;
@@ -191,6 +192,7 @@ protected void showPageRec(PageRec pageRec) {
191192
updateTitle();
192193
updateHelp();
193194
updateIcon();
195+
194196
// update console actions
195197
if (fPinAction != null) {
196198
fPinAction.update();
@@ -277,6 +279,11 @@ protected void updateHelp() {
277279
}
278280

279281
protected void updateIcon() {
282+
IPreferenceStore store = ConsolePlugin.getDefault().getPreferenceStore();
283+
if (!store.getBoolean(IConsoleConstants.UPDATE_CONSOLE_ICON)) {
284+
setTitleImage(defaultIcon);
285+
return;
286+
}
280287
IConsole console = getConsole();
281288
if (console == null) {
282289
// Check and restore default console icon if last page is closed

0 commit comments

Comments
 (0)