From 4cd73ef2dd3ac3153c19c7a37713b670f5ea05f9 Mon Sep 17 00:00:00 2001 From: Anas Shahid Date: Fri, 12 Jun 2020 15:28:43 -0400 Subject: [PATCH] [problems] Implemented clear-all in problems view. Fixes: https://github.com/eclipse-theia/theia/issues/7979 Added a `Clear-All` toolbar item, which clears all the existing problem markers Signed-off-by: Anas Shahid --- .../src/browser/problem/problem-contribution.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/markers/src/browser/problem/problem-contribution.ts b/packages/markers/src/browser/problem/problem-contribution.ts index a69103d1f06c7..0b83984d446ac 100644 --- a/packages/markers/src/browser/problem/problem-contribution.ts +++ b/packages/markers/src/browser/problem/problem-contribution.ts @@ -49,6 +49,12 @@ export namespace ProblemsCommands { export const COPY_MESSAGE: Command = { id: 'problems.copy.message', }; + export const CLEAR_ALL: Command = { + id: 'problems.clear.all', + category: 'Problems', + label: 'Clear All', + iconClass: 'clear-all' + }; } @injectable() @@ -145,6 +151,11 @@ export class ProblemContribution extends AbstractViewContribution execute: selection => this.copyMessage(selection) }) ); + commands.registerCommand(ProblemsCommands.CLEAR_ALL, { + isEnabled: widget => this.withWidget(widget, () => true), + isVisible: widget => this.withWidget(widget, () => true), + execute: widget => this.withWidget(widget, () => this.problemManager.cleanAllMarkers()) + }); } registerMenus(menus: MenuModelRegistry): void { @@ -173,6 +184,12 @@ export class ProblemContribution extends AbstractViewContribution tooltip: 'Collapse All', priority: 0, }); + toolbarRegistry.registerItem({ + id: ProblemsCommands.CLEAR_ALL.id, + command: ProblemsCommands.CLEAR_ALL.id, + tooltip: 'Clear All', + priority: 1, + }); } protected async collapseAllProblems(): Promise {