@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
8
8
import { ActionsOrientation , ActionBar } from 'vs/base/browser/ui/actionbar/actionbar' ;
9
9
import { GLOBAL_ACTIVITY_ID , IActivity , ACCOUNTS_ACTIVITY_ID } from 'vs/workbench/common/activity' ;
10
10
import { Part } from 'vs/workbench/browser/part' ;
11
- import { GlobalActivityActionViewItem , ViewContainerActivityAction , PlaceHolderToggleCompositePinnedAction , PlaceHolderViewContainerActivityAction , AccountsActivityActionViewItem , ProfilesActivityActionViewItem , IProfileActivity } from 'vs/workbench/browser/parts/activitybar/activitybarActions' ;
11
+ import { GlobalActivityActionViewItem , ViewContainerActivityAction , PlaceHolderToggleCompositePinnedAction , PlaceHolderViewContainerActivityAction , AccountsActivityActionViewItem , ProfilesActivityActionViewItem , IProfileActivity , PlaceHolderToggleCompositeBadgeAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions' ;
12
12
import { IBadge , NumberBadge } from 'vs/workbench/services/activity/common/activity' ;
13
13
import { IWorkbenchLayoutService , Parts , Position } from 'vs/workbench/services/layout/browser/layoutService' ;
14
14
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
@@ -23,7 +23,7 @@ import { Dimension, createCSSRule, asCSSUrl, addDisposableListener, EventType, i
23
23
import { IStorageService , StorageScope , IStorageValueChangeEvent , StorageTarget } from 'vs/platform/storage/common/storage' ;
24
24
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
25
25
import { URI , UriComponents } from 'vs/base/common/uri' ;
26
- import { ToggleCompositePinnedAction , ICompositeBarColors , ActivityAction , ICompositeActivity , IActivityHoverOptions } from 'vs/workbench/browser/parts/compositeBarActions' ;
26
+ import { ToggleCompositePinnedAction , ICompositeBarColors , ActivityAction , ICompositeActivity , IActivityHoverOptions , ToggleCompositeBadgeAction } from 'vs/workbench/browser/parts/compositeBarActions' ;
27
27
import { IViewDescriptorService , ViewContainer , IViewContainerModel , ViewContainerLocation } from 'vs/workbench/common/views' ;
28
28
import { getEnabledViewContainerContextKey } from 'vs/workbench/common/contextkeys' ;
29
29
import { IContextKeyService , ContextKeyExpr , IContextKey } from 'vs/platform/contextkey/common/contextkey' ;
@@ -58,6 +58,7 @@ interface IPlaceholderViewContainer {
58
58
interface IPinnedViewContainer {
59
59
readonly id : string ;
60
60
readonly pinned : boolean ;
61
+ readonly badgeEnabled : boolean ;
61
62
readonly order ?: number ;
62
63
readonly visible : boolean ;
63
64
}
@@ -67,6 +68,7 @@ interface ICachedViewContainer {
67
68
name ?: string ;
68
69
icon ?: URI | ThemeIcon ;
69
70
readonly pinned : boolean ;
71
+ readonly badgeEnabled : boolean ;
70
72
readonly order ?: number ;
71
73
visible : boolean ;
72
74
isBuiltin ?: boolean ;
@@ -112,7 +114,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
112
114
113
115
private readonly accountsActivity : ICompositeActivity [ ] = [ ] ;
114
116
115
- private readonly compositeActions = new Map < string , { activityAction : ViewContainerActivityAction ; pinnedAction : ToggleCompositePinnedAction } > ( ) ;
117
+ private readonly compositeActions = new Map < string , { activityAction : ViewContainerActivityAction ; pinnedAction : ToggleCompositePinnedAction ; badgeAction : ToggleCompositeBadgeAction } > ( ) ;
116
118
private readonly viewContainerDisposables = new Map < string , IDisposable > ( ) ;
117
119
118
120
private readonly keyboardNavigationDisposables = this . _register ( new DisposableStore ( ) ) ;
@@ -156,7 +158,8 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
156
158
name : container . name ,
157
159
visible : container . visible ,
158
160
order : container . order ,
159
- pinned : container . pinned
161
+ badgeEnabled : container . badgeEnabled ,
162
+ pinned : container . pinned ,
160
163
} ) ) ;
161
164
162
165
return this . _register ( this . instantiationService . createInstance ( CompositeBar , cachedItems , {
@@ -169,6 +172,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
169
172
} ,
170
173
getActivityAction : compositeId => this . getCompositeActions ( compositeId ) . activityAction ,
171
174
getCompositePinnedAction : compositeId => this . getCompositeActions ( compositeId ) . pinnedAction ,
175
+ getCompositeBadgeAction : compositeId => this . getCompositeActions ( compositeId ) . badgeAction ,
172
176
getOnCompositeClickAction : compositeId => toAction ( { id : compositeId , label : '' , run : async ( ) => this . paneCompositePart . getActivePaneComposite ( ) ?. getId ( ) === compositeId ? this . paneCompositePart . hideActivePaneComposite ( ) : this . paneCompositePart . openPaneComposite ( compositeId ) } ) ,
173
177
fillExtraContextMenuActions : ( actions , e ?: MouseEvent | GestureEvent ) => {
174
178
// Menu
@@ -623,21 +627,23 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
623
627
} ;
624
628
}
625
629
626
- private getCompositeActions ( compositeId : string ) : { activityAction : ViewContainerActivityAction ; pinnedAction : ToggleCompositePinnedAction } {
630
+ private getCompositeActions ( compositeId : string ) : { activityAction : ViewContainerActivityAction ; pinnedAction : ToggleCompositePinnedAction ; badgeAction : ToggleCompositeBadgeAction } {
627
631
let compositeActions = this . compositeActions . get ( compositeId ) ;
628
632
if ( ! compositeActions ) {
629
633
const viewContainer = this . getViewContainer ( compositeId ) ;
630
634
if ( viewContainer ) {
631
635
const viewContainerModel = this . viewDescriptorService . getViewContainerModel ( viewContainer ) ;
632
636
compositeActions = {
633
637
activityAction : this . instantiationService . createInstance ( ViewContainerActivityAction , this . toActivity ( viewContainerModel ) , this . paneCompositePart ) ,
634
- pinnedAction : new ToggleCompositePinnedAction ( this . toActivity ( viewContainerModel ) , this . compositeBar )
638
+ pinnedAction : new ToggleCompositePinnedAction ( this . toActivity ( viewContainerModel ) , this . compositeBar ) ,
639
+ badgeAction : new ToggleCompositeBadgeAction ( this . toActivity ( viewContainerModel ) , this . compositeBar )
635
640
} ;
636
641
} else {
637
642
const cachedComposite = this . cachedViewContainers . filter ( c => c . id === compositeId ) [ 0 ] ;
638
643
compositeActions = {
639
644
activityAction : this . instantiationService . createInstance ( PlaceHolderViewContainerActivityAction , ActivitybarPart . toActivity ( compositeId , compositeId , cachedComposite ?. icon , undefined ) , this . paneCompositePart ) ,
640
- pinnedAction : new PlaceHolderToggleCompositePinnedAction ( compositeId , this . compositeBar )
645
+ pinnedAction : new PlaceHolderToggleCompositePinnedAction ( compositeId , this . compositeBar ) ,
646
+ badgeAction : new PlaceHolderToggleCompositeBadgeAction ( compositeId , this . compositeBar )
641
647
} ;
642
648
}
643
649
@@ -887,6 +893,7 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
887
893
id : cachedViewContainer . id ,
888
894
name : cachedViewContainer . name ,
889
895
order : cachedViewContainer . order ,
896
+ badgeEnabled : cachedViewContainer . badgeEnabled ,
890
897
pinned : cachedViewContainer . pinned ,
891
898
visible : ! ! compositeItems . find ( ( { id } ) => id === cachedViewContainer . id )
892
899
} ) ;
@@ -934,12 +941,13 @@ export class ActivitybarPart extends Part implements IPaneCompositeSelectorPart
934
941
icon : URI . isUri ( viewContainerModel . icon ) && this . environmentService . remoteAuthority ? undefined : viewContainerModel . icon , /* Donot cache uri icons with remote connection */
935
942
views,
936
943
pinned : compositeItem . pinned ,
944
+ badgeEnabled : compositeItem . badgeEnabled ,
937
945
order : compositeItem . order ,
938
946
visible : compositeItem . visible ,
939
947
isBuiltin : ! viewContainer . extensionId
940
948
} ) ;
941
949
} else {
942
- state . push ( { id : compositeItem . id , pinned : compositeItem . pinned , order : compositeItem . order , visible : false , isBuiltin : false } ) ;
950
+ state . push ( { id : compositeItem . id , pinned : compositeItem . pinned , badgeEnabled : compositeItem . badgeEnabled , order : compositeItem . order , visible : false , isBuiltin : false } ) ;
943
951
}
944
952
}
945
953
0 commit comments