From 5c6ea2890ad73dfbb54329b311321e39a7623deb Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Tue, 28 Mar 2023 15:35:43 -0700 Subject: [PATCH] Switch "Install" to "Download" for downloaded extensions (#22498) --- src/sql/base/common/locConstants.ts | 3 +++ .../extensions/browser/extensionsActions.ts | 25 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/sql/base/common/locConstants.ts b/src/sql/base/common/locConstants.ts index 96f8047bd5..fd73553fd6 100644 --- a/src/sql/base/common/locConstants.ts +++ b/src/sql/base/common/locConstants.ts @@ -92,4 +92,7 @@ export const outputLineHeightDescription = localize('notebook.outputLineHeight', export const outputFontSizeDescription = localize('notebook.outputFontSize', "Font size for the output text for notebook cells. When set to 0 `#editor.fontSize#` is used. (for VS Code Notebooks only)"); export const outputFontFamilyDescription = localize('notebook.outputFontFamily', "The font family for the output text for notebook cells. When set to empty, the `#editor.fontFamily#` is used. (for VS Code Notebooks only)"); export const experimentalCustomizationDescription = localize('notebook.editorOptions.experimentalCustomization', 'Settings for code editors used in notebooks. This can be used to customize most editor.* settings. (for VS Code Notebooks only)'); +export const download = localize('azuredatastudio.download', 'Download'); +export const downloadTooltip = localize('azuredatastudio.downloadTooltip', "Download this extension from an external source"); +export const installTooltip = localize('azuredatastudio.installTooltip', "Install this extension"); //#endregion diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index 14a8705190..c2ff07fe04 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -268,6 +268,7 @@ export abstract class AbstractInstallAction extends ExtensionAction { if (this.extension.state === ExtensionState.Uninstalled && await this.extensionsWorkbenchService.canInstall(this.extension)) { this.enabled = this.installPreReleaseVersion ? this.extension.hasPreReleaseVersion : this.extension.hasReleaseVersion; this.updateLabel(); + this.updateTooltip(); // {{SQL CARBON EDIT}} Update tooltip for download extensions } } } @@ -360,6 +361,8 @@ export abstract class AbstractInstallAction extends ExtensionAction { return null; } + protected abstract updateTooltip(): void; // {{SQL CARBON EDIT}} Update tooltip for download extensions + protected updateLabel(): void { this.label = this.getLabel(); } @@ -373,7 +376,7 @@ export abstract class AbstractInstallAction extends ExtensionAction { if (this.extension?.hasPreReleaseVersion) { return primary ? localize('install', "Install") : localize('install release version', "Install Release Version"); } - return localize('install', "Install"); + return this.extension?.downloadPage ? locConstants.download : localize('install', "Install"); // {{SQL CARBON EDIT}} Update label for download extensions } protected getInstallOptions(): InstallOptions { @@ -403,6 +406,13 @@ export class InstallAction extends AbstractInstallAction { Event.filter(userDataSyncEnablementService.onDidChangeResourceEnablement, e => e[0] === SyncResource.Extensions))(() => this.update())); } + // {{SQL CARBON EDIT}} Update tooltip for download extensions + protected updateTooltip(): void { + this.tooltip = this.extension?.downloadPage ? + locConstants.downloadTooltip : + locConstants.installTooltip; + } + override getLabel(primary?: boolean): string { const baseLabel = super.getLabel(primary); @@ -456,17 +466,26 @@ export class InstallAndSyncAction extends AbstractInstallAction { @IExtensionService runtimeExtensionService: IExtensionService, @IWorkbenchThemeService workbenchThemeService: IWorkbenchThemeService, @ILabelService labelService: ILabelService, - @IProductService productService: IProductService, + @IProductService private readonly productService: IProductService, // {{SQL CARBON EDIT}} Update label for download extensions @IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService, @INotificationService readonly localNotificationService: INotificationService // {{SQL CARBON EDIT}} ) { super('extensions.installAndSync', installPreReleaseVersion, AbstractInstallAction.Class, extensionsWorkbenchService, instantiationService, runtimeExtensionService, workbenchThemeService, labelService, localNotificationService); - this.tooltip = localize({ key: 'install everywhere tooltip', comment: ['Placeholder is the name of the product. Eg: Azure Data Studio or Azure Data Studio - Insiders'] }, "Install this extension in all your synced {0} instances", productService.nameLong); + // {{SQL CARBON EDIT}} Update tooltip for download extensions - this is done in updateTooltip below + // this.tooltip = localize({ key: 'install everywhere tooltip', comment: ['Placeholder is the name of the product. Eg: Azure Data Studio or Azure Data Studio - Insiders'] }, "Install this extension in all your synced {0} instances", productService.nameLong); + this.updateTooltip(); this._register(Event.any(userDataSyncEnablementService.onDidChangeEnablement, Event.filter(userDataSyncEnablementService.onDidChangeResourceEnablement, e => e[0] === SyncResource.Extensions))(() => this.update())); } + // {{SQL CARBON EDIT}} Update tooltip for download extensions + protected updateTooltip(): void { + this.tooltip = this.extension?.downloadPage ? + locConstants.downloadTooltip : + localize({ key: 'install everywhere tooltip', comment: ['Placeholder is the name of the product. Eg: Azure Data Studio or Azure Data Studio - Insiders'] }, "Install this extension in all your synced {0} instances", this.productService.nameLong) + } + protected override async computeAndUpdateEnablement(): Promise { await super.computeAndUpdateEnablement(); if (this.enabled) {