@@ -10,7 +10,7 @@ import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/acti
1010import { GlobalActivityExtensions , IGlobalActivityRegistry } from 'vs/workbench/common/activity' ;
1111import { Registry } from 'vs/platform/registry/common/platform' ;
1212import { Part } from 'vs/workbench/browser/part' ;
13- import { GlobalActivityActionItem , GlobalActivityAction , ViewletActivityAction , ToggleViewletAction , CachedToggleCompositePinnedAction , CachedViewletActivityAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions' ;
13+ import { GlobalActivityActionItem , GlobalActivityAction , ViewletActivityAction , ToggleViewletAction , PlaceHolderToggleCompositePinnedAction , PlaceHolderViewletActivityAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions' ;
1414import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet' ;
1515import { IBadge } from 'vs/workbench/services/activity/common/activity' ;
1616import { IPartService , Parts , Position as SideBarPosition } from 'vs/workbench/services/part/common/partService' ;
@@ -33,27 +33,27 @@ import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
3333import { IViewsService , IViewContainersRegistry , Extensions as ViewContainerExtensions } from 'vs/workbench/common/views' ;
3434import { IContextKeyService , ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
3535
36- interface ICachedComposite {
36+ interface IPlaceholderComposite {
3737 id : string ;
3838 iconUrl : URI ;
3939}
4040
41- interface ISerializedCachedComposite extends ICachedComposite {
41+ interface ISerializedPlaceholderComposite extends IPlaceholderComposite {
4242 whens ?: string [ ] ;
4343}
4444
4545export class ActivitybarPart extends Part {
4646
4747 private static readonly ACTION_HEIGHT = 50 ;
4848 private static readonly PINNED_VIEWLETS = 'workbench.activity.pinnedViewlets' ;
49- private static readonly CACHED_VIEWLETS = 'workbench.activity.placeholderViewlets' ;
49+ private static readonly PLACEHOLDER_VIEWLETS = 'workbench.activity.placeholderViewlets' ;
5050
5151 private dimension : Dimension ;
5252
5353 private globalActionBar : ActionBar ;
5454 private globalActivityIdToActions : { [ globalActivityId : string ] : GlobalActivityAction ; } = Object . create ( null ) ;
5555
56- private cachedComposites : ICachedComposite [ ] = [ ] ;
56+ private placeholderComposites : IPlaceholderComposite [ ] = [ ] ;
5757 private compositeBar : CompositeBar ;
5858 private compositeActions : { [ compositeId : string ] : { activityAction : ViewletActivityAction , pinnedAction : ToggleCompositePinnedAction } } = Object . create ( null ) ;
5959
@@ -87,17 +87,17 @@ export class ActivitybarPart extends Part {
8787 overflowActionSize : ActivitybarPart . ACTION_HEIGHT
8888 } ) ) ;
8989
90- const previousState = this . storageService . get ( ActivitybarPart . CACHED_VIEWLETS , StorageScope . GLOBAL , '[]' ) ;
91- const serializedCachedComposites = < ISerializedCachedComposite [ ] > JSON . parse ( previousState ) ;
92- this . cachedComposites = [ ] ;
93- for ( const { id, iconUrl, whens } of serializedCachedComposites ) {
90+ const previousState = this . storageService . get ( ActivitybarPart . PLACEHOLDER_VIEWLETS , StorageScope . GLOBAL , '[]' ) ;
91+ const serializedPlaceholderComposites = < ISerializedPlaceholderComposite [ ] > JSON . parse ( previousState ) ;
92+ this . placeholderComposites = [ ] ;
93+ for ( const { id, iconUrl, whens } of serializedPlaceholderComposites ) {
9494 if ( whens && whens . length > 0 ) {
9595 if ( whens . every ( when => ! contextKeyService . contextMatchesRules ( ContextKeyExpr . deserialize ( when ) ) ) ) {
9696 // Hidden by default
9797 continue ;
9898 }
9999 }
100- this . cachedComposites . push ( {
100+ this . placeholderComposites . push ( {
101101 id,
102102 iconUrl : typeof iconUrl === 'object' ? URI . revive ( iconUrl ) : void 0
103103 } ) ;
@@ -253,10 +253,10 @@ export class ActivitybarPart extends Part {
253253 pinnedAction : new ToggleCompositePinnedAction ( viewlet , this . compositeBar )
254254 } ;
255255 } else {
256- const cachedComposite = this . cachedComposites . filter ( c => c . id === compositeId ) [ 0 ] ;
256+ const placeHolderComposite = this . placeholderComposites . filter ( c => c . id === compositeId ) [ 0 ] ;
257257 compositeActions = {
258- activityAction : this . instantiationService . createInstance ( CachedViewletActivityAction , compositeId , cachedComposite && cachedComposite . iconUrl ) ,
259- pinnedAction : new CachedToggleCompositePinnedAction ( compositeId , this . compositeBar )
258+ activityAction : this . instantiationService . createInstance ( PlaceHolderViewletActivityAction , compositeId , placeHolderComposite && placeHolderComposite . iconUrl ) ,
259+ pinnedAction : new PlaceHolderToggleCompositePinnedAction ( compositeId , this . compositeBar )
260260 } ;
261261 }
262262
@@ -271,8 +271,8 @@ export class ActivitybarPart extends Part {
271271 for ( const viewlet of viewlets ) {
272272 this . compositeBar . addComposite ( viewlet ) ;
273273
274- // Pin it by default if it is new => it is not in cache
275- if ( this . cachedComposites . every ( c => c . id !== viewlet . id ) ) {
274+ // Pin it by default if it is new => it does not has a placeholder
275+ if ( this . placeholderComposites . every ( c => c . id !== viewlet . id ) ) {
276276 this . compositeBar . pin ( viewlet . id ) ;
277277 }
278278
@@ -309,10 +309,10 @@ export class ActivitybarPart extends Part {
309309
310310 private enableCompositeActions ( viewlet : ViewletDescriptor ) : void {
311311 const { activityAction, pinnedAction } = this . getCompositeActions ( viewlet . id ) ;
312- if ( activityAction instanceof CachedViewletActivityAction ) {
312+ if ( activityAction instanceof PlaceHolderViewletActivityAction ) {
313313 activityAction . setActivity ( viewlet ) ;
314314 }
315- if ( pinnedAction instanceof CachedToggleCompositePinnedAction ) {
315+ if ( pinnedAction instanceof PlaceHolderToggleCompositePinnedAction ) {
316316 pinnedAction . setActivity ( viewlet ) ;
317317 }
318318 }
@@ -347,7 +347,7 @@ export class ActivitybarPart extends Part {
347347
348348 protected saveState ( ) : void {
349349 const viewContainerRegistry = Registry . as < IViewContainersRegistry > ( ViewContainerExtensions . ViewContainersRegistry ) ;
350- const state : ISerializedCachedComposite [ ] = [ ] ;
350+ const state : ISerializedPlaceholderComposite [ ] = [ ] ;
351351 for ( const { id, iconUrl } of this . viewletService . getAllViewlets ( ) ) {
352352 const viewContainer = viewContainerRegistry . get ( id ) ;
353353 const whens : string [ ] = [ ] ;
@@ -360,7 +360,7 @@ export class ActivitybarPart extends Part {
360360 }
361361 state . push ( { id, iconUrl, whens } ) ;
362362 }
363- this . storageService . store ( ActivitybarPart . CACHED_VIEWLETS , JSON . stringify ( state ) , StorageScope . GLOBAL ) ;
363+ this . storageService . store ( ActivitybarPart . PLACEHOLDER_VIEWLETS , JSON . stringify ( state ) , StorageScope . GLOBAL ) ;
364364
365365 super . saveState ( ) ;
366366 }
0 commit comments