notificationsActions.ts 2.8 KB
Newer Older
1 2 3 4 5 6 7 8
/*---------------------------------------------------------------------------------------------
 *  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 'vs/css!./media/notificationActions';
9
import { INotificationViewItem } from 'vs/workbench/common/notifications';
10
import { localize } from 'vs/nls';
11
import { Action, IAction } from 'vs/base/common/actions';
12 13 14 15 16 17 18 19 20 21 22 23 24 25
import { TPromise } from 'vs/base/common/winjs.base';

export class CloseNotificationAction extends Action {

	public static readonly ID = 'workbench.action.closeNotification';
	public static readonly LABEL = localize('closeNotification', "Close Notification");

	constructor(
		id: string,
		label: string
	) {
		super(id, label, 'close-notification-action');
	}

26 27 28 29
	public run(notification: INotificationViewItem): TPromise<any> {
		notification.dispose();

		return TPromise.as(void 0);
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
	}
}

export class ExpandNotificationAction extends Action {

	public static readonly ID = 'workbench.action.expandNotification';
	public static readonly LABEL = localize('expandNotification', "Expand Notification");

	constructor(
		id: string,
		label: string
	) {
		super(id, label, 'expand-notification-action');
	}

45 46
	public run(notification: INotificationViewItem): TPromise<any> {
		notification.expand();
47

48
		return TPromise.as(void 0);
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
	}
}

export class CollapseNotificationAction extends Action {

	public static readonly ID = 'workbench.action.collapseNotification';
	public static readonly LABEL = localize('collapseNotification', "Collapse Notification");

	constructor(
		id: string,
		label: string
	) {
		super(id, label, 'collapse-notification-action');
	}

64 65
	public run(notification: INotificationViewItem): TPromise<any> {
		notification.collapse();
66

67
		return TPromise.as(void 0);
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
	}
}

export class ConfigureNotificationAction extends Action {

	public static readonly ID = 'workbench.action.configureNotification';
	public static readonly LABEL = localize('configureNotification', "Configure Notification");

	constructor(
		id: string,
		label: string,
		private _configurationActions: IAction[]
	) {
		super(id, label, 'configure-notification-action');
	}

	public get configurationActions(): IAction[] {
		return this._configurationActions;
	}
}

export class DoNotShowNotificationAgainAction extends Action {

	public static readonly ID = 'workbench.action.doNotShowNotificationAgain';
	public static readonly LABEL = localize('dontShowNotificationAgain', "Don't Show Again");

	constructor(
		id: string,
96
		label: string
97 98 99 100
	) {
		super(id, label);
	}

101
	public run(notification: INotificationViewItem): TPromise<any> {
102 103 104
		return TPromise.as(void 0); // TODO@notification
	}
}