From b6bfdd4d9b1cc4313d41a78982e7cb2843bc010d Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 16 Feb 2018 12:14:54 +0100 Subject: [PATCH] notifications - toggle expansion on double click --- .../browser/parts/notifications/notificationCommands.ts | 6 +----- .../browser/parts/notifications/notificationsCenter.ts | 5 +++++ src/vs/workbench/common/notifications.ts | 9 +++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/browser/parts/notifications/notificationCommands.ts b/src/vs/workbench/browser/parts/notifications/notificationCommands.ts index 35b37da2af5..4754b2fe50f 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationCommands.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationCommands.ts @@ -148,11 +148,7 @@ export function registerNotificationCommands(center: INotificationsCenterControl handler: accessor => { const notification = center.selected; if (notification) { - if (notification.expanded) { - notification.collapse(); - } else { - notification.expand(); - } + notification.toggle(); } } }); diff --git a/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts b/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts index 5f64c846c51..67e719c6d86 100644 --- a/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts +++ b/src/vs/workbench/browser/parts/notifications/notificationsCenter.ts @@ -135,6 +135,11 @@ export class NotificationsCenter extends Themable { ); this.toUnbind.push(this.list); + this.toUnbind.push(this.list.onMouseDblClick(event => { + const item = event.element; + item.toggle(); + })); + // Context key NotificationsCenterFocusedContext.bindTo(this.list.contextKeyService); diff --git a/src/vs/workbench/common/notifications.ts b/src/vs/workbench/common/notifications.ts index d6085d2948b..0d9492eef09 100644 --- a/src/vs/workbench/common/notifications.ts +++ b/src/vs/workbench/common/notifications.ts @@ -152,6 +152,7 @@ export interface INotificationViewItem { expand(): void; collapse(): void; + toggle(): void; dispose(): void; @@ -276,6 +277,14 @@ export class NotificationViewItem implements INotificationViewItem { this._onDidChange.fire(); } + public toggle(): void { + if (this._expanded) { + this.collapse(); + } else { + this.expand(); + } + } + public dispose(): void { this._onDidDispose.fire(); -- GitLab