import * as vscode from 'vscode' ; import { DependenciesTreeNode } from '../treeDataProviders/dependenciesTree/dependenciesTreeNode' ; import { FilterManager } from './filterManager' ; see FilterManager export abstract class AbstractFilter { protected _choice : vscode . QuickPickItem [ ] | undefined ; /**
     * Get all filter values
     */ protected abstract getValues ( ) ; param dependenciesTreeNode public abstract isNodePicked ( dependenciesTreeNode ) ; public showFilterMenu ( filterManager ) { let quickPick = vscode . window . createQuickPick ( ) ; quickPick . items = this . getValues ( ) ; quickPick . selectedItems = quickPick . items . filter ( item => this . isPicked ( item . label ) ) ; quickPick . canSelectMany = true ; quickPick . onDidChangeSelection ( items => { this . _choice = items ; filterManager . applyFilters ( ) ; } ) ; quickPick . onDidAccept ( ( ) => quickPick . hide ( ) ) ; quickPick . onDidHide ( ( ) => quickPick . dispose ( ) ) ; quickPick . show ( ) ; } public get choice ( ) { return this . _choice ; } public clearFilters ( ) { this . _choice = undefined ; } public isPicked ( item ) { return ! this . choice || this . choice . map ( choice => choice . label ) . some ( label => label === item ) ; } }