Path: blob/main/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditorInput.ts
13401 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 { EditorInput } from '../../../common/editor/editorInput.js';6import { EditorInputCapabilities, IUntypedEditorInput } from '../../../common/editor.js';7import { URI } from '../../../../base/common/uri.js';8import { Schemas } from '../../../../base/common/network.js';9import { IImageCarouselCollection } from './imageCarouselTypes.js';1011export class ImageCarouselEditorInput extends EditorInput {12static readonly ID = 'workbench.input.imageCarousel';1314private _resource: URI;15private _name: string;1617override get capabilities(): EditorInputCapabilities {18return super.capabilities | EditorInputCapabilities.Singleton | EditorInputCapabilities.RequiresModal;19}2021constructor(22public readonly collection: IImageCarouselCollection,23public readonly startIndex: number = 024) {25super();26this._resource = URI.from({27scheme: Schemas.vscodeImageCarousel,28path: `/${encodeURIComponent(collection.id)}`,29});30this._name = collection.title;31}3233get typeId(): string {34return ImageCarouselEditorInput.ID;35}3637get resource(): URI {38return this._resource;39}4041override getName(): string {42return this._name;43}4445setName(name: string): void {46if (this._name !== name) {47this._name = name;48this._onDidChangeLabel.fire();49}50}5152override matches(other: EditorInput | IUntypedEditorInput): boolean {53if (other instanceof ImageCarouselEditorInput) {54return other.collection.id === this.collection.id;55}56return false;57}58}596061