src/vs/workbench/services/views/common/viewContainerModel.ts/ViewContainerModel/onDidChangeContext
class ViewContainerModel:	private onDidChangeContext(): void {
		const addedActiveItems: { item: IViewDescriptorItem, wasVisible: boolean }[] = [];
		const removedActiveItems: { item: IViewDescriptorItem, wasVisible: boolean }[] = [];
		const removedVisibleItems: { index: number, viewDescriptor: IViewDescriptor; }[] = [];
		const addedVisibleItems: { index: number, viewDescriptor: IViewDescriptor, size?: number, collapsed: boolean; }[] = [];

		for (const item of this.viewDescriptorItems) {
			const wasActive = item.state.active;
			const wasVisible = this.isViewDescriptorVisible(item);
			const isActive = this.contextKeyService.contextMatchesRules(item.viewDescriptor.when);
			if (wasActive !== isActive) {
				if (isActive) {
					addedActiveItems.push({ item, wasVisible });
				} else {
					removedActiveItems.push({ item, wasVisible });
				}
			}
		}

		for (const { item, wasVisible } of removedActiveItems) {
			if (wasVisible) {
				const { visibleIndex } = this.find(item.viewDescriptor.id);
				removedVisibleItems.push({ index: visibleIndex, viewDescriptor: item.viewDescriptor });
			}
		}

		// Update the State
		removedActiveItems.forEach(({ item }) => item.state.active = false);
		addedActiveItems.forEach(({ item }) => item.state.active = true);

		for (const { item, wasVisible } of addedActiveItems) {
			if (wasVisible !== this.isViewDescriptorVisibleWhenActive(item)) {
				const { visibleIndex } = this.find(item.viewDescriptor.id);
				addedVisibleItems.push({ index: visibleIndex, viewDescriptor: item.viewDescriptor, size: item.state.size, collapsed: !!item.state.collapsed });
			}
		}

		if (addedActiveItems.length || removedActiveItems.length) {
			this._onDidChangeActiveViewDescriptors.fire(({ added: addedActiveItems.map(({ item }) => item.viewDescriptor), removed: removedActiveItems.map(({ item }) => item.viewDescriptor) }));
		}
		if (removedVisibleItems.length) {
			this._onDidRemoveVisibleViewDescriptors.fire(removedVisibleItems);
		}
		if (addedVisibleItems.length) {
			this.triggerOnDidAddVisibleViewDescriptors(addedVisibleItems);
		}
	}