|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2000, 2018 IBM Corporation and others. |
| 2 | + * Copyright (c) 2000, 2026 IBM Corporation and others. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials |
5 | 5 | * are made available under the terms of the Eclipse Public License 2.0 |
|
35 | 35 | import org.eclipse.swt.custom.StyledText; |
36 | 36 | import org.eclipse.swt.events.MouseAdapter; |
37 | 37 | import org.eclipse.swt.events.MouseEvent; |
| 38 | +import org.eclipse.swt.graphics.Image; |
38 | 39 | import org.eclipse.swt.graphics.Point; |
39 | 40 | import org.eclipse.swt.widgets.Composite; |
40 | 41 | import org.eclipse.swt.widgets.Control; |
@@ -123,6 +124,8 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL |
123 | 124 | private boolean fScrollLock; |
124 | 125 | private boolean fWordWrap; |
125 | 126 |
|
| 127 | + private Image currentIcon; |
| 128 | + |
126 | 129 | private boolean isAvailable() { |
127 | 130 | return getPageBook() != null && !getPageBook().isDisposed(); |
128 | 131 | } |
@@ -184,6 +187,7 @@ protected void showPageRec(PageRec pageRec) { |
184 | 187 | } |
185 | 188 | updateTitle(); |
186 | 189 | updateHelp(); |
| 190 | + updateIcon(); |
187 | 191 | // update console actions |
188 | 192 | if (fPinAction != null) { |
189 | 193 | fPinAction.update(); |
@@ -269,6 +273,29 @@ protected void updateHelp() { |
269 | 273 | PlatformUI.getWorkbench().getHelpSystem().setHelp(getPageBook().getParent(), helpContextId); |
270 | 274 | } |
271 | 275 |
|
| 276 | + protected void updateIcon() { |
| 277 | + IConsole console = getConsole(); |
| 278 | + if (console == null) { |
| 279 | + return; |
| 280 | + } |
| 281 | + |
| 282 | + Image newImage = null; |
| 283 | + ImageDescriptor imageDesc = console.getImageDescriptor(); |
| 284 | + if (imageDesc != null) { |
| 285 | + newImage = imageDesc.createImage(); |
| 286 | + } else { |
| 287 | + newImage = ConsolePluginImages.getImage(IConsoleConstants.IMG_VIEW_CONSOLE); |
| 288 | + } |
| 289 | + if (newImage != null && !newImage.equals(currentIcon)) { |
| 290 | + if (currentIcon != null && !currentIcon.isDisposed() |
| 291 | + && currentIcon != ConsolePluginImages.getImage(IConsoleConstants.IMG_VIEW_CONSOLE)) { |
| 292 | + currentIcon.dispose(); |
| 293 | + } |
| 294 | + currentIcon = newImage; |
| 295 | + setTitleImage(currentIcon); |
| 296 | + } |
| 297 | + } |
| 298 | + |
272 | 299 | @Override |
273 | 300 | protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) { |
274 | 301 | IConsole console = fPartToConsole.get(part); |
|
0 commit comments