@@ -32,6 +32,7 @@ import { Event } from 'vs/base/common/event';
32
32
import { Action } from 'vs/base/common/actions' ;
33
33
34
34
export const CONTEXT_UPDATE_STATE = new RawContextKey < string > ( 'updateState' , StateType . Uninitialized ) ;
35
+ export const MAJOR_MINOR_UPDATE_AVAILABLE = new RawContextKey < boolean > ( 'majorMinorUpdateAvailable' , false ) ;
35
36
export const RELEASE_NOTES_URL = new RawContextKey < string > ( 'releaseNotesUrl' , '' ) ;
36
37
export const DOWNLOAD_URL = new RawContextKey < string > ( 'downloadUrl' , '' ) ;
37
38
@@ -160,6 +161,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
160
161
private state : UpdateState ;
161
162
private readonly badgeDisposable = this . _register ( new MutableDisposable ( ) ) ;
162
163
private updateStateContextKey : IContextKey < string > ;
164
+ private majorMinorUpdateAvailableContextKey : IContextKey < boolean > ;
163
165
164
166
constructor (
165
167
@IStorageService private readonly storageService : IStorageService ,
@@ -176,6 +178,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
176
178
super ( ) ;
177
179
this . state = updateService . state ;
178
180
this . updateStateContextKey = CONTEXT_UPDATE_STATE . bindTo ( this . contextKeyService ) ;
181
+ this . majorMinorUpdateAvailableContextKey = MAJOR_MINOR_UPDATE_AVAILABLE . bindTo ( this . contextKeyService ) ;
179
182
180
183
this . _register ( updateService . onStateChange ( this . onUpdateStateChange , this ) ) ;
181
184
this . onUpdateStateChange ( this . updateService . state ) ;
@@ -237,9 +240,13 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
237
240
this . onUpdateDownloaded ( state . update ) ;
238
241
break ;
239
242
240
- case StateType . Ready :
243
+ case StateType . Ready : {
244
+ const currentVersion = parseVersion ( this . productService . version ) ;
245
+ const nextVersion = parseVersion ( state . update . productVersion ) ;
246
+ this . majorMinorUpdateAvailableContextKey . set ( Boolean ( currentVersion && nextVersion && isMajorMinorUpdate ( currentVersion , nextVersion ) ) ) ;
241
247
this . onUpdateReady ( state . update ) ;
242
248
break ;
249
+ }
243
250
}
244
251
245
252
let badge : IBadge | undefined = undefined ;
@@ -461,16 +468,18 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
461
468
} ) ;
462
469
MenuRegistry . appendMenuItem ( MenuId . GlobalActivity , {
463
470
group : '7_update' ,
471
+ order : 1 ,
464
472
command : {
465
473
id : 'update.showUpdateReleaseNotes' ,
466
474
title : nls . localize ( 'showUpdateReleaseNotes' , "Show Update Release Notes" )
467
475
} ,
468
- when : CONTEXT_UPDATE_STATE . isEqualTo ( StateType . Ready )
476
+ when : ContextKeyExpr . and ( CONTEXT_UPDATE_STATE . isEqualTo ( StateType . Ready ) , MAJOR_MINOR_UPDATE_AVAILABLE )
469
477
} ) ;
470
478
471
479
CommandsRegistry . registerCommand ( 'update.restart' , ( ) => this . updateService . quitAndInstall ( ) ) ;
472
480
MenuRegistry . appendMenuItem ( MenuId . GlobalActivity , {
473
481
group : '7_update' ,
482
+ order : 2 ,
474
483
command : {
475
484
id : 'update.restart' ,
476
485
title : nls . localize ( 'restartToUpdate' , "Restart to Update (1)" )
0 commit comments