diff --git a/src/vs/test/utils/servicesTestUtils.ts b/src/vs/test/utils/servicesTestUtils.ts index 2b05e311eaed5bd08ad1534ab10ed3977f0627c8..230c6bece1077ee5e21e22a3e26330597ab4aece 100644 --- a/src/vs/test/utils/servicesTestUtils.ts +++ b/src/vs/test/utils/servicesTestUtils.ts @@ -197,6 +197,7 @@ export class TestPartService implements PartService.IPartService { public setSideBarPosition(position): void { } public addClass(clazz: string): void { } public removeClass(clazz: string): void { } + public getWorkbenchElementId(): string { return ''; } } export class TestEventService extends EventEmitter.EventEmitter implements IEventService { diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index 1b58dad4220219afbe59e3c152bd93eaefc0f3ef..da207be9230389127b20632e10296d1ca39d0ef3 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -27,7 +27,7 @@ import {Registry} from 'vs/platform/platform'; import {EditorInput, getUntitledOrFileResource, IWorkbenchEditorConfiguration} from 'vs/workbench/common/editor'; import {WorkbenchComponent} from 'vs/workbench/common/component'; import Event, {Emitter} from 'vs/base/common/event'; -import {Identifiers} from 'vs/workbench/common/constants'; +import {IPartService} from 'vs/workbench/services/part/common/partService'; import {KeyMod} from 'vs/base/common/keyCodes'; import {QuickOpenHandler, QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions, EditorQuickOpenEntry} from 'vs/workbench/browser/quickopen'; import errors = require('vs/base/common/errors'); @@ -104,7 +104,8 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe @IContextKeyService contextKeyService: IContextKeyService, @IConfigurationService private configurationService: IConfigurationService, @IHistoryService private historyService: IHistoryService, - @IInstantiationService private instantiationService: IInstantiationService + @IInstantiationService private instantiationService: IInstantiationService, + @IPartService private partService: IPartService ) { super(QuickOpenController.ID); @@ -261,7 +262,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe // Create upon first open if (!this.pickOpenWidget) { this.pickOpenWidget = new QuickOpenWidget( - withElementById(Identifiers.WORKBENCH_CONTAINER).getHTMLElement(), + withElementById(this.partService.getWorkbenchElementId()).getHTMLElement(), { onOk: () => { /* ignore, handle later */ }, onCancel: () => { /* ignore, handle later */ }, @@ -499,7 +500,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe // Create upon first open if (!this.quickOpenWidget) { this.quickOpenWidget = new QuickOpenWidget( - withElementById(Identifiers.WORKBENCH_CONTAINER).getHTMLElement(), + withElementById(this.partService.getWorkbenchElementId()).getHTMLElement(), { onOk: () => { /* ignore */ }, onCancel: () => { /* ignore */ }, diff --git a/src/vs/workbench/common/constants.ts b/src/vs/workbench/common/constants.ts deleted file mode 100644 index b20bae1c1451db4dc8d882d51ad41b299b197e7f..0000000000000000000000000000000000000000 --- a/src/vs/workbench/common/constants.ts +++ /dev/null @@ -1,16 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -'use strict'; - -// Container Identifiers -export const Identifiers = { - WORKBENCH_CONTAINER: 'workbench.main.container', - ACTIVITYBAR_PART: 'workbench.parts.activitybar', - SIDEBAR_PART: 'workbench.parts.sidebar', - PANEL_PART: 'workbench.parts.panel', - EDITOR_PART: 'workbench.parts.editor', - STATUSBAR_PART: 'workbench.parts.statusbar' -}; \ No newline at end of file diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index fa27e9e4b2e95c11f100b901e0f638de885488e2..06f635016b3be0bf5b13932c0de6617a282a5edf 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -10,7 +10,7 @@ import URI from 'vs/base/common/uri'; import DOM = require('vs/base/browser/dom'); import DND = require('vs/base/browser/dnd'); import {Builder, $} from 'vs/base/browser/builder'; -import {Identifiers} from 'vs/workbench/common/constants'; +import {IPartService} from 'vs/workbench/services/part/common/partService'; import {asFileEditorInput} from 'vs/workbench/common/editor'; import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; @@ -42,7 +42,8 @@ export class ElectronWindow { @IStorageService private storageService: IStorageService, @IWorkbenchEditorService private editorService: IWorkbenchEditorService, @IEditorGroupService private editorGroupService: IEditorGroupService, - @IViewletService private viewletService: IViewletService + @IViewletService private viewletService: IViewletService, + @IPartService private partService: IPartService ) { this.win = win; this.windowId = win.id; @@ -89,7 +90,7 @@ export class ElectronWindow { return kind === DraggedFileType.FOLDER || kind === DraggedFileType.EXTENSION; })) { - dropOverlay = $(window.document.getElementById(Identifiers.WORKBENCH_CONTAINER)) + dropOverlay = $(window.document.getElementById(this.partService.getWorkbenchElementId())) .div({ id: 'monaco-workbench-drop-overlay' }) .on(DOM.EventType.DROP, (e: DragEvent) => { DOM.EventHelper.stop(e, true); diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index a9bd42080895a815bfa7e7f82198799b1fa0d627..26d1d401bdbd10ce69bcec920ac4abd973c0b278 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -17,7 +17,6 @@ import assert = require('vs/base/common/assert'); import timer = require('vs/base/common/timer'); import errors = require('vs/base/common/errors'); import {Registry} from 'vs/platform/platform'; -import {Identifiers} from 'vs/workbench/common/constants'; import {isWindows, isLinux} from 'vs/base/common/platform'; import {IOptions} from 'vs/workbench/common/options'; import {IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions} from 'vs/workbench/common/contributions'; @@ -86,6 +85,15 @@ export interface IWorkbenchCallbacks { onWorkbenchStarted?: (customKeybindingsCount: number) => void; } +const Identifiers = { + WORKBENCH_CONTAINER: 'workbench.main.container', + ACTIVITYBAR_PART: 'workbench.parts.activitybar', + SIDEBAR_PART: 'workbench.parts.sidebar', + PANEL_PART: 'workbench.parts.panel', + EDITOR_PART: 'workbench.parts.editor', + STATUSBAR_PART: 'workbench.parts.statusbar' +}; + /** * The workbench creates and lays out all parts that make up the workbench. */ @@ -811,4 +819,8 @@ export class Workbench implements IPartService { this.workbench.removeClass(clazz); } } + + public getWorkbenchElementId(): string { + return Identifiers.WORKBENCH_CONTAINER; + } } \ No newline at end of file diff --git a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts index 8b4161d4d3782ab659f6d2dfb43b5debd370f192..8f3fea28435de2c5b7626e69bf12899ba84f3b8f 100644 --- a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts +++ b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts @@ -12,7 +12,7 @@ import {StandardMouseEvent} from 'vs/base/browser/mouseEvent'; import actions = require('vs/base/common/actions'); import events = require('vs/base/common/events'); import actionbar = require('vs/base/browser/ui/actionbar/actionbar'); -import constants = require('vs/workbench/common/constants'); +import {IPartService} from 'vs/workbench/services/part/common/partService'; import wbext = require('vs/workbench/common/contributions'); import debug = require('vs/workbench/parts/debug/common/debug'); import {PauseAction, ContinueAction, StepBackAction, StopAction, DisconnectAction, StepOverAction, StepIntoAction, StepOutAction, RestartAction} from 'vs/workbench/parts/debug/browser/debugActions'; @@ -47,6 +47,7 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution { @ITelemetryService private telemetryService: ITelemetryService, @IDebugService private debugService: IDebugService, @IInstantiationService private instantiationService: IInstantiationService, + @IPartService private partService: IPartService, @IStorageService private storageService: IStorageService ) { this.$el = $().div().addClass('debug-actions-widget'); @@ -146,7 +147,7 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution { } if (!this.isBuilt) { this.isBuilt = true; - this.$el.build(builder.withElementById(constants.Identifiers.WORKBENCH_CONTAINER).getHTMLElement()); + this.$el.build(builder.withElementById(this.partService.getWorkbenchElementId()).getHTMLElement()); } this.isVisible = true; diff --git a/src/vs/workbench/services/part/common/partService.ts b/src/vs/workbench/services/part/common/partService.ts index 9b2a11072fd7043d2aa51875f9b75f6ac7296f7e..d87d8e143709dcf8da8187f7467938e862a608d5 100644 --- a/src/vs/workbench/services/part/common/partService.ts +++ b/src/vs/workbench/services/part/common/partService.ts @@ -100,4 +100,9 @@ export interface IPartService { * Removes a class from the workbench part. */ removeClass(clazz: string): void; + + /** + * Returns the identifier of the element that contains the workbench. + */ + getWorkbenchElementId(): string; } \ No newline at end of file