diff --git a/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts b/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts index 25e0f794..23a5f9a2 100644 --- a/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts +++ b/arduino-ide-extension/src/browser/theia/core/shell-layout-restorer.ts @@ -4,9 +4,28 @@ import { ShellLayoutRestorer as TheiaShellLayoutRestorer } from '@theia/core/lib import { injectable } from '@theia/core/shared/inversify'; import { EditorPreviewWidgetFactory } from '@theia/editor-preview/lib/browser/editor-preview-widget-factory'; import { EditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory'; +import { FrontendApplication } from './frontend-application'; @injectable() export class ShellLayoutRestorer extends TheiaShellLayoutRestorer { + override async restoreLayout(app: FrontendApplication): Promise { + this.logger.info('>>> Restoring the layout state...'); + const serializedLayoutData = await this.storageService.getData( + this.storageKey + ); + if (serializedLayoutData === undefined) { + this.logger.info('<<< Nothing to restore.'); + return false; + } + console.log('------- SERIALIZED LAYOUT DATA -------'); + console.log(serializedLayoutData); + console.log('------- END SERIALIZED LAYOUT DATA -------'); + const layoutData = await this.inflate(serializedLayoutData); + await app.shell.setLayoutData(layoutData); + this.logger.info('<<< The layout has been successfully restored.'); + return true; + } + /** * Customized to filter out duplicate editor tabs. */