提交 3dad25db 编写于 作者: B Benjamin Pasero

grid - scaffold more things wip

上级 025af255
......@@ -17,6 +17,7 @@ import { join } from 'vs/base/common/paths';
import { editorBackground } from 'vs/platform/theme/common/colorRegistry';
import { INextEditorPartService } from 'vs/workbench/services/editor/common/nextEditorPartService';
import { EditorInput, EditorOptions } from 'vs/workbench/common/editor';
import { NextEditorViewer, GridOrientation } from './nextEditorViewer';
// import { IStorageService } from 'vs/platform/storage/common/storage';
export class NextEditorPart extends Part implements INextEditorPartService {
......@@ -28,6 +29,8 @@ export class NextEditorPart extends Part implements INextEditorPartService {
// private dimension: Dimension;
// private memento: object;
private viewer: NextEditorViewer;
constructor(
id: string,
@IEnvironmentService private environmentService: IEnvironmentService,
......@@ -40,13 +43,18 @@ export class NextEditorPart extends Part implements INextEditorPartService {
// this.memento = this.getMemento(this.storageService, Scope.WORKSPACE);
this.viewer = new NextEditorViewer();
this.initStyles();
}
public openEditor(input: EditorInput, options?: EditorOptions): TPromise<void> {
console.log('open: ', input);
return TPromise.as(void 0);
// TODO@grid arguments validation
// TODO@grid editor opening event and prevention
// TODO@grid support options
return this.viewer.split([], GridOrientation.HORIZONTAL, input, options);
}
private initStyles(): void {
......@@ -64,7 +72,7 @@ export class NextEditorPart extends Part implements INextEditorPartService {
const container = this.getContainer();
container.style.backgroundColor = this.getColor(editorBackground);
// TODO@next set editor group color depending on group size
// TODO@grid set editor group color depending on group size
// Content area
// const content = this.getContentArea();
......@@ -84,10 +92,15 @@ export class NextEditorPart extends Part implements INextEditorPartService {
}
public createContentArea(parent: HTMLElement): HTMLElement {
// Container
const contentArea = document.createElement('div');
addClass(contentArea, 'content');
parent.appendChild(contentArea);
// Viewer
contentArea.appendChild(this.viewer.element);
return contentArea;
}
......@@ -96,7 +109,7 @@ export class NextEditorPart extends Part implements INextEditorPartService {
// this.dimension = sizes[1];
// TODO@next propagate layout
// TODO@grid propagate layout
this._onLayout.fire(dimension);
......@@ -105,7 +118,7 @@ export class NextEditorPart extends Part implements INextEditorPartService {
public shutdown(): void {
// TODO@next shutdown
// TODO@grid shutdown
// - persist part view state
// - pass on to instantiated editors
......@@ -117,7 +130,7 @@ export class NextEditorPart extends Part implements INextEditorPartService {
// Emitters
this._onLayout.dispose();
// TODO@next dispose
// TODO@grid dispose
// - all visible and instantiated editors
// - tokens for opening
......
/*---------------------------------------------------------------------------------------------
* 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 { EditorInput, EditorOptions, GroupIdentifier } from 'vs/workbench/common/editor';
// import { EditorGroup } from '../../../common/editor/editorStacksModel';
export enum GridOrientation {
VERTICAL,
HORIZONTAL
}
export class NextEditorViewer {
private _element: HTMLElement;
// private model: NextEditorViewModel;
constructor() {
this._element = document.createElement('div');
// this.model = new NextEditorViewModel(new TestGrid());
}
get element(): HTMLElement {
return this._element;
}
split(location: number[], orientation: GridOrientation, input: EditorInput, options?: EditorOptions): TPromise<void> {
return TPromise.as(void 0);
}
show(id: GroupIdentifier, input: EditorInput, options?: EditorOptions): TPromise<void> {
return TPromise.as(void 0);
}
}
// interface IGridPrimitives {
// split();
// move();
// close();
// }
// class TestGrid implements IGridPrimitives {
// split() {}
// move() {}
// close() {}
// }
// class NextEditorViewModel {
// private groups: EditorGroup[];
// constructor(grid: IGridPrimitives) {
// this.groups = [];
// }
// }
\ No newline at end of file
......@@ -206,7 +206,7 @@ export class Workbench implements IPartService {
private activitybarPart: ActivitybarPart;
private sidebarPart: SidebarPart;
private panelPart: PanelPart;
private noOpEditorPart: NoOpEditorPart; // TODO@next adopt methods in next editor part
private noOpEditorPart: NoOpEditorPart; // TODO@grid adopt methods in next editor part
private editorPart: NextEditorPart;
private statusbarPart: StatusbarPart;
private quickOpen: QuickOpenController;
......
......@@ -139,7 +139,7 @@ export interface IEditorPart {
getActiveEditorInput(): IEditorInput;
}
// TODO@next temporary
// TODO@grid temporary
export class NoOpEditorPart implements IEditorPart, IEditorGroupService {
_serviceBrand: ServiceIdentifier<any>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册