UNPKG

2.63 kBPlain TextView Raw
1// *****************************************************************************
2// Copyright (C) 2019 TypeFox and others.
3//
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License v. 2.0 which is available at
6// http://www.eclipse.org/legal/epl-2.0.
7//
8// This Source Code may also be made available under the following Secondary
9// Licenses when the conditions for such availability set forth in the Eclipse
10// Public License v. 2.0 are satisfied: GNU General Public License, version 2
11// with the GNU Classpath Exception which is available at
12// https://www.gnu.org/software/classpath/license.html.
13//
14// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15// *****************************************************************************
16
17import { TreeImpl, Tree } from '../tree';
18import { TreeModel, TreeModelImpl } from '../tree-model';
19import { Container } from 'inversify';
20import { TreeSelectionServiceImpl } from '../tree-selection-impl';
21import { TreeSelectionService } from '../tree-selection';
22import { TreeExpansionServiceImpl, TreeExpansionService } from '../tree-expansion';
23import { TreeNavigationService } from '../tree-navigation';
24import { TreeSearch } from '../tree-search';
25import { FuzzySearch } from '../fuzzy-search';
26import { MockLogger } from '../../../common/test/mock-logger';
27import { ILogger, bindContributionProvider } from '../../../common';
28import { LabelProviderContribution, LabelProvider } from '../../label-provider';
29import { TreeFocusService, TreeFocusServiceImpl } from '../tree-focus-service';
30
31export function createTreeTestContainer(): Container {
32 const container = new Container({ defaultScope: 'Singleton' });
33 container.bind(TreeImpl).toSelf();
34 container.bind(Tree).toService(TreeImpl);
35 container.bind(TreeSelectionServiceImpl).toSelf();
36 container.bind(TreeSelectionService).toService(TreeSelectionServiceImpl);
37 container.bind(TreeExpansionServiceImpl).toSelf();
38 container.bind(TreeExpansionService).toService(TreeExpansionServiceImpl);
39 container.bind(TreeNavigationService).toSelf();
40 container.bind(TreeModelImpl).toSelf();
41 container.bind(TreeModel).toService(TreeModelImpl);
42 container.bind(TreeSearch).toSelf();
43 container.bind(FuzzySearch).toSelf();
44 container.bind(MockLogger).toSelf();
45 container.bind(TreeFocusService).to(TreeFocusServiceImpl);
46 container.bind(ILogger).to(MockLogger);
47 bindContributionProvider(container, LabelProviderContribution);
48 container.bind(LabelProvider).toSelf().inSingletonScope();
49 return container;
50}