File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
arduino-ide-extension/src/browser/theia/core Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -22,4 +22,32 @@ export class ShellLayoutRestorer extends TheiaShellLayoutRestorer {
2222 }
2323 }
2424 }
25+
26+ async restoreLayout ( app : FrontendApplication ) : Promise < boolean > {
27+ this . logger . info ( '>>> Restoring the layout state...' ) ;
28+ const serializedLayoutData = await this . storageService . getData < string > (
29+ this . storageKey
30+ ) ;
31+ if ( serializedLayoutData === undefined ) {
32+ this . logger . info ( '<<< Nothing to restore.' ) ;
33+ return false ;
34+ }
35+
36+ const layoutData = await this . inflate ( serializedLayoutData ) ;
37+ // workaround to remove duplicated tabs
38+ if ( ( layoutData as any ) ?. mainPanel ?. main ?. widgets ) {
39+ ( layoutData as any ) . mainPanel . main . widgets = (
40+ layoutData as any
41+ ) . mainPanel . main . widgets . filter (
42+ ( widget : any ) =>
43+ widget . constructionOptions . factoryId !== 'code-editor-opener'
44+ ) ;
45+ }
46+
47+ await app . shell . setLayoutData ( layoutData ) ;
48+ this . logger . info ( '<<< The layout has been successfully restored.' ) ;
49+ return true ;
50+
51+ // return super.restoreLayout(app);
52+ }
2553}
You can’t perform that action at this time.
0 commit comments