-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14940 from golf1052/hide-activity-bar
Provide an option to hide the activity bar (fixes #1105)
- Loading branch information
Showing
8 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/vs/workbench/browser/actions/toggleActivityBarVisibility.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
'use strict'; | ||
|
||
import { TPromise } from 'vs/base/common/winjs.base'; | ||
import nls = require('vs/nls'); | ||
import { Registry } from 'vs/platform/platform'; | ||
import { Action } from 'vs/base/common/actions'; | ||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; | ||
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry'; | ||
import { IMessageService, Severity } from 'vs/platform/message/common/message'; | ||
import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing'; | ||
import { IPartService } from 'vs/workbench/services/part/common/partService'; | ||
|
||
export class ToggleActivityBarVisibilityAction extends Action { | ||
|
||
public static ID = 'workbench.action.toggleActivityBarVisibility'; | ||
public static LABEL = nls.localize('toggleActivityBar', "Toggle Activity Bar Visibility"); | ||
|
||
private static activityBarVisibleKey = 'workbench.activityBar.visible'; | ||
|
||
constructor( | ||
id: string, | ||
label: string, | ||
@IPartService private partService: IPartService, | ||
@IMessageService private messageService: IMessageService, | ||
@IConfigurationEditingService private configurationEditingService: IConfigurationEditingService | ||
) { | ||
super(id, label); | ||
|
||
this.enabled = !!this.partService; | ||
} | ||
|
||
public run(): TPromise<any> { | ||
const visibility = !this.partService.isActivityBarHidden(); | ||
const newVisibilityValue = !visibility; | ||
|
||
this.configurationEditingService.writeConfiguration(ConfigurationTarget.USER, { key: ToggleActivityBarVisibilityAction.activityBarVisibleKey, value: newVisibilityValue }).then(null, error => { | ||
this.messageService.show(Severity.Error, error); | ||
}); | ||
|
||
return TPromise.as(null); | ||
} | ||
} | ||
|
||
let registry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions); | ||
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleActivityBarVisibilityAction, ToggleActivityBarVisibilityAction.ID, ToggleActivityBarVisibilityAction.LABEL), 'View: Toggle Activity Bar Visibility', nls.localize('view', "View")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters