33 ********************************************************************************/
44
55import { CrossModelWidget , CrossModelWidgetOptions } from '@crossmodel/core/lib/browser' ;
6- import { NavigatableWidget , NavigatableWidgetOptions , StatefulWidget } from '@theia/core/lib/browser' ;
6+ import { Message , NavigatableWidget , NavigatableWidgetOptions , StatefulWidget } from '@theia/core/lib/browser' ;
77import { CommonCommands } from '@theia/core/lib/browser/common-frontend-contribution' ;
88import { CommandService } from '@theia/core/lib/common/command' ;
9+ import { SelectionService } from '@theia/core/lib/common/selection-service' ;
910import URI from '@theia/core/lib/common/uri' ;
1011import { inject , injectable , postConstruct } from '@theia/core/shared/inversify' ;
1112
@@ -20,7 +21,10 @@ export class FormEditorWidget extends CrossModelWidget implements NavigatableWid
2021 @inject ( CommandService )
2122 protected readonly commandService : CommandService ;
2223
23- protected override handleOpenRequest = undefined ; // we do not need to support opening in editor, we are the editor
24+ @inject ( SelectionService )
25+ protected readonly selectionService : SelectionService ;
26+
27+ protected override handleOpenRequest = undefined ;
2428
2529 protected override getModelProviderProps ( ) : any {
2630 const props = super . getModelProviderProps ( ) ;
@@ -54,4 +58,9 @@ export class FormEditorWidget extends CrossModelWidget implements NavigatableWid
5458 restoreState ( oldState : object | undefined ) : void {
5559 // nothing to restore
5660 }
61+
62+ protected override onActivateRequest ( msg : Message ) : void {
63+ super . onActivateRequest ( msg ) ;
64+ this . selectionService . selection = { sourceUri : this . getResourceUri ( ) . toString ( ) } ;
65+ }
5766}
0 commit comments