diff --git a/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts b/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts index b603f45eacb..3f1959cd695 100644 --- a/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts @@ -30,6 +30,7 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; import { URI } from 'vs/base/common/uri'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export interface IUserFriendlyViewsContainerDescriptor { id: string; @@ -161,6 +162,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution { // Register as viewlet class CustomViewlet extends ViewContainerViewlet { constructor( + @IConfigurationService configurationService: IConfigurationService, @IPartService partService: IPartService, @ITelemetryService telemetryService: ITelemetryService, @IWorkspaceContextService contextService: IWorkspaceContextService, @@ -171,7 +173,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution { @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService ) { - super(id, `${id}.state`, true, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(id, `${id}.state`, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); } } const viewletDescriptor = new ViewletDescriptor( diff --git a/src/vs/workbench/browser/actions/toggleSidebarPosition.ts b/src/vs/workbench/browser/actions/toggleSidebarPosition.ts index 3c64a5a1c6d..6d07ae4f749 100644 --- a/src/vs/workbench/browser/actions/toggleSidebarPosition.ts +++ b/src/vs/workbench/browser/actions/toggleSidebarPosition.ts @@ -37,6 +37,10 @@ export class ToggleSidebarPositionAction extends Action { return this.configurationService.updateValue(ToggleSidebarPositionAction.sidebarPositionConfigurationKey, newPositionValue, ConfigurationTarget.USER); } + + static getLabel(partService: IPartService): string { + return partService.getSideBarPosition() === Position.LEFT ? nls.localize('moveSidebarRight', "Move Side Bar Right") : nls.localize('moveSidebarLeft', "Move Side Bar Left"); + } } const registry = Registry.as(Extensions.WorkbenchActions); diff --git a/src/vs/workbench/browser/parts/panel/panelActions.ts b/src/vs/workbench/browser/parts/panel/panelActions.ts index 54d44628025..6fd03a79164 100644 --- a/src/vs/workbench/browser/parts/panel/panelActions.ts +++ b/src/vs/workbench/browser/parts/panel/panelActions.ts @@ -88,7 +88,7 @@ export class TogglePanelPositionAction extends Action { static readonly ID = 'workbench.action.togglePanelPosition'; static readonly LABEL = nls.localize('toggledPanelPosition', "Toggle Panel Position"); - private static readonly MOVE_TO_RIGHT_LABEL = nls.localize('moveToRight', "Move Panel to Right"); + private static readonly MOVE_TO_RIGHT_LABEL = nls.localize('moveToRight', "Move Panel Right"); private static readonly MOVE_TO_BOTTOM_LABEL = nls.localize('moveToBottom', "Move Panel to Bottom"); private toDispose: IDisposable[]; diff --git a/src/vs/workbench/browser/parts/views/panelViewlet.ts b/src/vs/workbench/browser/parts/views/panelViewlet.ts index b84f0fc9f0f..e442787849e 100644 --- a/src/vs/workbench/browser/parts/views/panelViewlet.ts +++ b/src/vs/workbench/browser/parts/views/panelViewlet.ts @@ -199,12 +199,13 @@ export class PanelViewlet extends Viewlet { constructor( id: string, private options: IViewsViewletOptions, + @IConfigurationService configurationService: IConfigurationService, @IPartService partService: IPartService, @IContextMenuService protected contextMenuService: IContextMenuService, @ITelemetryService telemetryService: ITelemetryService, @IThemeService themeService: IThemeService ) { - super(id, partService, telemetryService, themeService); + super(id, configurationService, partService, telemetryService, themeService); } create(parent: HTMLElement): TPromise { diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index b2544d75ffe..062fd046de5 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -123,6 +123,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView id: string, viewletStateStorageId: string, showHeaderInTitleWhenSingleView: boolean, + @IConfigurationService configurationService: IConfigurationService, @IPartService partService: IPartService, @ITelemetryService telemetryService: ITelemetryService, @IStorageService protected storageService: IStorageService, @@ -132,7 +133,7 @@ export abstract class ViewContainerViewlet extends PanelViewlet implements IView @IExtensionService protected extensionService: IExtensionService, @IWorkspaceContextService protected contextService: IWorkspaceContextService ) { - super(id, { showHeaderInTitleWhenSingleView, dnd: new DefaultPanelDndController() }, partService, contextMenuService, telemetryService, themeService); + super(id, { showHeaderInTitleWhenSingleView, dnd: new DefaultPanelDndController() }, configurationService, partService, contextMenuService, telemetryService, themeService); const container = Registry.as(ViewContainerExtensions.ViewContainersRegistry).get(id); this.viewsModel = this._register(this.instantiationService.createInstance(PersistentContributableViewsModel, container, viewletStateStorageId)); diff --git a/src/vs/workbench/browser/viewlet.ts b/src/vs/workbench/browser/viewlet.ts index 2da09e2e578..7412bfc1e67 100644 --- a/src/vs/workbench/browser/viewlet.ts +++ b/src/vs/workbench/browser/viewlet.ts @@ -19,10 +19,13 @@ import { IPartService, Parts } from 'vs/workbench/services/part/common/partServi import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; import { URI } from 'vs/base/common/uri'; +import { ToggleSidebarPositionAction } from 'vs/workbench/browser/actions/toggleSidebarPosition'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export abstract class Viewlet extends Composite implements IViewlet { constructor(id: string, + protected configurationService: IConfigurationService, private partService: IPartService, telemetryService: ITelemetryService, themeService: IThemeService @@ -35,12 +38,14 @@ export abstract class Viewlet extends Composite implements IViewlet { } getContextMenuActions(): IAction[] { - return [{ - id: ToggleSidebarVisibilityAction.ID, - label: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"), - enabled: true, - run: () => this.partService.setSideBarHidden(true) - }]; + const toggleSidebarPositionAction = new ToggleSidebarPositionAction(ToggleSidebarPositionAction.ID, ToggleSidebarPositionAction.getLabel(this.partService), this.partService, this.configurationService); + return [toggleSidebarPositionAction, + { + id: ToggleSidebarVisibilityAction.ID, + label: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"), + enabled: true, + run: () => this.partService.setSideBarHidden(true) + }]; } } diff --git a/src/vs/workbench/parts/debug/browser/debugViewlet.ts b/src/vs/workbench/parts/debug/browser/debugViewlet.ts index b265d9c1aa0..320f1905966 100644 --- a/src/vs/workbench/parts/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/parts/debug/browser/debugViewlet.ts @@ -48,11 +48,11 @@ export class DebugViewlet extends ViewContainerViewlet { @IThemeService themeService: IThemeService, @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService, - @IConfigurationService private configurationService: IConfigurationService, + @IConfigurationService configurationService: IConfigurationService, @IKeybindingService private keybindingService: IKeybindingService, @IContextViewService private contextViewService: IContextViewService, ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, false, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, false, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); this.progressRunner = null; @@ -184,4 +184,4 @@ export class DebugViewlet extends ViewContainerViewlet { this.breakpointView.maximumBodySize = allOtherCollapsed ? Number.POSITIVE_INFINITY : this.breakpointView.minimumBodySize; } } -} \ No newline at end of file +} diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts index 81f1cbff496..15236c60b7e 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts @@ -291,7 +291,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio @INotificationService private notificationService: INotificationService, @IViewletService private viewletService: IViewletService, @IThemeService themeService: IThemeService, - @IConfigurationService private configurationService: IConfigurationService, + @IConfigurationService configurationService: IConfigurationService, @IStorageService storageService: IStorageService, @IWorkspaceContextService contextService: IWorkspaceContextService, @IContextKeyService contextKeyService: IContextKeyService, @@ -299,7 +299,7 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio @IExtensionService extensionService: IExtensionService, @IExtensionManagementServerService private extensionManagementServerService: IExtensionManagementServerService ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); this.searchDelayer = new ThrottledDelayer(500); this.nonEmptyWorkspaceContextKey = NonEmptyWorkspaceContext.bindTo(contextKeyService); @@ -650,4 +650,4 @@ export class MaliciousExtensionChecker implements IWorkbenchContribution { dispose(): void { this.disposables = dispose(this.disposables); } -} \ No newline at end of file +} diff --git a/src/vs/workbench/parts/files/electron-browser/explorerViewlet.ts b/src/vs/workbench/parts/files/electron-browser/explorerViewlet.ts index 37eabbdb03a..75154039abf 100644 --- a/src/vs/workbench/parts/files/electron-browser/explorerViewlet.ts +++ b/src/vs/workbench/parts/files/electron-browser/explorerViewlet.ts @@ -163,14 +163,14 @@ export class ExplorerViewlet extends ViewContainerViewlet implements IExplorerVi @IStorageService protected storageService: IStorageService, @IEditorService private editorService: IEditorService, @IEditorGroupsService private editorGroupService: IEditorGroupsService, - @IConfigurationService private configurationService: IConfigurationService, + @IConfigurationService configurationService: IConfigurationService, @IInstantiationService protected instantiationService: IInstantiationService, @IContextKeyService contextKeyService: IContextKeyService, @IThemeService themeService: IThemeService, @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService ) { - super(VIEWLET_ID, ExplorerViewlet.EXPLORER_VIEWS_STATE, true, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); + super(VIEWLET_ID, ExplorerViewlet.EXPLORER_VIEWS_STATE, true, configurationService, partService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService); this.viewletState = new FileViewletState(); this.viewletVisibleContextKey = ExplorerViewletVisibleContext.bindTo(contextKeyService); diff --git a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts index e3c4f851cc0..57396c57fcb 100644 --- a/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts +++ b/src/vs/workbench/parts/scm/electron-browser/scmViewlet.ts @@ -1062,9 +1062,9 @@ export class SCMViewlet extends PanelViewlet implements IViewModel, IViewsViewle @IWorkspaceContextService contextService: IWorkspaceContextService, @IStorageService storageService: IStorageService, @IExtensionService extensionService: IExtensionService, - @IConfigurationService private configurationService: IConfigurationService, + @IConfigurationService configurationService: IConfigurationService, ) { - super(VIEWLET_ID, { showHeaderInTitleWhenSingleView: true, dnd: new SCMPanelDndController() }, partService, contextMenuService, telemetryService, themeService); + super(VIEWLET_ID, { showHeaderInTitleWhenSingleView: true, dnd: new SCMPanelDndController() }, configurationService, partService, contextMenuService, telemetryService, themeService); this.menus = instantiationService.createInstance(SCMMenus, undefined); this.menus.onDidChangeTitle(this.updateTitleArea, this, this.disposables); diff --git a/src/vs/workbench/parts/search/browser/searchView.ts b/src/vs/workbench/parts/search/browser/searchView.ts index e3a25baf4cb..669e382279d 100644 --- a/src/vs/workbench/parts/search/browser/searchView.ts +++ b/src/vs/workbench/parts/search/browser/searchView.ts @@ -126,7 +126,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { @IStorageService private storageService: IStorageService, @IContextViewService private contextViewService: IContextViewService, @IInstantiationService private instantiationService: IInstantiationService, - @IConfigurationService private configurationService: IConfigurationService, + @IConfigurationService configurationService: IConfigurationService, @IWorkspaceContextService private contextService: IWorkspaceContextService, @ISearchWorkbenchService private searchWorkbenchService: ISearchWorkbenchService, @IContextKeyService private contextKeyService: IContextKeyService, @@ -137,7 +137,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel { @ISearchHistoryService private searchHistoryService: ISearchHistoryService, @IEditorGroupsService private editorGroupsService: IEditorGroupsService ) { - super(VIEW_ID, partService, telemetryService, themeService); + super(VIEW_ID, configurationService, partService, telemetryService, themeService); this.viewletVisible = Constants.SearchViewVisibleKey.bindTo(contextKeyService); this.viewletFocused = Constants.SearchViewFocusedKey.bindTo(contextKeyService); @@ -1578,4 +1578,4 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => { if (outlineSelectionColor) { collector.addRule(`.monaco-workbench .search-view .monaco-tree.focused .monaco-tree-row.focused.selected:not(.highlighted) .action-label:focus { outline-color: ${outlineSelectionColor} }`); } -}); \ No newline at end of file +}); diff --git a/src/vs/workbench/test/browser/viewlet.test.ts b/src/vs/workbench/test/browser/viewlet.test.ts index 9536aeb58ba..3fcf80e4164 100644 --- a/src/vs/workbench/test/browser/viewlet.test.ts +++ b/src/vs/workbench/test/browser/viewlet.test.ts @@ -15,7 +15,7 @@ suite('Viewlets', () => { class TestViewlet extends Viewlet { constructor() { - super('id', null, null, null); + super('id', null, null, null, null); } public layout(dimension: any): void { @@ -53,4 +53,4 @@ suite('Viewlets', () => { assert(d === Platform.Registry.as(Extensions.Viewlets).getViewlet('reg-test-id')); assert.equal(oldCount + 1, Platform.Registry.as(Extensions.Viewlets).getViewlets().length); }); -}); \ No newline at end of file +});