@@ -199,7 +199,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
199199
200200 private onDidRegisterExtensions ( ) : void {
201201 this . removeNotExistingComposites ( ) ;
202-
203202 this . saveCachedViewlets ( ) ;
204203 }
205204
@@ -477,14 +476,14 @@ export class ActivitybarPart extends Part implements IActivityBarService {
477476 }
478477
479478 for ( const viewlet of viewlets ) {
480- this . enableCompositeActions ( viewlet ) ;
481479 const viewContainer = this . getViewContainer ( viewlet . id ) ! ;
482480 const viewContainerModel = this . viewDescriptorService . getViewContainerModel ( viewContainer ) ;
483- this . onDidChangeActiveViews ( viewlet , viewContainerModel , viewContainer . hideIfEmpty ) ;
481+ this . updateActivity ( viewlet , viewContainerModel ) ;
482+ this . onDidChangeActiveViews ( viewContainer , viewContainerModel ) ;
484483
485484 const disposables = new DisposableStore ( ) ;
486- disposables . add ( viewContainerModel . onDidChangeActiveViewDescriptors ( ( ) => this . onDidChangeActiveViews ( viewlet , viewContainerModel , viewContainer . hideIfEmpty ) ) ) ;
487485 disposables . add ( viewContainerModel . onDidChangeContainerInfo ( ( ) => this . updateActivity ( viewlet , viewContainerModel ) ) ) ;
486+ disposables . add ( viewContainerModel . onDidChangeActiveViewDescriptors ( ( ) => this . onDidChangeActiveViews ( viewContainer , viewContainerModel ) ) ) ;
488487
489488 this . viewletDisposables . set ( viewlet . id , disposables ) ;
490489 }
@@ -501,13 +500,12 @@ export class ActivitybarPart extends Part implements IActivityBarService {
501500 }
502501
503502 private updateActivity ( viewlet : ViewletDescriptor , viewContainerModel : IViewContainerModel ) : void {
504- const icon = viewContainerModel . icon ;
505503
506504 const activity : IActivity = {
507505 id : viewlet . id ,
508506 name : viewContainerModel . title ,
509- cssClass : isString ( icon ) ? icon : undefined ,
510- iconUrl : icon instanceof URI ? icon : undefined ,
507+ iconUrl : URI . isUri ( viewContainerModel . icon ) ? viewContainerModel . icon : undefined ,
508+ cssClass : isString ( viewContainerModel . icon ) ? viewContainerModel . icon : undefined ,
511509 keybindingId : viewlet . keybindingId
512510 } ;
513511
@@ -517,14 +515,15 @@ export class ActivitybarPart extends Part implements IActivityBarService {
517515 if ( pinnedAction instanceof PlaceHolderToggleCompositePinnedAction ) {
518516 pinnedAction . setActivity ( activity ) ;
519517 }
518+
519+ this . saveCachedViewlets ( ) ;
520520 }
521521
522- private onDidChangeActiveViews ( viewlet : ViewletDescriptor , viewDescriptors : IViewContainerModel , hideIfEmpty ?: boolean ) : void {
523- if ( viewDescriptors . activeViewDescriptors . length ) {
524- this . updateActivity ( viewlet , viewDescriptors ) ;
525- this . compositeBar . addComposite ( viewlet ) ;
526- } else if ( hideIfEmpty ) {
527- this . hideComposite ( viewlet . id ) ;
522+ private onDidChangeActiveViews ( viewContainer : ViewContainer , viewContainerModel : IViewContainerModel ) : void {
523+ if ( viewContainerModel . activeViewDescriptors . length ) {
524+ this . compositeBar . addComposite ( viewContainer ) ;
525+ } else if ( viewContainer . hideIfEmpty ) {
526+ this . hideComposite ( viewContainer . id ) ;
528527 }
529528 }
530529
@@ -559,17 +558,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
559558 }
560559 }
561560
562- private enableCompositeActions ( viewlet : ViewletDescriptor ) : void {
563- const { activityAction, pinnedAction } = this . getCompositeActions ( viewlet . id ) ;
564- if ( activityAction instanceof PlaceHolderViewletActivityAction ) {
565- activityAction . setActivity ( viewlet ) ;
566- }
567-
568- if ( pinnedAction instanceof PlaceHolderToggleCompositePinnedAction ) {
569- pinnedAction . setActivity ( viewlet ) ;
570- }
571- }
572-
573561 getPinnedViewletIds ( ) : string [ ] {
574562 const pinnedCompositeIds = this . compositeBar . getPinnedComposites ( ) . map ( v => v . id ) ;
575563
0 commit comments