diff --git a/src/sql/workbench/contrib/welcome2/gettingStarted/browser/abstractEnablePreviewFeatures.ts b/src/sql/workbench/contrib/welcome2/gettingStarted/browser/abstractEnablePreviewFeatures.ts deleted file mode 100644 index 2313d4c804..0000000000 --- a/src/sql/workbench/contrib/welcome2/gettingStarted/browser/abstractEnablePreviewFeatures.ts +++ /dev/null @@ -1,67 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; -import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; -import { localize } from 'vs/nls'; -import { onUnexpectedError } from 'vs/base/common/errors'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; - -export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContribution { - - private static ENABLE_PREVIEW_FEATURES_SHOWN = 'workbench.enablePreviewFeaturesShown'; - - constructor( - @IStorageService private readonly storageService: IStorageService, - @INotificationService private readonly notificationService: INotificationService, - @IHostService private readonly hostService: IHostService, - @IConfigurationService private readonly configurationService: IConfigurationService - ) { } - - protected handlePreviewFeatures(): void { - let previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures']; - if (previewFeaturesEnabled || this.storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.GLOBAL)) { - return; - } - Promise.all([ - this.hostService.hasFocus, - this.getWindowCount() - ]).then(async ([focused, count]) => { - if (!focused && count > 1) { - return null; - } - await this.configurationService.updateValue('workbench.enablePreviewFeatures', false); - - const enablePreviewFeaturesNotice = localize('enablePreviewFeatures.notice', "Preview features are required in order for extensions to be fully supported and for some actions to be available. Would you like to enable preview features?"); - this.notificationService.prompt( - Severity.Info, - enablePreviewFeaturesNotice, - [{ - label: localize('enablePreviewFeatures.yes', "Yes"), - run: () => { - this.configurationService.updateValue('workbench.enablePreviewFeatures', true).catch(e => onUnexpectedError(e)); - this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL); - } - }, { - label: localize('enablePreviewFeatures.no', "No"), - run: () => { - this.configurationService.updateValue('workbench.enablePreviewFeatures', false).catch(e => onUnexpectedError(e)); - } - }, { - label: localize('enablePreviewFeatures.never', "No, don't show again"), - run: () => { - this.configurationService.updateValue('workbench.enablePreviewFeatures', false).catch(e => onUnexpectedError(e)); - this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL); - }, - isSecondary: true - }] - ); - }).catch(e => onUnexpectedError(e)); - } - - protected abstract getWindowCount(): Promise; -} diff --git a/src/sql/workbench/contrib/welcome2/gettingStarted/browser/enablePreviewFeatures.ts b/src/sql/workbench/contrib/welcome2/gettingStarted/browser/enablePreviewFeatures.ts deleted file mode 100644 index 2ce21fe847..0000000000 --- a/src/sql/workbench/contrib/welcome2/gettingStarted/browser/enablePreviewFeatures.ts +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { AbstractEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/browser/abstractEnablePreviewFeatures'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; - -export class BrowserEnablePreviewFeatures extends AbstractEnablePreviewFeatures { - - constructor( - @IStorageService storageService: IStorageService, - @INotificationService notificationService: INotificationService, - @IHostService hostService: IHostService, - @IConfigurationService configurationService: IConfigurationService - ) { - super(storageService, notificationService, hostService, configurationService); - - this.handlePreviewFeatures(); - } - - protected async getWindowCount(): Promise { - return 1; - } -} diff --git a/src/sql/workbench/contrib/welcome2/gettingStarted/browser/gettingStarted.contribution.ts b/src/sql/workbench/contrib/welcome2/gettingStarted/browser/gettingStarted.contribution.ts deleted file mode 100644 index 43e0a8b72f..0000000000 --- a/src/sql/workbench/contrib/welcome2/gettingStarted/browser/gettingStarted.contribution.ts +++ /dev/null @@ -1,13 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { Registry } from 'vs/platform/registry/common/platform'; -import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; -import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -import { BrowserEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/browser/enablePreviewFeatures'; - -Registry - .as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(BrowserEnablePreviewFeatures, LifecyclePhase.Eventually); diff --git a/src/sql/workbench/contrib/welcome2/gettingStarted/electron-browser/enablePreviewFeatures.ts b/src/sql/workbench/contrib/welcome2/gettingStarted/electron-browser/enablePreviewFeatures.ts deleted file mode 100644 index b953d7ff5b..0000000000 --- a/src/sql/workbench/contrib/welcome2/gettingStarted/electron-browser/enablePreviewFeatures.ts +++ /dev/null @@ -1,30 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { AbstractEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/browser/abstractEnablePreviewFeatures'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IHostService } from 'vs/workbench/services/host/browser/host'; -import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; -import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron'; - -export class NativeEnablePreviewFeatures extends AbstractEnablePreviewFeatures { - - constructor( - @IStorageService storageService: IStorageService, - @INotificationService notificationService: INotificationService, - @IHostService hostService: IHostService, - @IConfigurationService configurationService: IConfigurationService, - @IElectronService private readonly electronService: IElectronService - ) { - super(storageService, notificationService, hostService, configurationService); - - this.handlePreviewFeatures(); - } - - protected getWindowCount(): Promise { - return this.electronService.getWindowCount(); - } -} diff --git a/src/sql/workbench/contrib/welcome2/gettingStarted/electron-browser/gettingStarted.contribution.ts b/src/sql/workbench/contrib/welcome2/gettingStarted/electron-browser/gettingStarted.contribution.ts deleted file mode 100644 index 94b6eee9cd..0000000000 --- a/src/sql/workbench/contrib/welcome2/gettingStarted/electron-browser/gettingStarted.contribution.ts +++ /dev/null @@ -1,13 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { Registry } from 'vs/platform/registry/common/platform'; -import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; -import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -import { NativeEnablePreviewFeatures } from 'sql/workbench/contrib/welcome/gettingStarted/electron-browser/enablePreviewFeatures'; - -Registry - .as(WorkbenchExtensions.Workbench) - .registerWorkbenchContribution(NativeEnablePreviewFeatures, LifecyclePhase.Eventually); diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts index bfe0ec6585..9ab49f720a 100644 --- a/src/vs/workbench/workbench.web.main.ts +++ b/src/vs/workbench/workbench.web.main.ts @@ -140,3 +140,10 @@ import 'vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut.con import 'vs/workbench/contrib/issue/browser/issue.web.contribution'; //#endregion + +//#region + +// Getting Started +import 'sql/workbench/contrib/welcome/gettingStarted/browser/gettingStarted.contribution'; + +//#endregion