@@ -13,6 +13,8 @@ import { MessageService } from '@theia/core/lib/common/message-service';
1313import { inject , injectable } from '@theia/core/shared/inversify' ;
1414import { ApplicationConnectionStatusContribution } from './connection-status-service' ;
1515import { ToolbarAwareTabBar } from './tab-bars' ;
16+ import { find } from '@theia/core/shared/@phosphor/algorithm' ;
17+ import { OutputWidget } from '@theia/output/lib/browser/output-widget' ;
1618
1719@injectable ( )
1820export class ApplicationShell extends TheiaApplicationShell {
@@ -48,6 +50,38 @@ export class ApplicationShell extends TheiaApplicationShell {
4850 return super . addWidget ( widget , { ...options , ref } ) ;
4951 }
5052
53+ override doRevealWidget ( id : string ) : Widget | undefined {
54+ let widget = find ( this . mainPanel . widgets ( ) , ( w ) => w . id === id ) ;
55+ if ( ! widget ) {
56+ widget = find ( this . bottomPanel . widgets ( ) , ( w ) => w . id === id ) ;
57+ if ( widget ) {
58+ this . expandBottomPanel ( ) ;
59+ }
60+ }
61+ if ( widget ) {
62+ const tabBar = this . getTabBarFor ( widget ) ;
63+ if ( tabBar ) {
64+ tabBar . currentTitle = widget . title ;
65+ }
66+ }
67+ if ( ! widget ) {
68+ widget = this . leftPanelHandler . expand ( id ) ;
69+ }
70+ if ( ! widget ) {
71+ widget = this . rightPanelHandler . expand ( id ) ;
72+ }
73+ if ( widget ) {
74+ // Prevent focusing the output widget when is updated
75+ // See https://github.com/arduino/arduino-ide/issues/2679
76+ if ( ! ( widget instanceof OutputWidget ) ) {
77+ this . windowService . focus ( ) ;
78+ }
79+ return widget ;
80+ } else {
81+ return this . secondaryWindowHandler . revealWidget ( id ) ;
82+ }
83+ }
84+
5185 override handleEvent ( ) : boolean {
5286 // NOOP, dragging has been disabled
5387 return false ;
0 commit comments