Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -3,12 +3,11 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import 'vs/css!./media/part';
import { Component } from 'vs/workbench/common/component';
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
import { Dimension, size } from 'vs/base/browser/dom';
import { IStorageService } from 'vs/platform/storage/common/storage';
export interface IPartOptions {
hasTitle?: boolean;
@@ -16,21 +15,22 @@ export interface IPartOptions {
}
/**
* Parts are layed out in the workbench and have their own layout that arranges an optional title
* and mandatory content area to show content.
* Parts are layed out in the workbench and have their own layout that
* arranges an optional title and mandatory content area to show content.
*/
export abstract class Part extends Component {
private parent: HTMLElement;
private titleArea: HTMLElement;
private contentArea: HTMLElement;
private titleArea: HTMLElement | null;
private contentArea: HTMLElement | null;
private partLayout: PartLayout;
constructor(
id: string,
private options: IPartOptions,
themeService: IThemeService
themeService: IThemeService,
storageService: IStorageService
) {
super(id, themeService);
super(id, themeService, storageService);
}
protected onThemeChange(theme: ITheme): void {
@@ -67,28 +67,28 @@ export abstract class Part extends Component {
/**
* Subclasses override to provide a title area implementation.
*/
protected createTitleArea(parent: HTMLElement): HTMLElement {
protected createTitleArea(parent: HTMLElement): HTMLElement | null {
return null;
}
/**
* Returns the title area container.
*/
protected getTitleArea(): HTMLElement {
protected getTitleArea(): HTMLElement | null {
return this.titleArea;
}
/**
* Subclasses override to provide a content area implementation.
*/
protected createContentArea(parent: HTMLElement): HTMLElement {
protected createContentArea(parent: HTMLElement): HTMLElement | null {
return null;
}
/**
* Returns the content area container.
*/
protected getContentArea(): HTMLElement {
protected getContentArea(): HTMLElement | null {
return this.contentArea;
}
@@ -100,11 +100,11 @@ export abstract class Part extends Component {
}
}
const TITLE_HEIGHT = 35;
export class PartLayout {
constructor(container: HTMLElement, private options: IPartOptions, titleArea: HTMLElement, private contentArea: HTMLElement) { }
private static readonly TITLE_HEIGHT = 35;
constructor(container: HTMLElement, private options: IPartOptions, titleArea: HTMLElement | null, private contentArea: HTMLElement | null) { }
layout(dimension: Dimension): Dimension[] {
const { width, height } = dimension;
@@ -115,7 +115,7 @@ export class PartLayout {
// Title Size: Width (Fill), Height (Variable)
let titleSize: Dimension;
if (this.options && this.options.hasTitle) {
titleSize = new Dimension(width, Math.min(height, TITLE_HEIGHT));
titleSize = new Dimension(width, Math.min(height, PartLayout.TITLE_HEIGHT));
} else {
titleSize = new Dimension(0, 0);
}