Skip to content

Commit

Permalink
[problems] Implemented clear-all in problems view.
Browse files Browse the repository at this point in the history
Fixes: #7979

Added a `Clear-All` toolbar item, which clears all the existing problem
markers

Signed-off-by: Anas Shahid <[email protected]>
  • Loading branch information
Anas Shahid authored and kittaakos committed Jun 17, 2020
1 parent d58d1ba commit c1d11d0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/markers/src/browser/problem/problem-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -145,6 +151,11 @@ export class ProblemContribution extends AbstractViewContribution<ProblemWidget>
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 {
Expand Down Expand Up @@ -173,6 +184,12 @@ export class ProblemContribution extends AbstractViewContribution<ProblemWidget>
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<void> {
Expand Down

0 comments on commit c1d11d0

Please sign in to comment.