mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-31 01:00:29 -04:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -7,15 +7,15 @@
|
||||
import 'vs/css!./tree';
|
||||
import WinJS = require('vs/base/common/winjs.base');
|
||||
import TreeDefaults = require('vs/base/parts/tree/browser/treeDefaults');
|
||||
import Events = require('vs/base/common/eventEmitter');
|
||||
import Model = require('vs/base/parts/tree/browser/treeModel');
|
||||
import View = require('./treeView');
|
||||
import _ = require('vs/base/parts/tree/browser/tree');
|
||||
import { INavigator, MappedNavigator } from 'vs/base/common/iterator';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import Lifecycle = require('vs/base/common/lifecycle');
|
||||
import Event, { Emitter, Relay } from 'vs/base/common/event';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { ISelectionEvent, IFocusEvent, IHighlightEvent } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IItemCollapseEvent, IItemExpandEvent } from 'vs/base/parts/tree/browser/treeModel';
|
||||
|
||||
export class TreeContext implements _.ITreeContext {
|
||||
|
||||
@@ -61,42 +61,37 @@ const defaultStyles: _.ITreeStyles = {
|
||||
listDropBackground: Color.fromHex('#383B3D')
|
||||
};
|
||||
|
||||
export class Tree extends Events.EventEmitter implements _.ITree {
|
||||
export class Tree implements _.ITree {
|
||||
|
||||
private container: HTMLElement;
|
||||
private configuration: _.ITreeConfiguration;
|
||||
private options: _.ITreeOptions;
|
||||
|
||||
private context: _.ITreeContext;
|
||||
private model: Model.TreeModel;
|
||||
private view: View.TreeView;
|
||||
|
||||
private _onDispose: Emitter<void>;
|
||||
private _onHighlightChange: Emitter<void>;
|
||||
|
||||
private toDispose: Lifecycle.IDisposable[];
|
||||
private _onDidChangeFocus = new Relay<IFocusEvent>();
|
||||
readonly onDidChangeFocus: Event<IFocusEvent> = this._onDidChangeFocus.event;
|
||||
private _onDidChangeSelection = new Relay<ISelectionEvent>();
|
||||
readonly onDidChangeSelection: Event<ISelectionEvent> = this._onDidChangeSelection.event;
|
||||
private _onHighlightChange = new Relay<IHighlightEvent>();
|
||||
readonly onDidChangeHighlight: Event<IHighlightEvent> = this._onHighlightChange.event;
|
||||
private _onDidExpandItem = new Relay<IItemExpandEvent>();
|
||||
readonly onDidExpandItem: Event<IItemExpandEvent> = this._onDidExpandItem.event;
|
||||
private _onDidCollapseItem = new Relay<IItemCollapseEvent>();
|
||||
readonly onDidCollapseItem: Event<IItemCollapseEvent> = this._onDidCollapseItem.event;
|
||||
private _onDispose = new Emitter<void>();
|
||||
readonly onDidDispose: Event<void> = this._onDispose.event;
|
||||
|
||||
constructor(container: HTMLElement, configuration: _.ITreeConfiguration, options: _.ITreeOptions = {}) {
|
||||
super();
|
||||
|
||||
this.toDispose = [];
|
||||
|
||||
this._onDispose = new Emitter<void>();
|
||||
this._onHighlightChange = new Emitter<void>();
|
||||
|
||||
this.toDispose.push(this._onDispose, this._onHighlightChange);
|
||||
|
||||
this.container = container;
|
||||
this.configuration = configuration;
|
||||
this.options = options;
|
||||
mixin(this.options, defaultStyles, false);
|
||||
mixin(options, defaultStyles, false);
|
||||
|
||||
this.options.twistiePixels = typeof this.options.twistiePixels === 'number' ? this.options.twistiePixels : 32;
|
||||
this.options.showTwistie = this.options.showTwistie === false ? false : true;
|
||||
this.options.indentPixels = typeof this.options.indentPixels === 'number' ? this.options.indentPixels : 12;
|
||||
this.options.alwaysFocused = this.options.alwaysFocused === true ? true : false;
|
||||
this.options.useShadows = this.options.useShadows === false ? false : true;
|
||||
this.options.paddingOnRow = this.options.paddingOnRow === false ? false : true;
|
||||
options.twistiePixels = typeof options.twistiePixels === 'number' ? options.twistiePixels : 32;
|
||||
options.showTwistie = options.showTwistie === false ? false : true;
|
||||
options.indentPixels = typeof options.indentPixels === 'number' ? options.indentPixels : 12;
|
||||
options.alwaysFocused = options.alwaysFocused === true ? true : false;
|
||||
options.useShadows = options.useShadows === false ? false : true;
|
||||
options.paddingOnRow = options.paddingOnRow === false ? false : true;
|
||||
|
||||
this.context = new TreeContext(this, configuration, options);
|
||||
this.model = new Model.TreeModel(this.context);
|
||||
@@ -104,32 +99,25 @@ export class Tree extends Events.EventEmitter implements _.ITree {
|
||||
|
||||
this.view.setModel(this.model);
|
||||
|
||||
this.addEmitter(this.model);
|
||||
this.addEmitter(this.view);
|
||||
|
||||
this.toDispose.push(this.model.addListener('highlight', () => this._onHighlightChange.fire()));
|
||||
this._onDidChangeFocus.input = this.model.onDidFocus;
|
||||
this._onDidChangeSelection.input = this.model.onDidSelect;
|
||||
this._onHighlightChange.input = this.model.onDidHighlight;
|
||||
this._onDidExpandItem.input = this.model.onDidExpandItem;
|
||||
this._onDidCollapseItem.input = this.model.onDidCollapseItem;
|
||||
}
|
||||
|
||||
public style(styles: _.ITreeStyles): void {
|
||||
this.view.applyStyles(styles);
|
||||
}
|
||||
|
||||
get onDOMFocus(): Event<void> {
|
||||
get onDidFocus(): Event<void> {
|
||||
return this.view && this.view.onDOMFocus;
|
||||
}
|
||||
|
||||
get onDOMBlur(): Event<void> {
|
||||
get onDidBlur(): Event<void> {
|
||||
return this.view && this.view.onDOMBlur;
|
||||
}
|
||||
|
||||
get onHighlightChange(): Event<void> {
|
||||
return this._onHighlightChange && this._onHighlightChange.event;
|
||||
}
|
||||
|
||||
get onDispose(): Event<void> {
|
||||
return this._onDispose && this._onDispose.event;
|
||||
}
|
||||
|
||||
public getHTMLElement(): HTMLElement {
|
||||
return this.view.getHTMLElement();
|
||||
}
|
||||
@@ -186,6 +174,10 @@ export class Tree extends Events.EventEmitter implements _.ITree {
|
||||
return this.model.collapseAll(elements, recursive);
|
||||
}
|
||||
|
||||
public collapseDeepestExpandedLevel(): WinJS.Promise {
|
||||
return this.model.collapseDeepestExpandedLevel();
|
||||
}
|
||||
|
||||
public toggleExpansion(element: any, recursive: boolean = false): WinJS.Promise {
|
||||
return this.model.toggleExpansion(element, recursive);
|
||||
}
|
||||
@@ -380,8 +372,11 @@ export class Tree extends Events.EventEmitter implements _.ITree {
|
||||
this.view = null;
|
||||
}
|
||||
|
||||
this.toDispose = Lifecycle.dispose(this.toDispose);
|
||||
|
||||
super.dispose();
|
||||
this._onDidChangeFocus.dispose();
|
||||
this._onDidChangeSelection.dispose();
|
||||
this._onHighlightChange.dispose();
|
||||
this._onDidExpandItem.dispose();
|
||||
this._onDidCollapseItem.dispose();
|
||||
this._onDispose.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user