Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -181,6 +181,10 @@ public void widgetSelected(SelectionEvent e) {
DebugPreferencesMessages.ConsolePreferencePage_ConsoleAutoPinEnable, SWT.NONE, getFieldEditorParent());
autoPinEditor.setPreferenceStore(ConsolePlugin.getDefault().getPreferenceStore());
addField(autoPinEditor);
BooleanFieldEditor consoleIconUpdate = new BooleanFieldEditor(IConsoleConstants.UPDATE_CONSOLE_ICON,
DebugPreferencesMessages.ConsolePreferencePage_ConsoleIconUpdate, SWT.NONE, getFieldEditorParent());
consoleIconUpdate.setPreferenceStore(ConsolePlugin.getDefault().getPreferenceStore());
addField(consoleIconUpdate);
Label comboLabel = new Label(getFieldEditorParent(), SWT.NONE);
comboLabel.setText(DebugPreferencesMessages.ConsoleElapsedTimeLabel);
fElapsedFormat = new ComboViewer(getFieldEditorParent(), SWT.DROP_DOWN | SWT.BORDER);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2025 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -230,4 +230,6 @@ public class DebugPreferencesMessages extends NLS {

public static Object ConsoleDisableElapsedTime;

public static String ConsolePreferencePage_ConsoleIconUpdate;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2000, 2025 IBM Corporation and others.
# Copyright (c) 2000, 2026 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -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
ConsolePreferencePage_ConsoleIconUpdate=Update Console icon based on currently active page

DebugPreferencePage_1=General Settings for Running and Debugging.
DebugPreferencePage_2=Re&use editor when displaying source code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corporation and others.
* Copyright (c) 2000, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -197,4 +197,11 @@ public interface IConsoleConstants {
*/
String COMMAND_ID_CLEAR_CONSOLE = "org.eclipse.debug.ui.commands.console.clear"; //$NON-NLS-1$

/**
* The preference for updating console icon based on active console page
*
* @since 3.16
*/
String UPDATE_CONSOLE_ICON = ConsolePlugin.getUniqueIdentifier() + ".PREF_DYNAMIC_CONSOLE_ICON"; //$NON-NLS-1$

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Andrey Loskutov <loskutov@gmx.de> and others.
* Copyright (c) 2018, 2026 Andrey Loskutov <loskutov@gmx.de> and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -31,6 +31,7 @@ public void initializeDefaultPreferences() {
prefs.setDefault(IConsoleConstants.P_CONSOLE_WORD_WRAP, false);
prefs.setDefault(IConsoleConstants.AUTO_PIN_ENABLED_PREF_NAME, true);
prefs.setDefault(IConsoleConstants.REMEMBER_AUTO_PIN_DECISION_PREF_NAME, false);
prefs.setDefault(IConsoleConstants.UPDATE_CONSOLE_ICON, true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
private Image currentIcon, defaultIcon;
private LocalResourceManager localResManager;

private boolean updateConsoleIcon;

private boolean isAvailable() {
return getPageBook() != null && !getPageBook().isDisposed();
}
Expand All @@ -141,9 +143,17 @@ public void propertyChange(PropertyChangeEvent event) {
updateTitle();
}
}
if (IConsoleConstants.UPDATE_CONSOLE_ICON.equals(event.getProperty())) {
updateConsoleIcon = shouldUpdateConsoleIcon();
updateIcon();
}

}

private boolean shouldUpdateConsoleIcon() {
return ConsolePlugin.getDefault().getPreferenceStore().getBoolean(IConsoleConstants.UPDATE_CONSOLE_ICON);
}

@Override
public void partClosed(IWorkbenchPart part) {
super.partClosed(part);
Expand Down Expand Up @@ -277,6 +287,13 @@ protected void updateHelp() {
}

protected void updateIcon() {
if (!updateConsoleIcon) {
if (currentIcon != defaultIcon) {
currentIcon = defaultIcon;
setTitleImage(currentIcon);
}
return;
}
IConsole console = getConsole();
if (console == null) {
// Check and restore default console icon if last page is closed
Expand Down Expand Up @@ -412,6 +429,7 @@ public void dispose() {
localResManager.dispose();
localResManager = null;
}
ConsolePlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
}

/**
Expand Down Expand Up @@ -612,8 +630,10 @@ public void createPartControl(Composite parent) {
getViewSite().getPage().addPartListener((IPartListener2)this);
initPageSwitcher();
localResManager = new LocalResourceManager(JFaceResources.getResources(), parent);
updateConsoleIcon = shouldUpdateConsoleIcon();
defaultIcon = ConsolePluginImages.getImage(IConsoleConstants.IMG_VIEW_CONSOLE);
currentIcon = defaultIcon;
ConsolePlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
}

/**
Expand Down
Loading