Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WidgetManager

The WidgetManager is the common component responsible for creating and managing widgets. Additional widget factories can be registered by using the WidgetFactory contribution point. To identify a widget, created by a factory, the factory id and the creation options are used. This key is commonly referred to as description of the widget.

Hierarchy

  • WidgetManager

Index

Properties

Protected _cachedFactories

_cachedFactories: Map<string, WidgetFactory>

Protected Readonly factoryProvider

Protected Readonly logger

logger: ILogger

Readonly onDidCreateWidget

onDidCreateWidget: Event<DidCreateWidgetEvent> = this.onDidCreateWidgetEmitter.event

Protected Readonly onDidCreateWidgetEmitter

onDidCreateWidgetEmitter: Emitter<DidCreateWidgetEvent> = new Emitter<DidCreateWidgetEvent>()

Readonly onWillCreateWidget

onWillCreateWidget: Event<WillCreateWidgetEvent> = this.onWillCreateWidgetEmitter.event

An event can be used to participate in the widget creation. Listeners may not dispose the given widget.

Protected Readonly onWillCreateWidgetEmitter

onWillCreateWidgetEmitter: Emitter<WillCreateWidgetEvent> = new Emitter<WillCreateWidgetEvent>()

Protected Readonly pendingWidgetPromises

pendingWidgetPromises: Map<string, Widget | PromiseLike<Widget>> = new Map<string, MaybePromise<Widget>>()

Protected Readonly widgetPromises

widgetPromises: Map<string, Widget | PromiseLike<Widget>> = new Map<string, MaybePromise<Widget>>()

Protected Readonly widgets

widgets: Map<string, Widget> = new Map<string, Widget>()

Accessors

Protected factories

Methods

Protected doGetWidget

Protected fromKey

getDescription

getOrCreateWidget

  • getOrCreateWidget<T>(factoryId: string, options?: any): Promise<T>
  • Creates a new widget or returns the existing widget for the given description.

    Type parameters

    • T: Widget

    Parameters

    • factoryId: string

      the widget factory id.

    • Optional options: any

      the widget factory specific information.

    Returns Promise<T>

    a promise resolving to the widget.

getWidget

  • getWidget<T>(factoryId: string, options?: any): Promise<T | undefined>
  • Get the widget for the given description.

    Type parameters

    • T: Widget

    Parameters

    • factoryId: string

      The widget factory id.

    • Optional options: any

      The widget factory specific information.

    Returns Promise<T | undefined>

    a promise resolving to the widget if available, else undefined.

getWidgets

  • getWidgets(factoryId: string): Widget[]
  • Get the list of widgets created by the given widget factory.

    Parameters

    • factoryId: string

      the widget factory id.

    Returns Widget[]

    the list of widgets created by the factory with the given id.

Protected toKey

tryGetWidget

  • tryGetWidget<T>(factoryId: string, options?: any): T | undefined
  • Try to get the existing widget for the given description.

    Type parameters

    • T: Widget

    Parameters

    • factoryId: string

      The widget factory id.

    • Optional options: any

      The widget factory specific information.

    Returns T | undefined

    the widget if available, else undefined.