Path: blob/main/extensions/media-preview/src/ownedStatusBarEntry.ts
4772 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import * as vscode from 'vscode';6import { Disposable } from './util/dispose';78export abstract class PreviewStatusBarEntry extends Disposable {9private _showOwner: unknown | undefined;1011protected readonly entry: vscode.StatusBarItem;1213constructor(id: string, name: string, alignment: vscode.StatusBarAlignment, priority: number) {14super();15this.entry = this._register(vscode.window.createStatusBarItem(id, alignment, priority));16this.entry.name = name;17}1819protected showItem(owner: unknown, text: string) {20this._showOwner = owner;21this.entry.text = text;22this.entry.show();23}2425public hide(owner: unknown) {26if (owner === this._showOwner) {27this.entry.hide();28this._showOwner = undefined;29}30}31}323334