Theia API Documentation v1.65.0
    Preparing search index...

    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.

    Index

    Constructors

    Properties

    _cachedFactories: Map<string, WidgetFactory>
    logger: ILogger
    onDidCreateWidget: Event<DidCreateWidgetEvent> = ...
    onDidCreateWidgetEmitter: Emitter<DidCreateWidgetEvent> = ...
    onWillCreateWidget: Event<WillCreateWidgetEvent> = ...

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

    onWillCreateWidgetEmitter: Emitter<WillCreateWidgetEvent> = ...
    pendingWidgetPromises: Map<string, Promise<Widget>> = ...
    widgets: Map<string, Widget> = ...

    Accessors

    Methods

    • Finds a widget that matches the given test predicate.

      Type Parameters

      Parameters

      • factoryId: string

        The widget factory id.

      • predicate: (options?: any) => boolean

        The test predicate.

      Returns Promise<undefined | T>

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

    • Creates a new widget or returns the existing widget for the given description.

      Type Parameters

      Parameters

      • factoryId: string

        the widget factory id.

      • Optionaloptions: any

        the widget factory specific information.

      Returns Promise<T>

      a promise resolving to the widget.

    • Get the widget for the given description.

      Type Parameters

      Parameters

      • factoryId: string

        The widget factory id.

      • Optionaloptions: any

        The widget factory specific information.

      Returns Promise<undefined | T>

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

    • Parameters

      • key: string
      • factoryId: string
      • predicate: (options?: any) => boolean

      Returns boolean

    • Try to get the existing widget for the given description.

      Type Parameters

      Parameters

      • factoryId: string

        The widget factory id.

      • Optionaloptions: any

        The widget factory specific information.

      Returns undefined | MaybePromise<T>

      A promise that resolves to the widget, if any exists. The promise may be pending, so be cautious when assuming that it will not reject.

    • Try to get the existing widget for the given description.

      Type Parameters

      Parameters

      • factoryId: string

        The widget factory id.

      • Optionaloptions: any

        The widget factory specific information.

      Returns undefined | T

      the widget if available, else undefined.

      The widget is 'available' if it has been created with the same factoryId and options by the WidgetManager. If the widget's creation is asynchronous, it is only available when the associated Promise is resolved.