mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 03:58:33 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -32,6 +32,9 @@ export abstract class Composite extends Component implements IComposite {
|
||||
private readonly _onTitleAreaUpdate: Emitter<void> = this._register(new Emitter<void>());
|
||||
get onTitleAreaUpdate(): Event<void> { return this._onTitleAreaUpdate.event; }
|
||||
|
||||
private readonly _onDidChangeVisibility: Emitter<boolean> = this._register(new Emitter<boolean>());
|
||||
get onDidChangeVisibility(): Event<boolean> { return this._onDidChangeVisibility.event; }
|
||||
|
||||
private _onDidFocus: Emitter<void>;
|
||||
get onDidFocus(): Event<void> {
|
||||
if (!this._onDidFocus) {
|
||||
@@ -64,9 +67,6 @@ export abstract class Composite extends Component implements IComposite {
|
||||
private visible: boolean;
|
||||
private parent: HTMLElement;
|
||||
|
||||
/**
|
||||
* Create a new composite with the given ID and context.
|
||||
*/
|
||||
constructor(
|
||||
id: string,
|
||||
private _telemetryService: ITelemetryService,
|
||||
@@ -78,7 +78,7 @@ export abstract class Composite extends Component implements IComposite {
|
||||
this.visible = false;
|
||||
}
|
||||
|
||||
getTitle(): string {
|
||||
getTitle(): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,11 @@ export abstract class Composite extends Component implements IComposite {
|
||||
* If there is a long running opertaion it is fine to have it running in the background asyncly and return before.
|
||||
*/
|
||||
setVisible(visible: boolean): void {
|
||||
this.visible = visible;
|
||||
if (this.visible !== !!visible) {
|
||||
this.visible = visible;
|
||||
|
||||
this._onDidChangeVisibility.fire(visible);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +169,7 @@ export abstract class Composite extends Component implements IComposite {
|
||||
* of an action. Returns null to indicate that the action is not rendered through
|
||||
* an action item.
|
||||
*/
|
||||
getActionItem(action: IAction): IActionItem {
|
||||
getActionItem(action: IAction): IActionItem | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -201,7 +205,7 @@ export abstract class Composite extends Component implements IComposite {
|
||||
/**
|
||||
* Returns the underlying composite control or null if it is not accessible.
|
||||
*/
|
||||
getControl(): ICompositeControl {
|
||||
getControl(): ICompositeControl | null {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -210,24 +214,15 @@ export abstract class Composite extends Component implements IComposite {
|
||||
* A composite descriptor is a leightweight descriptor of a composite in the workbench.
|
||||
*/
|
||||
export abstract class CompositeDescriptor<T extends Composite> {
|
||||
id: string;
|
||||
name: string;
|
||||
cssClass: string;
|
||||
order: number;
|
||||
keybindingId: string;
|
||||
enabled: boolean;
|
||||
|
||||
private ctor: IConstructorSignature0<T>;
|
||||
|
||||
constructor(ctor: IConstructorSignature0<T>, id: string, name: string, cssClass?: string, order?: number, keybindingId?: string, ) {
|
||||
this.ctor = ctor;
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.cssClass = cssClass;
|
||||
this.order = order;
|
||||
this.enabled = true;
|
||||
this.keybindingId = keybindingId;
|
||||
}
|
||||
constructor(
|
||||
private readonly ctor: IConstructorSignature0<T>,
|
||||
public readonly id: string,
|
||||
public readonly name: string,
|
||||
public readonly cssClass?: string,
|
||||
public readonly order?: number,
|
||||
public readonly keybindingId?: string,
|
||||
) { }
|
||||
|
||||
instantiate(instantiationService: IInstantiationService): T {
|
||||
return instantiationService.createInstance(this.ctor);
|
||||
@@ -239,6 +234,9 @@ export abstract class CompositeRegistry<T extends Composite> extends Disposable
|
||||
private readonly _onDidRegister: Emitter<CompositeDescriptor<T>> = this._register(new Emitter<CompositeDescriptor<T>>());
|
||||
get onDidRegister(): Event<CompositeDescriptor<T>> { return this._onDidRegister.event; }
|
||||
|
||||
private readonly _onDidDeregister: Emitter<CompositeDescriptor<T>> = this._register(new Emitter<CompositeDescriptor<T>>());
|
||||
get onDidDeregister(): Event<CompositeDescriptor<T>> { return this._onDidDeregister.event; }
|
||||
|
||||
private composites: CompositeDescriptor<T>[] = [];
|
||||
|
||||
protected registerComposite(descriptor: CompositeDescriptor<T>): void {
|
||||
@@ -250,7 +248,17 @@ export abstract class CompositeRegistry<T extends Composite> extends Disposable
|
||||
this._onDidRegister.fire(descriptor);
|
||||
}
|
||||
|
||||
getComposite(id: string): CompositeDescriptor<T> {
|
||||
protected deregisterComposite(id: string): void {
|
||||
const descriptor = this.compositeById(id);
|
||||
if (descriptor === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.composites.splice(this.composites.indexOf(descriptor), 1);
|
||||
this._onDidDeregister.fire(descriptor);
|
||||
}
|
||||
|
||||
getComposite(id: string): CompositeDescriptor<T> | null {
|
||||
return this.compositeById(id);
|
||||
}
|
||||
|
||||
@@ -258,10 +266,10 @@ export abstract class CompositeRegistry<T extends Composite> extends Disposable
|
||||
return this.composites.slice(0);
|
||||
}
|
||||
|
||||
private compositeById(id: string): CompositeDescriptor<T> {
|
||||
for (let i = 0; i < this.composites.length; i++) {
|
||||
if (this.composites[i].id === id) {
|
||||
return this.composites[i];
|
||||
private compositeById(id: string): CompositeDescriptor<T> | null {
|
||||
for (const composite of this.composites) {
|
||||
if (composite.id === id) {
|
||||
return composite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user