@@ -7,11 +7,10 @@ import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle
7
7
import { Registry } from 'vs/platform/registry/common/platform' ;
8
8
import { Extensions as WorkbenchExtensions , IWorkbenchContributionsRegistry , IWorkbenchContribution } from 'vs/workbench/common/contributions' ;
9
9
import { Disposable , MutableDisposable } from 'vs/base/common/lifecycle' ;
10
- import { ContextKeyExpr , ContextKeyTrueExpr , IContextKeyService , RawContextKey } from 'vs/platform/contextkey/common/contextkey' ;
11
- import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
10
+ import { ContextKeyExpr , IContextKeyService , RawContextKey } from 'vs/platform/contextkey/common/contextkey' ;
11
+ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
12
12
import { ICommandService } from 'vs/platform/commands/common/commands' ;
13
13
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
14
- import { IOpenerService } from 'vs/platform/opener/common/opener' ;
15
14
import { AuthenticationSession , IAuthenticationService } from 'vs/workbench/services/authentication/common/authentication' ;
16
15
import { Action2 , MenuId , registerAction2 } from 'vs/platform/actions/common/actions' ;
17
16
import { IActivityService , NumberBadge } from 'vs/workbench/services/activity/common/activity' ;
@@ -26,6 +25,7 @@ import { localize } from 'vs/nls';
26
25
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
27
26
import { IRequestService , asText } from 'vs/platform/request/common/request' ;
28
27
import { CancellationToken } from 'vs/base/common/cancellation' ;
28
+ import { IDialogService } from 'vs/platform/dialogs/common/dialogs' ;
29
29
30
30
const configurationKey = 'workbench.accounts.experimental.showEntitlements' ;
31
31
@@ -35,10 +35,8 @@ class AccountsEntitlement extends Disposable implements IWorkbenchContribution {
35
35
36
36
constructor (
37
37
@IContextKeyService readonly contextService : IContextKeyService ,
38
- @IInstantiationService readonly instantiationService : IInstantiationService ,
39
38
@ICommandService readonly commandService : ICommandService ,
40
39
@ITelemetryService readonly telemetryService : ITelemetryService ,
41
- @IOpenerService readonly openerService : IOpenerService ,
42
40
@IAuthenticationService readonly authenticationService : IAuthenticationService ,
43
41
@IProductService readonly productService : IProductService ,
44
42
@IStorageService readonly storageService : IStorageService ,
@@ -168,40 +166,24 @@ class AccountsEntitlement extends Disposable implements IWorkbenchContribution {
168
166
const commandService = accessor . get ( ICommandService ) ;
169
167
const contextKeyService = accessor . get ( IContextKeyService ) ;
170
168
const storageService = accessor . get ( IStorageService ) ;
171
- commandService . executeCommand ( productService . gitHubEntitlement ! . command . action , productService . gitHubEntitlement ! . extensionId ! ) ;
169
+ const dialogService = accessor . get ( IDialogService ) ;
170
+
171
+ const confirmation = await dialogService . confirm ( {
172
+ type : 'question' ,
173
+ message : productService . gitHubEntitlement ! . confirmationMessage ,
174
+ primaryButton : productService . gitHubEntitlement ! . confirmationAction ,
175
+ } ) ;
176
+
177
+ if ( confirmation . confirmed ) {
178
+ commandService . executeCommand ( productService . gitHubEntitlement ! . command . action , productService . gitHubEntitlement ! . extensionId ! ) ;
179
+ }
180
+
172
181
accountsMenuBadgeDisposable . clear ( ) ;
173
182
const contextKey = new RawContextKey < boolean > ( configurationKey , true ) . bindTo ( contextKeyService ) ;
174
183
contextKey . set ( false ) ;
175
184
storageService . store ( configurationKey , false , StorageScope . APPLICATION , StorageTarget . MACHINE ) ;
176
185
}
177
186
} ) ;
178
-
179
- const altMenuTitle = this . productService . gitHubEntitlement ! . altCommand . title ! ;
180
- const altContextKey = this . productService . gitHubEntitlement ! . altCommand . when ;
181
-
182
- registerAction2 ( class extends Action2 {
183
- constructor ( ) {
184
- super ( {
185
- id : 'workbench.action.entitlementAltAction' ,
186
- title : altMenuTitle ,
187
- f1 : false ,
188
- toggled : ContextKeyTrueExpr . INSTANCE ,
189
- menu : {
190
- id : MenuId . AccountsContext ,
191
- group : '5_AccountsEntitlements' ,
192
- when : ContextKeyExpr . equals ( altContextKey , true ) ,
193
- }
194
- } ) ;
195
- }
196
-
197
- public async run (
198
- accessor : ServicesAccessor
199
- ) {
200
- const productService = accessor . get ( IProductService ) ;
201
- const commandService = accessor . get ( ICommandService ) ;
202
- commandService . executeCommand ( productService . gitHubEntitlement ! . altCommand . action , productService . gitHubEntitlement ! . extensionId ! ) ;
203
- }
204
- } ) ;
205
187
}
206
188
}
207
189
0 commit comments