activitybarPart.ts 17.8 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

B
Benjamin Pasero 已提交
6
import 'vs/css!./media/activitybarpart';
7
import * as nls from 'vs/nls';
J
Johannes Rieken 已提交
8
import { illegalArgument } from 'vs/base/common/errors';
9
import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
B
Benjamin Pasero 已提交
10
import { GlobalActivityExtensions, IGlobalActivityRegistry } from 'vs/workbench/common/activity';
11
import { Registry } from 'vs/platform/registry/common/platform';
J
Johannes Rieken 已提交
12
import { Part } from 'vs/workbench/browser/part';
13
import { GlobalActivityActionItem, GlobalActivityAction, ViewletActivityAction, ToggleViewletAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewletActivityAction } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
B
Benjamin Pasero 已提交
14
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
I
isidor 已提交
15
import { IBadge } from 'vs/workbench/services/activity/common/activity';
I
isidor 已提交
16
import { IPartService, Parts, Position as SideBarPosition } from 'vs/workbench/services/part/common/partService';
J
Johannes Rieken 已提交
17
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
18
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
19
import { ToggleActivityBarVisibilityAction } from 'vs/workbench/browser/actions/toggleActivityBarVisibility';
20
import { IThemeService, registerThemingParticipant, ITheme } from 'vs/platform/theme/common/themeService';
21
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
22
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
23
import { CompositeBar } from 'vs/workbench/browser/parts/compositeBar';
24 25
import { isMacintosh } from 'vs/base/common/platform';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
B
Benjamin Pasero 已提交
26
import { scheduleAtNextAnimationFrame, Dimension, addClass } from 'vs/base/browser/dom';
27
import { Color } from 'vs/base/common/color';
B
Benjamin Pasero 已提交
28
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
29
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
30
import { URI } from 'vs/base/common/uri';
31
import { ToggleCompositePinnedAction, ICompositeBarColors } from 'vs/workbench/browser/parts/compositeBarActions';
32
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
S
Sandeep Somavarapu 已提交
33
import { IViewsService, IViewContainersRegistry, Extensions as ViewContainerExtensions, ViewContainer, TEST_VIEW_CONTAINER_ID, IViewDescriptorCollection } from 'vs/workbench/common/views';
S
Sandeep Somavarapu 已提交
34
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
S
Sandeep Somavarapu 已提交
35
import { IViewlet } from 'vs/workbench/common/viewlet';
36

S
Sandeep Somavarapu 已提交
37 38 39
const SCM_VIEWLET_ID = 'workbench.view.scm';

interface ICachedViewlet {
40
	id: string;
41
	iconUrl: URI;
S
Sandeep Somavarapu 已提交
42
	views?: { when: string }[];
S
Sandeep Somavarapu 已提交
43 44
}

I
isidor 已提交
45
export class ActivitybarPart extends Part {
46

B
Benjamin Pasero 已提交
47
	private static readonly ACTION_HEIGHT = 50;
48
	private static readonly PINNED_VIEWLETS = 'workbench.activity.pinnedViewlets';
S
Sandeep Somavarapu 已提交
49
	private static readonly CACHED_VIEWLETS = 'workbench.activity.placeholderViewlets';
P
Pine Wu 已提交
50

51 52
	private dimension: Dimension;

53
	private globalActionBar: ActionBar;
B
Benjamin Pasero 已提交
54
	private globalActivityIdToActions: { [globalActivityId: string]: GlobalActivityAction; } = Object.create(null);
55

S
Sandeep Somavarapu 已提交
56
	private cachedViewlets: ICachedViewlet[] = [];
57
	private compositeBar: CompositeBar;
B
Benjamin Pasero 已提交
58
	private compositeActions: { [compositeId: string]: { activityAction: ViewletActivityAction, pinnedAction: ToggleCompositePinnedAction } } = Object.create(null);
59

E
Erich Gamma 已提交
60
	constructor(
61 62
		id: string,
		@IViewletService private viewletService: IViewletService,
I
isidor 已提交
63
		@IInstantiationService private instantiationService: IInstantiationService,
B
Benjamin Pasero 已提交
64
		@IPartService private partService: IPartService,
65
		@IThemeService themeService: IThemeService,
66
		@ILifecycleService private lifecycleService: ILifecycleService,
67
		@IStorageService private storageService: IStorageService,
S
Sandeep Somavarapu 已提交
68 69
		@IExtensionService private extensionService: IExtensionService,
		@IViewsService private viewsService: IViewsService,
S
Sandeep Somavarapu 已提交
70
		@IContextKeyService private contextKeyService: IContextKeyService
E
Erich Gamma 已提交
71
	) {
72
		super(id, { hasTitle: false }, themeService, storageService);
E
Erich Gamma 已提交
73

B
Benjamin Pasero 已提交
74
		this.compositeBar = this._register(this.instantiationService.createInstance(CompositeBar, {
I
isidor 已提交
75
			icon: true,
76 77
			storageId: ActivitybarPart.PINNED_VIEWLETS,
			orientation: ActionsOrientation.VERTICAL,
78
			openComposite: (compositeId: string) => this.viewletService.openViewlet(compositeId, true),
79 80
			getActivityAction: (compositeId: string) => this.getCompositeActions(compositeId).activityAction,
			getCompositePinnedAction: (compositeId: string) => this.getCompositeActions(compositeId).pinnedAction,
81
			getOnCompositeClickAction: (compositeId: string) => this.instantiationService.createInstance(ToggleViewletAction, this.viewletService.getViewlet(compositeId)),
82
			getContextMenuActions: () => [this.instantiationService.createInstance(ToggleActivityBarVisibilityAction, ToggleActivityBarVisibilityAction.ID, nls.localize('hideActivitBar', "Hide Activity Bar"))],
83
			getDefaultCompositeId: () => this.viewletService.getDefaultViewletId(),
I
isidor 已提交
84
			hidePart: () => this.partService.setSideBarHidden(true),
85
			compositeSize: 50,
86
			colors: theme => this.getActivitybarItemColors(theme),
I
isidor 已提交
87
			overflowActionSize: ActivitybarPart.ACTION_HEIGHT
B
Benjamin Pasero 已提交
88 89
		}));

S
Sandeep Somavarapu 已提交
90 91 92 93 94
		const previousState = this.storageService.get(ActivitybarPart.CACHED_VIEWLETS, StorageScope.GLOBAL, '[]');
		this.cachedViewlets = (<ICachedViewlet[]>JSON.parse(previousState)).map(({ id, iconUrl, views }) => ({ id, views, iconUrl: typeof iconUrl === 'object' ? URI.revive(iconUrl) : void 0 }));
		for (const cachedViewlet of this.cachedViewlets) {
			if (this.shouldBeHidden(cachedViewlet.id, cachedViewlet)) {
				this.compositeBar.hideComposite(cachedViewlet.id);
S
Sandeep Somavarapu 已提交
95
			}
S
Sandeep Somavarapu 已提交
96
		}
97

E
Erich Gamma 已提交
98
		this.registerListeners();
S
Sandeep Somavarapu 已提交
99
		this.onDidRegisterViewlets(viewletService.getAllViewlets());
E
Erich Gamma 已提交
100 101 102
	}

	private registerListeners(): void {
S
Sandeep Somavarapu 已提交
103
		this._register(this.viewletService.onDidViewletRegister(viewlet => this.onDidRegisterViewlets([viewlet])));
104

E
Erich Gamma 已提交
105
		// Activate viewlet action on opening of a viewlet
S
Sandeep Somavarapu 已提交
106
		this._register(this.viewletService.onDidViewletOpen(viewlet => this.onDidViewletOpen(viewlet)));
E
Erich Gamma 已提交
107 108

		// Deactivate viewlet action on close
B
Benjamin Pasero 已提交
109 110
		this._register(this.viewletService.onDidViewletClose(viewlet => this.compositeBar.deactivateComposite(viewlet.getId())));
		this._register(this.viewletService.onDidViewletEnablementChange(({ id, enabled }) => {
111
			if (enabled) {
S
Sandeep Somavarapu 已提交
112
				this.compositeBar.addComposite(this.viewletService.getViewlet(id));
113
			} else {
S
Sandeep Somavarapu 已提交
114
				this.removeComposite(id, true);
115 116
			}
		}));
B
Benjamin Pasero 已提交
117 118

		this._register(this.extensionService.onDidRegisterExtensions(() => this.onDidRegisterExtensions()));
E
Erich Gamma 已提交
119 120
	}

B
Benjamin Pasero 已提交
121
	private onDidRegisterExtensions(): void {
S
Sandeep Somavarapu 已提交
122
		this.removeNotExistingComposites();
S
Sandeep Somavarapu 已提交
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
		for (const viewlet of this.viewletService.getAllViewlets()) {
			this.enableCompositeActions(viewlet);
			const viewContainer = this.getViewContainer(viewlet.id);
			if (viewContainer) {
				const viewDescriptors = this.viewsService.getViewDescriptors(viewContainer);
				this.onDidChangeActiveViews(viewlet, viewDescriptors);
				viewDescriptors.onDidChangeActiveViews(() => this.onDidChangeActiveViews(viewlet, viewDescriptors));
			}
		}
	}

	private onDidChangeActiveViews(viewlet: ViewletDescriptor, viewDescriptors: IViewDescriptorCollection): void {
		if (viewDescriptors.activeViewDescriptors.length) {
			this.compositeBar.addComposite(viewlet);
		} else {
			this.removeComposite(viewlet.id, true);
		}
	}

	private onDidViewletOpen(viewlet: IViewlet): void {
S
Sandeep Somavarapu 已提交
143
		// Update the composite bar by adding
S
Sandeep Somavarapu 已提交
144 145
		this.compositeBar.addComposite(this.viewletService.getViewlet(viewlet.getId()));
		this.compositeBar.activateComposite(viewlet.getId());
S
Sandeep Somavarapu 已提交
146 147 148 149 150 151
		const viewletDescriptor = this.viewletService.getViewlet(viewlet.getId());
		const viewContainer = this.getViewContainer(viewletDescriptor.id);
		if (viewContainer && this.viewsService.getViewDescriptors(viewContainer).activeViewDescriptors.length === 0) {
			// Update the composite bar by hiding
			this.removeComposite(viewletDescriptor.id, true);
		}
E
Erich Gamma 已提交
152 153
	}

B
Benjamin Pasero 已提交
154
	showActivity(viewletOrActionId: string, badge: IBadge, clazz?: string, priority?: number): IDisposable {
B
Benjamin Pasero 已提交
155
		if (this.viewletService.getViewlet(viewletOrActionId)) {
J
Joao Moreno 已提交
156
			return this.compositeBar.showActivity(viewletOrActionId, badge, clazz, priority);
B
Benjamin Pasero 已提交
157 158
		}

159
		return this.showGlobalActivity(viewletOrActionId, badge, clazz);
B
Benjamin Pasero 已提交
160 161
	}

162
	private showGlobalActivity(globalActivityId: string, badge: IBadge, clazz?: string): IDisposable {
J
Joao Moreno 已提交
163 164 165 166 167 168 169 170 171
		if (!badge) {
			throw illegalArgument('badge');
		}

		const action = this.globalActivityIdToActions[globalActivityId];
		if (!action) {
			throw illegalArgument('globalActivityId');
		}

172
		action.setBadge(badge, clazz);
B
Benjamin Pasero 已提交
173

J
Joao Moreno 已提交
174 175 176
		return toDisposable(() => action.setBadge(undefined));
	}

B
Benjamin Pasero 已提交
177
	createContentArea(parent: HTMLElement): HTMLElement {
B
Benjamin Pasero 已提交
178 179 180
		const content = document.createElement('div');
		addClass(content, 'content');
		parent.appendChild(content);
E
Erich Gamma 已提交
181 182

		// Top Actionbar with action items for each viewlet action
B
Benjamin Pasero 已提交
183
		this.compositeBar.create(content);
E
Erich Gamma 已提交
184

185
		// Top Actionbar with action items for each viewlet action
B
Benjamin Pasero 已提交
186 187 188 189 190
		const globalActivities = document.createElement('div');
		addClass(globalActivities, 'global-activity');
		content.appendChild(globalActivities);

		this.createGlobalActivityActionBar(globalActivities);
191

192 193 194 195 196 197
		// TODO@Ben: workaround for https://github.com/Microsoft/vscode/issues/45700
		// It looks like there are rendering glitches on macOS with Chrome 61 when
		// using --webkit-mask with a background color that is different from the image
		// The workaround is to promote the element onto its own drawing layer. We do
		// this only after the workbench has loaded because otherwise there is ugly flicker.
		if (isMacintosh) {
198
			this.lifecycleService.when(LifecyclePhase.Restored).then(() => {
199 200 201 202 203 204 205 206 207 208 209 210 211 212
				scheduleAtNextAnimationFrame(() => { // another delay...
					scheduleAtNextAnimationFrame(() => { // ...to prevent more flickering on startup
						registerThemingParticipant((theme, collector) => {
							const activityBarForeground = theme.getColor(ACTIVITY_BAR_FOREGROUND);
							if (activityBarForeground && !activityBarForeground.equals(Color.white)) {
								// only apply this workaround if the color is different from the image one (white)
								collector.addRule('.monaco-workbench .activitybar > .content .monaco-action-bar .action-label { will-change: transform; }');
							}
						});
					});
				});
			});
		}

B
Benjamin Pasero 已提交
213
		return content;
E
Erich Gamma 已提交
214 215
	}

B
Benjamin Pasero 已提交
216
	updateStyles(): void {
217 218 219
		super.updateStyles();

		// Part container
B
Benjamin Pasero 已提交
220
		const container = this.getContainer();
221
		const background = this.getColor(ACTIVITY_BAR_BACKGROUND);
B
Benjamin Pasero 已提交
222
		container.style.backgroundColor = background;
223

224
		const borderColor = this.getColor(ACTIVITY_BAR_BORDER) || this.getColor(contrastBorder);
225
		const isPositionLeft = this.partService.getSideBarPosition() === SideBarPosition.LEFT;
B
Benjamin Pasero 已提交
226 227 228 229 230 231 232
		container.style.boxSizing = borderColor && isPositionLeft ? 'border-box' : null;
		container.style.borderRightWidth = borderColor && isPositionLeft ? '1px' : null;
		container.style.borderRightStyle = borderColor && isPositionLeft ? 'solid' : null;
		container.style.borderRightColor = isPositionLeft ? borderColor : null;
		container.style.borderLeftWidth = borderColor && !isPositionLeft ? '1px' : null;
		container.style.borderLeftStyle = borderColor && !isPositionLeft ? 'solid' : null;
		container.style.borderLeftColor = !isPositionLeft ? borderColor : null;
233 234
	}

235 236
	private getActivitybarItemColors(theme: ITheme): ICompositeBarColors {
		return <ICompositeBarColors>{
237
			activeForegroundColor: theme.getColor(ACTIVITY_BAR_FOREGROUND),
238
			inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_INACTIVE_FOREGROUND),
239 240
			badgeBackground: theme.getColor(ACTIVITY_BAR_BADGE_BACKGROUND),
			badgeForeground: theme.getColor(ACTIVITY_BAR_BADGE_FOREGROUND),
241
			dragAndDropBackground: theme.getColor(ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND),
S
Sandeep Somavarapu 已提交
242
			activeBackgroundColor: null, inactiveBackgroundColor: null, activeBorderBottomColor: null,
243 244 245
		};
	}

J
Joao Moreno 已提交
246
	private createGlobalActivityActionBar(container: HTMLElement): void {
J
Joao Moreno 已提交
247
		const activityRegistry = Registry.as<IGlobalActivityRegistry>(GlobalActivityExtensions);
248 249 250 251 252
		const descriptors = activityRegistry.getActivities();
		const actions = descriptors
			.map(d => this.instantiationService.createInstance(d))
			.map(a => new GlobalActivityAction(a));

B
Benjamin Pasero 已提交
253
		this.globalActionBar = this._register(new ActionBar(container, {
254
			actionItemProvider: a => this.instantiationService.createInstance(GlobalActivityActionItem, a, theme => this.getActivitybarItemColors(theme)),
255 256 257
			orientation: ActionsOrientation.VERTICAL,
			ariaLabel: nls.localize('globalActions', "Global Actions"),
			animated: false
B
Benjamin Pasero 已提交
258
		}));
259

J
Joao Moreno 已提交
260 261
		actions.forEach(a => {
			this.globalActivityIdToActions[a.id] = a;
262
			this.globalActionBar.push(a);
J
Joao Moreno 已提交
263
		});
264 265
	}

266 267 268
	private getCompositeActions(compositeId: string): { activityAction: ViewletActivityAction, pinnedAction: ToggleCompositePinnedAction } {
		let compositeActions = this.compositeActions[compositeId];
		if (!compositeActions) {
269 270 271 272 273 274 275
			const viewlet = this.viewletService.getViewlet(compositeId);
			if (viewlet) {
				compositeActions = {
					activityAction: this.instantiationService.createInstance(ViewletActivityAction, viewlet),
					pinnedAction: new ToggleCompositePinnedAction(viewlet, this.compositeBar)
				};
			} else {
S
Sandeep Somavarapu 已提交
276
				const cachedComposite = this.cachedViewlets.filter(c => c.id === compositeId)[0];
277
				compositeActions = {
S
Sandeep Somavarapu 已提交
278
					activityAction: this.instantiationService.createInstance(PlaceHolderViewletActivityAction, compositeId, cachedComposite && cachedComposite.iconUrl),
279
					pinnedAction: new PlaceHolderToggleCompositePinnedAction(compositeId, this.compositeBar)
280 281
				};
			}
B
Benjamin Pasero 已提交
282

283 284
			this.compositeActions[compositeId] = compositeActions;
		}
B
Benjamin Pasero 已提交
285

286 287 288
		return compositeActions;
	}

S
Sandeep Somavarapu 已提交
289
	private onDidRegisterViewlets(viewlets: ViewletDescriptor[]): void {
290
		for (const viewlet of viewlets) {
S
Sandeep Somavarapu 已提交
291 292 293
			const cachedViewlet = this.cachedViewlets.filter(({ id }) => id === viewlet.id)[0];
			const activeViewlet = this.viewletService.getActiveViewlet();
			const isActive = activeViewlet && activeViewlet.getId() === viewlet.id;
S
Sandeep Somavarapu 已提交
294

S
Sandeep Somavarapu 已提交
295 296
			if (isActive || !this.shouldBeHidden(viewlet.id, cachedViewlet)) {
				this.compositeBar.addComposite(viewlet);
S
Sandeep Somavarapu 已提交
297

S
Sandeep Somavarapu 已提交
298 299 300 301 302 303 304 305
				// Pin it by default if it is new
				if (!cachedViewlet) {
					this.compositeBar.pin(viewlet.id);
				}

				if (isActive) {
					this.compositeBar.activateComposite(viewlet.id);
				}
306 307 308 309
			}
		}
	}

S
Sandeep Somavarapu 已提交
310 311 312 313 314 315
	private shouldBeHidden(viewletId: string, cachedViewlet: ICachedViewlet): boolean {
		return cachedViewlet && cachedViewlet.views && cachedViewlet.views.length
			? cachedViewlet.views.every(({ when }) => when && !this.contextKeyService.contextMatchesRules(ContextKeyExpr.deserialize(when)))
			: viewletId === TEST_VIEW_CONTAINER_ID /* Hide Test viewlet for the first time or it had no views registered before */;
	}

S
Sandeep Somavarapu 已提交
316 317
	private removeNotExistingComposites(): void {
		const viewlets = this.viewletService.getAllViewlets();
318
		for (const { id } of this.compositeBar.getComposites()) {
319
			if (viewlets.every(viewlet => viewlet.id !== id)) {
S
Sandeep Somavarapu 已提交
320
				this.removeComposite(id, false);
321 322 323 324
			}
		}
	}

S
Sandeep Somavarapu 已提交
325 326 327 328 329 330
	private removeComposite(compositeId: string, hide: boolean): void {
		if (hide) {
			this.compositeBar.hideComposite(compositeId);
		} else {
			this.compositeBar.removeComposite(compositeId);
		}
331 332 333 334 335 336 337 338
		const compositeActions = this.compositeActions[compositeId];
		if (compositeActions) {
			compositeActions.activityAction.dispose();
			compositeActions.pinnedAction.dispose();
			delete this.compositeActions[compositeId];
		}
	}

339 340
	private enableCompositeActions(viewlet: ViewletDescriptor): void {
		const { activityAction, pinnedAction } = this.getCompositeActions(viewlet.id);
341
		if (activityAction instanceof PlaceHolderViewletActivityAction) {
S
Sandeep Somavarapu 已提交
342
			activityAction.setActivity(viewlet);
343
		}
344
		if (pinnedAction instanceof PlaceHolderToggleCompositePinnedAction) {
S
Sandeep Somavarapu 已提交
345
			pinnedAction.setActivity(viewlet);
346 347 348
		}
	}

P
Pine Wu 已提交
349 350 351 352 353 354
	getPinnedViewletIds(): string[] {
		const pinnedCompositeIds = this.compositeBar.getPinnedComposites().map(v => v.id);
		return this.viewletService.getViewlets()
			.filter(v => this.compositeBar.isPinned(v.id))
			.sort((v1, v2) => pinnedCompositeIds.indexOf(v1.id) - pinnedCompositeIds.indexOf(v2.id))
			.map(v => v.id);
355 356
	}

B
Benjamin Pasero 已提交
357
	layout(dimension: Dimension): Dimension[] {
I
isidor 已提交
358 359 360
		if (!this.partService.isVisible(Parts.ACTIVITYBAR_PART)) {
			return [dimension];
		}
361 362 363 364 365 366

		// Pass to super
		const sizes = super.layout(dimension);

		this.dimension = sizes[1];

367 368 369
		let availableHeight = this.dimension.height;
		if (this.globalActionBar) {
			// adjust height for global actions showing
I
isidor 已提交
370
			availableHeight -= (this.globalActionBar.items.length * ActivitybarPart.ACTION_HEIGHT);
371 372
		}
		this.compositeBar.layout(new Dimension(dimension.width, availableHeight));
373 374 375

		return sizes;
	}
B
Benjamin Pasero 已提交
376 377

	protected saveState(): void {
S
Sandeep Somavarapu 已提交
378
		const state: ICachedViewlet[] = [];
S
Sandeep Somavarapu 已提交
379
		for (const { id, iconUrl } of this.viewletService.getAllViewlets()) {
S
Sandeep Somavarapu 已提交
380 381
			const viewContainer = this.getViewContainer(id);
			const views: { when: string }[] = [];
382 383
			if (viewContainer) {
				for (const { when } of this.viewsService.getViewDescriptors(viewContainer).allViewDescriptors) {
S
Sandeep Somavarapu 已提交
384
					views.push({ when: when ? when.serialize() : void 0 });
S
Sandeep Somavarapu 已提交
385 386
				}
			}
S
Sandeep Somavarapu 已提交
387
			state.push({ id, iconUrl, views });
S
Sandeep Somavarapu 已提交
388
		}
S
Sandeep Somavarapu 已提交
389
		this.storageService.store(ActivitybarPart.CACHED_VIEWLETS, JSON.stringify(state), StorageScope.GLOBAL);
B
Benjamin Pasero 已提交
390 391 392

		super.saveState();
	}
S
Sandeep Somavarapu 已提交
393 394 395 396 397 398 399 400 401

	private getViewContainer(viewletId: string): ViewContainer | undefined {
		// TODO: @Joao Remove this after moving SCM Viewlet to ViewContainerViewlet - https://github.com/Microsoft/vscode/issues/49054
		if (viewletId === SCM_VIEWLET_ID) {
			return null;
		}
		const viewContainerRegistry = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry);
		return viewContainerRegistry.get(viewletId);
	}
402
}