releaseNotesInput.ts 1.4 KB
Newer Older
J
Joao Moreno 已提交
1 2 3 4 5 6 7 8 9 10
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { EditorInput } from 'vs/workbench/common/editor';
J
Joao Moreno 已提交
11
import URI from 'vs/base/common/uri';
J
Joao Moreno 已提交
12 13 14

export class ReleaseNotesInput extends EditorInput {

15
	static readonly ID = 'workbench.releaseNotes.input';
J
Joao Moreno 已提交
16

J
Joao Moreno 已提交
17
	get version(): string { return this._version; }
J
Joao Moreno 已提交
18
	get text(): string { return this._text; }
J
Joao Moreno 已提交
19

J
Joao Moreno 已提交
20
	constructor(private _version: string, private _text: string) {
J
Joao Moreno 已提交
21 22 23
		super();
	}

J
Joao Moreno 已提交
24 25 26 27
	getResource(): URI {
		return URI.from({ scheme: 'release-notes', path: `${this._version}.release-notes` });
	}

J
Joao Moreno 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
	getTypeId(): string {
		return ReleaseNotesInput.ID;
	}

	getName(): string {
		return localize('releaseNotesInputName', "Release Notes: {0}", this.version);
	}

	matches(other: any): boolean {
		if (!(other instanceof ReleaseNotesInput)) {
			return false;
		}

		const otherInput = other as ReleaseNotesInput;
		return this.version === otherInput.version;
	}

	resolve(refresh?: boolean): TPromise<any> {
		return TPromise.as(null);
	}

	supportsSplitEditor(): boolean {
		return false;
	}
}