@@ -222,7 +222,7 @@ export class WorkspaceTrustRequestHandler extends Disposable implements IWorkben
222
222
*/
223
223
export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchContribution {
224
224
225
- private readonly entryId = `status.workspaceTrust. ${ this . workspaceContextService . getWorkspace ( ) . id } ` ;
225
+ private readonly entryId = `status.workspaceTrust` ;
226
226
227
227
private readonly statusbarEntryAccessor : MutableDisposable < IStatusbarEntryAccessor > ;
228
228
@@ -253,7 +253,7 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
253
253
254
254
if ( this . workspaceTrustEnablementService . isWorkspaceTrustEnabled ( ) ) {
255
255
this . registerListeners ( ) ;
256
- this . createStatusbarEntry ( ) ;
256
+ this . updateStatusbarEntry ( this . workspaceTrustManagementService . isWorkspaceTrusted ( ) ) ;
257
257
258
258
// Show modal dialog
259
259
if ( this . hostService . hasFocus ) {
@@ -555,12 +555,6 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
555
555
556
556
//#region Statusbar
557
557
558
- private createStatusbarEntry ( ) : void {
559
- const entry = this . getStatusbarEntry ( this . workspaceTrustManagementService . isWorkspaceTrusted ( ) ) ;
560
- this . statusbarEntryAccessor . value = this . statusbarService . addEntry ( entry , this . entryId , StatusbarAlignment . LEFT , 0.99 * Number . MAX_VALUE /* Right of remote indicator */ ) ;
561
- this . statusbarService . updateEntryVisibility ( this . entryId , false ) ;
562
- }
563
-
564
558
private getStatusbarEntry ( trusted : boolean ) : IStatusbarEntry {
565
559
const text = workspaceTrustToString ( trusted ) ;
566
560
@@ -625,8 +619,15 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
625
619
}
626
620
627
621
private updateStatusbarEntry ( trusted : boolean ) : void {
628
- this . statusbarEntryAccessor . value ?. update ( this . getStatusbarEntry ( trusted ) ) ;
629
- this . statusbarService . updateEntryVisibility ( this . entryId , ! trusted ) ;
622
+ if ( trusted && this . statusbarEntryAccessor . value ) {
623
+ this . statusbarEntryAccessor . clear ( ) ;
624
+ return ;
625
+ }
626
+
627
+ if ( ! trusted && ! this . statusbarEntryAccessor . value ) {
628
+ const entry = this . getStatusbarEntry ( trusted ) ;
629
+ this . statusbarEntryAccessor . value = this . statusbarService . addEntry ( entry , this . entryId , StatusbarAlignment . LEFT , 0.99 * Number . MAX_VALUE /* Right of remote indicator */ ) ;
630
+ }
630
631
}
631
632
632
633
//#endregion
0 commit comments