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

'use strict';

B
Benjamin Pasero 已提交
8
import 'vs/css!./media/activitybarpart';
9
import nls = require('vs/nls');
10 11 12
import { TPromise } from 'vs/base/common/winjs.base';
import DOM = require('vs/base/browser/dom');
import * as arrays from 'vs/base/common/arrays';
J
Johannes Rieken 已提交
13
import { illegalArgument } from 'vs/base/common/errors';
14
import { Builder, $, Dimension } from 'vs/base/browser/builder';
J
Johannes Rieken 已提交
15
import { Action } from 'vs/base/common/actions';
16
import { ActionsOrientation, ActionBar, IActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
17
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
J
Johannes Rieken 已提交
18
import { Part } from 'vs/workbench/browser/part';
19 20
import { IViewlet } from 'vs/workbench/common/viewlet';
import { ToggleViewletPinnedAction, ViewletActivityAction, ActivityAction, ActivityActionItem, ViewletOverflowActivityAction, ViewletOverflowActivityActionItem } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
B
Benjamin Pasero 已提交
21
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
22
import { IActivityBarService, IBadge } from 'vs/workbench/services/activity/common/activityBarService';
23
import { IPartService, Position as SideBarPosition } from 'vs/workbench/services/part/common/partService';
J
Johannes Rieken 已提交
24
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
25
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
26 27 28 29
import { IStorageService } from 'vs/platform/storage/common/storage';
import { Scope as MementoScope } from 'vs/workbench/common/memento';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
30
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
31
import { ToggleActivityBarVisibilityAction } from 'vs/workbench/browser/actions/toggleActivityBarVisibility';
32
import SCMPreview from 'vs/workbench/parts/scm/browser/scmPreview';
33
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
34
import { ACTIVITY_BAR_BACKGROUND } from 'vs/workbench/common/theme';
35
import { highContrastBorder, highContrastOutline, focus } from 'vs/platform/theme/common/colorRegistry';
E
Erich Gamma 已提交
36

37 38 39 40 41
interface IViewletActivity {
	badge: IBadge;
	clazz: string;
}

42
export class ActivitybarPart extends Part implements IActivityBarService {
43

44
	private static readonly ACTIVITY_ACTION_HEIGHT = 50;
45
	private static readonly PINNED_VIEWLETS = 'workbench.activity.pinnedViewlets';
46

47
	public _serviceBrand: any;
P
Pine Wu 已提交
48

49 50
	private dimension: Dimension;

I
isidor 已提交
51
	private viewletSwitcherBar: ActionBar;
52 53 54
	private viewletOverflowAction: ViewletOverflowActivityAction;
	private viewletOverflowActionItem: ViewletOverflowActivityActionItem;

55
	private viewletIdToActions: { [viewletId: string]: ActivityAction; };
B
Benjamin Pasero 已提交
56
	private viewletIdToActionItems: { [viewletId: string]: IActionItem; };
57
	private viewletIdToActivityStack: { [viewletId: string]: IViewletActivity[]; };
E
Erich Gamma 已提交
58

59
	private memento: any;
60
	private pinnedViewlets: string[];
61 62
	private activeUnpinnedViewlet: ViewletDescriptor;

E
Erich Gamma 已提交
63
	constructor(
64 65
		id: string,
		@IViewletService private viewletService: IViewletService,
66
		@IExtensionService private extensionService: IExtensionService,
67 68
		@IStorageService private storageService: IStorageService,
		@IContextMenuService private contextMenuService: IContextMenuService,
I
isidor 已提交
69
		@IInstantiationService private instantiationService: IInstantiationService,
B
Benjamin Pasero 已提交
70 71
		@IPartService private partService: IPartService,
		@IThemeService themeService: IThemeService
E
Erich Gamma 已提交
72
	) {
B
Benjamin Pasero 已提交
73
		super(id, { hasTitle: false }, themeService);
E
Erich Gamma 已提交
74

B
Benjamin Pasero 已提交
75
		this.viewletIdToActionItems = Object.create(null);
76
		this.viewletIdToActions = Object.create(null);
77
		this.viewletIdToActivityStack = Object.create(null);
E
Erich Gamma 已提交
78

79
		this.memento = this.getMemento(this.storageService, MementoScope.GLOBAL);
J
Joao Moreno 已提交
80 81 82 83

		const pinnedViewlets = this.memento[ActivitybarPart.PINNED_VIEWLETS] as string[];

		if (pinnedViewlets) {
J
Joao Moreno 已提交
84
			// TODO@Ben: Migrate git => scm viewlet
85 86 87 88 89

			const map = SCMPreview.enabled
				? (id => id === 'workbench.view.git' ? 'workbench.view.scm' : id)
				: (id => id === 'workbench.view.scm' ? 'workbench.view.git' : id);

J
Joao Moreno 已提交
90
			this.pinnedViewlets = pinnedViewlets
91
				.map(map)
J
Joao Moreno 已提交
92 93 94 95 96
				.filter(arrays.uniqueFilter<string>(str => str));

		} else {
			this.pinnedViewlets = this.viewletService.getViewlets().map(v => v.id);
		}
97

98
		// Update viewlet switcher when external viewlets become ready
99
		this.extensionService.onReady().then(() => this.updateViewletSwitcher());
100

E
Erich Gamma 已提交
101 102 103 104 105 106
		this.registerListeners();
	}

	private registerListeners(): void {

		// Activate viewlet action on opening of a viewlet
107
		this.toUnbind.push(this.viewletService.onDidViewletOpen(viewlet => this.onDidViewletOpen(viewlet)));
E
Erich Gamma 已提交
108 109

		// Deactivate viewlet action on close
110
		this.toUnbind.push(this.viewletService.onDidViewletClose(viewlet => this.onDidViewletClose(viewlet)));
P
Pine Wu 已提交
111 112
	}

113 114 115 116 117 118 119 120 121 122 123
	private onDidViewletOpen(viewlet: IViewlet): void {
		const id = viewlet.getId();

		if (this.viewletIdToActions[id]) {
			this.viewletIdToActions[id].activate();
		}

		const activeUnpinnedViewletShouldClose = this.activeUnpinnedViewlet && this.activeUnpinnedViewlet.id !== viewlet.getId();
		const activeUnpinnedViewletShouldShow = !this.getPinnedViewlets().some(v => v.id === viewlet.getId());
		if (activeUnpinnedViewletShouldShow || activeUnpinnedViewletShouldClose) {
			this.updateViewletSwitcher();
E
Erich Gamma 已提交
124 125 126
		}
	}

127 128 129 130 131
	private onDidViewletClose(viewlet: IViewlet): void {
		const id = viewlet.getId();

		if (this.viewletIdToActions[id]) {
			this.viewletIdToActions[id].deactivate();
E
Erich Gamma 已提交
132 133 134
		}
	}

135
	public showActivity(viewletId: string, badge: IBadge, clazz?: string): IDisposable {
J
Johannes Rieken 已提交
136 137 138
		if (!badge) {
			throw illegalArgument('badge');
		}
139

140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
		const activity = <IViewletActivity>{ badge, clazz };
		const stack = this.viewletIdToActivityStack[viewletId] || (this.viewletIdToActivityStack[viewletId] = []);
		stack.unshift(activity);

		this.updateActivity(viewletId);

		return {
			dispose: () => {
				const stack = this.viewletIdToActivityStack[viewletId];
				if (!stack) {
					return;
				}
				const idx = stack.indexOf(activity);
				if (idx < 0) {
					return;
				}
				stack.splice(idx, 1);
				if (stack.length === 0) {
					delete this.viewletIdToActivityStack[viewletId];
				}
				this.updateActivity(viewletId);
			}
		};
	}

	private updateActivity(viewletId: string) {
166
		const action = this.viewletIdToActions[viewletId];
167 168 169 170 171 172 173 174 175 176
		if (!action) {
			return;
		}
		const stack = this.viewletIdToActivityStack[viewletId];
		if (!stack || !stack.length) {
			// reset
			action.setBadge(undefined);

		} else {
			// update
177
			const [{ badge, clazz }] = stack;
E
Erich Gamma 已提交
178 179 180 181 182 183 184 185
			action.setBadge(badge);
			if (clazz) {
				action.class = clazz;
			}
		}
	}

	public createContentArea(parent: Builder): Builder {
186 187
		const $el = $(parent);
		const $result = $('.content').appendTo($el);
E
Erich Gamma 已提交
188 189

		// Top Actionbar with action items for each viewlet action
P
Pine Wu 已提交
190
		this.createViewletSwitcher($result.clone());
E
Erich Gamma 已提交
191

192 193 194 195 196 197 198
		// Contextmenu for viewlets
		$(parent).on('contextmenu', (e: MouseEvent) => {
			DOM.EventHelper.stop(e, true);

			this.showContextMenu(e);
		}, this.toUnbind);

B
Benjamin Pasero 已提交
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
		// Allow to drop at the end to move viewlet to the end
		$(parent).on(DOM.EventType.DROP, (e: DragEvent) => {
			const draggedViewlet = ActivityActionItem.getDraggedViewlet();
			if (draggedViewlet) {
				DOM.EventHelper.stop(e, true);

				ActivityActionItem.clearDraggedViewlet();

				const targetId = this.pinnedViewlets[this.pinnedViewlets.length - 1];
				if (targetId !== draggedViewlet.id) {
					this.move(draggedViewlet.id, this.pinnedViewlets[this.pinnedViewlets.length - 1]);
				}
			}
		});

E
Erich Gamma 已提交
214 215 216
		return $result;
	}

217 218 219 220 221
	public updateStyles(): void {
		super.updateStyles();

		// Part container
		const container = this.getContainer();
222 223
		const background = this.getColor(ACTIVITY_BAR_BACKGROUND);
		container.style('background-color', background);
224

225
		const hcBorder = this.getColor(highContrastBorder);
226
		const isPositionLeft = this.partService.getSideBarPosition() === SideBarPosition.LEFT;
227 228 229 230 231 232 233
		container.style('box-sizing', hcBorder && isPositionLeft ? 'border-box' : null);
		container.style('border-right-width', hcBorder && isPositionLeft ? '1px' : null);
		container.style('border-right-style', hcBorder && isPositionLeft ? 'solid' : null);
		container.style('border-right-color', isPositionLeft ? hcBorder : null);
		container.style('border-left-width', hcBorder && !isPositionLeft ? '1px' : null);
		container.style('border-left-style', hcBorder && !isPositionLeft ? 'solid' : null);
		container.style('border-left-color', !isPositionLeft ? hcBorder : null);
234 235
	}

236 237 238 239 240 241 242 243 244 245 246 247 248 249
	private showContextMenu(e: MouseEvent): void {
		const event = new StandardMouseEvent(e);

		const actions: Action[] = this.viewletService.getViewlets().map(viewlet => this.instantiationService.createInstance(ToggleViewletPinnedAction, viewlet));
		actions.push(new Separator());
		actions.push(this.instantiationService.createInstance(ToggleActivityBarVisibilityAction, ToggleActivityBarVisibilityAction.ID, nls.localize('hideActivitBar', "Hide Activity Bar")));

		this.contextMenuService.showContextMenu({
			getAnchor: () => { return { x: event.posx + 1, y: event.posy }; },
			getActions: () => TPromise.as(actions),
			onHide: () => dispose(actions)
		});
	}

I
isidor 已提交
250 251
	private createViewletSwitcher(div: Builder): void {
		this.viewletSwitcherBar = new ActionBar(div, {
B
Benjamin Pasero 已提交
252
			actionItemProvider: (action: Action) => action instanceof ViewletOverflowActivityAction ? this.viewletOverflowActionItem : this.viewletIdToActionItems[action.id],
253
			orientation: ActionsOrientation.VERTICAL,
254 255
			ariaLabel: nls.localize('activityBarAriaLabel', "Active View Switcher"),
			animated: false
E
Erich Gamma 已提交
256 257
		});

258
		this.updateViewletSwitcher();
P
Pine Wu 已提交
259 260
	}

261
	private updateViewletSwitcher() {
262 263 264 265
		let viewletsToShow = this.getPinnedViewlets();

		// Always show the active viewlet even if it is marked to be hidden
		const activeViewlet = this.viewletService.getActiveViewlet();
B
Benjamin Pasero 已提交
266
		if (activeViewlet && !viewletsToShow.some(viewlet => viewlet.id === activeViewlet.getId())) {
267 268 269 270 271
			this.activeUnpinnedViewlet = this.viewletService.getViewlet(activeViewlet.getId());
			viewletsToShow.push(this.activeUnpinnedViewlet);
		} else {
			this.activeUnpinnedViewlet = void 0;
		}
272 273 274 275 276

		// Ensure we are not showing more viewlets than we have height for
		let overflows = false;
		if (this.dimension) {
			const maxVisible = Math.floor(this.dimension.height / ActivitybarPart.ACTIVITY_ACTION_HEIGHT);
277
			overflows = viewletsToShow.length > maxVisible;
278 279

			if (overflows) {
280
				viewletsToShow = viewletsToShow.slice(0, maxVisible - 1 /* make room for overflow action */);
281 282 283 284
			}
		}

		const visibleViewlets = Object.keys(this.viewletIdToActions);
B
Benjamin Pasero 已提交
285
		const visibleViewletsChange = !arrays.equals(viewletsToShow.map(viewlet => viewlet.id), visibleViewlets);
286 287 288 289 290 291 292 293 294 295 296

		// Pull out overflow action if there is a viewlet change so that we can add it to the end later
		if (this.viewletOverflowAction && visibleViewletsChange) {
			this.viewletSwitcherBar.pull(this.viewletSwitcherBar.length() - 1);

			this.viewletOverflowAction.dispose();
			this.viewletOverflowAction = null;

			this.viewletOverflowActionItem.dispose();
			this.viewletOverflowActionItem = null;
		}
297

298
		// Pull out viewlets that overflow or got hidden
299 300 301
		const viewletIdsToShow = viewletsToShow.map(v => v.id);
		visibleViewlets.forEach(viewletId => {
			if (viewletIdsToShow.indexOf(viewletId) === -1) {
P
Pine Wu 已提交
302 303 304 305
				this.pullViewlet(viewletId);
			}
		});

306
		// Built actions for viewlets to show
307
		const newViewletsToShow = viewletsToShow
308
			.filter(viewlet => !this.viewletIdToActions[viewlet.id])
P
Pine Wu 已提交
309 310
			.map(viewlet => this.toAction(viewlet));

311 312
		// Update when we have new viewlets to show
		if (newViewletsToShow.length) {
313

314 315 316 317 318 319 320 321 322 323
			// Add to viewlet switcher
			this.viewletSwitcherBar.push(newViewletsToShow, { label: true, icon: true });

			// Make sure to activate the active one
			const activeViewlet = this.viewletService.getActiveViewlet();
			if (activeViewlet) {
				const activeViewletEntry = this.viewletIdToActions[activeViewlet.getId()];
				if (activeViewletEntry) {
					activeViewletEntry.activate();
				}
324
			}
325 326 327

			// Make sure to restore activity
			Object.keys(this.viewletIdToActions).forEach(viewletId => {
328
				this.updateActivity(viewletId);
329 330 331 332 333
			});
		}

		// Add overflow action as needed
		if (visibleViewletsChange && overflows) {
334
			this.viewletOverflowAction = this.instantiationService.createInstance(ViewletOverflowActivityAction, () => this.viewletOverflowActionItem.showMenu());
335
			this.viewletOverflowActionItem = this.instantiationService.createInstance(ViewletOverflowActivityActionItem, this.viewletOverflowAction, () => this.getOverflowingViewlets(), (viewlet: ViewletDescriptor) => this.viewletIdToActivityStack[viewlet.id] && this.viewletIdToActivityStack[viewlet.id][0].badge);
336 337

			this.viewletSwitcherBar.push(this.viewletOverflowAction, { label: true, icon: true });
338
		}
P
Pine Wu 已提交
339 340
	}

341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
	private getOverflowingViewlets(): ViewletDescriptor[] {
		const viewlets = this.getPinnedViewlets();
		if (this.activeUnpinnedViewlet) {
			viewlets.push(this.activeUnpinnedViewlet);
		}
		const visibleViewlets = Object.keys(this.viewletIdToActions);

		return viewlets.filter(viewlet => visibleViewlets.indexOf(viewlet.id) === -1);
	}

	private getVisibleViewlets(): ViewletDescriptor[] {
		const viewlets = this.viewletService.getViewlets();
		const visibleViewlets = Object.keys(this.viewletIdToActions);

		return viewlets.filter(viewlet => visibleViewlets.indexOf(viewlet.id) >= 0);
	}

	private getPinnedViewlets(): ViewletDescriptor[] {
B
Benjamin Pasero 已提交
359
		return this.pinnedViewlets.map(viewletId => this.viewletService.getViewlet(viewletId)).filter(v => !!v); // ensure to remove those that might no longer exist
360 361
	}

P
Pine Wu 已提交
362
	private pullViewlet(viewletId: string): void {
363
		const index = Object.keys(this.viewletIdToActions).indexOf(viewletId);
B
Benjamin Pasero 已提交
364 365
		if (index >= 0) {
			this.viewletSwitcherBar.pull(index);
366

B
Benjamin Pasero 已提交
367 368 369
			const action = this.viewletIdToActions[viewletId];
			action.dispose();
			delete this.viewletIdToActions[viewletId];
370

B
Benjamin Pasero 已提交
371
			const actionItem = this.viewletIdToActionItems[action.id];
B
Benjamin Pasero 已提交
372
			actionItem.dispose();
B
Benjamin Pasero 已提交
373
			delete this.viewletIdToActionItems[action.id];
B
Benjamin Pasero 已提交
374
		}
I
isidor 已提交
375
	}
J
Joao Moreno 已提交
376

377
	private toAction(viewlet: ViewletDescriptor): ActivityAction {
378
		const action = this.instantiationService.createInstance(ViewletActivityAction, viewlet);
I
isidor 已提交
379

B
Benjamin Pasero 已提交
380
		this.viewletIdToActionItems[action.id] = this.instantiationService.createInstance(ActivityActionItem, action, viewlet);
381
		this.viewletIdToActions[viewlet.id] = action;
I
isidor 已提交
382 383

		return action;
384 385
	}

386 387 388 389
	public getPinned(): string[] {
		return this.pinnedViewlets;
	}

390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
	public unpin(viewletId: string): void {
		if (!this.isPinned(viewletId)) {
			return;
		}

		const activeViewlet = this.viewletService.getActiveViewlet();
		const defaultViewletId = this.viewletService.getDefaultViewletId();
		const visibleViewlets = this.getVisibleViewlets();

		let unpinPromise: TPromise<any>;

		// Case: viewlet is not the active one or the active one is a different one
		// Solv: we do nothing
		if (!activeViewlet || activeViewlet.getId() !== viewletId) {
			unpinPromise = TPromise.as(null);
		}

		// Case: viewlet is not the default viewlet and default viewlet is still showing
		// Solv: we open the default viewlet
		else if (defaultViewletId !== viewletId && this.isPinned(defaultViewletId)) {
			unpinPromise = this.viewletService.openViewlet(defaultViewletId, true);
		}

		// Case: we closed the last visible viewlet
		// Solv: we hide the sidebar
		else if (visibleViewlets.length === 1) {
416
			unpinPromise = this.partService.setSideBarHidden(true);
417 418 419 420 421 422 423 424 425 426
		}

		// Case: we closed the default viewlet
		// Solv: we open the next visible viewlet from top
		else {
			unpinPromise = this.viewletService.openViewlet(visibleViewlets.filter(viewlet => viewlet.id !== viewletId)[0].id, true);
		}

		unpinPromise.then(() => {

427 428 429
			// then remove from pinned and update switcher
			const index = this.pinnedViewlets.indexOf(viewletId);
			this.pinnedViewlets.splice(index, 1);
430 431 432 433 434 435

			this.updateViewletSwitcher();
		});
	}

	public isPinned(viewletId: string): boolean {
436
		return this.pinnedViewlets.indexOf(viewletId) >= 0;
437 438
	}

B
Benjamin Pasero 已提交
439
	public pin(viewletId: string, update = true): void {
440 441 442 443 444 445 446 447
		if (this.isPinned(viewletId)) {
			return;
		}

		// first open that viewlet
		this.viewletService.openViewlet(viewletId, true).then(() => {

			// then update
448 449
			this.pinnedViewlets.push(viewletId);
			this.pinnedViewlets = arrays.distinct(this.pinnedViewlets);
450

B
Benjamin Pasero 已提交
451 452 453
			if (update) {
				this.updateViewletSwitcher();
			}
454 455 456
		});
	}

457
	public move(viewletId: string, toViewletId: string): void {
B
Benjamin Pasero 已提交
458 459 460 461 462 463

		// Make sure a moved viewlet gets pinned
		if (!this.isPinned(viewletId)) {
			this.pin(viewletId, false /* defer update, we take care of it */);
		}

464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
		const fromIndex = this.pinnedViewlets.indexOf(viewletId);
		const toIndex = this.pinnedViewlets.indexOf(toViewletId);

		this.pinnedViewlets.splice(fromIndex, 1);
		this.pinnedViewlets.splice(toIndex, 0, viewletId);

		// Clear viewlets that are impacted by the move
		const visibleViewlets = Object.keys(this.viewletIdToActions);
		for (let i = Math.min(fromIndex, toIndex); i < visibleViewlets.length; i++) {
			this.pullViewlet(visibleViewlets[i]);
		}

		// timeout helps to prevent artifacts from showing up
		setTimeout(() => {
			this.updateViewletSwitcher();
		}, 0);
	}

482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
	/**
	 * Layout title, content and status area in the given dimension.
	 */
	public layout(dimension: Dimension): Dimension[] {

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

		this.dimension = sizes[1];

		// Update switcher to handle overflow issues
		this.updateViewletSwitcher();

		return sizes;
	}
I
isidor 已提交
497

E
Erich Gamma 已提交
498
	public dispose(): void {
I
isidor 已提交
499 500 501 502 503
		if (this.viewletSwitcherBar) {
			this.viewletSwitcherBar.dispose();
			this.viewletSwitcherBar = null;
		}

E
Erich Gamma 已提交
504 505
		super.dispose();
	}
506 507 508 509

	public shutdown(): void {

		// Persist Hidden State
510
		this.memento[ActivitybarPart.PINNED_VIEWLETS] = this.pinnedViewlets;
511 512 513 514

		// Pass to super
		super.shutdown();
	}
515
}
516 517 518

registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {

B
Benjamin Pasero 已提交
519 520 521
	// Styling with Outline color (e.g. high contrast theme)
	const outline = theme.getColor(highContrastOutline);
	if (outline) {
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
		collector.addRule(`
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-label:before {
				content: "";
				position: absolute;
				top: 9px;
				left: 9px;
				height: 32px;
				width: 32px;
				opacity: 0.6;
			}

			.monaco-workbench > .activitybar > .content .monaco-action-bar.global .action-item .action-label.active:before {
				border: none;
			}

			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label.active:before,
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label.active:hover:before {
				outline: 1px solid;
			}

			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label:hover:before {
				outline: 1px dashed;
			}

			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-label,
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-label.active,
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label.active:before,
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item:hover .action-label:before {
				opacity: 1;
			}

			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label:focus:before {
				border-left-color: ${outline};
			}

			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label.active:before,
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label.active:hover:before,
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label:hover:before {
				outline-color: ${outline};
			}
		`);
	}

B
Benjamin Pasero 已提交
565
	// Styling without outline color
566 567 568 569 570 571 572 573 574 575 576 577 578 579
	else {
		const focusBorder = theme.getColor(focus);

		collector.addRule(`
			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-label {
				opacity: 0.6;
			}

			.monaco-workbench > .activitybar > .content .monaco-action-bar .action-item .action-label:focus:before {
				border-left-color: ${focusBorder};
			}
		`);
	}
});