提交 82d9fb51 编写于 作者: B Benjamin Pasero

debt - get rid of identifiers.ts

上级 96f78171
......@@ -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 {
......
......@@ -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 */ },
......
/*---------------------------------------------------------------------------------------------
* 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
......@@ -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);
......
......@@ -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
......@@ -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;
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册