1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { injectable, inject, named } from 'inversify';
|
18 | import { FrontendApplicationContribution } from './frontend-application';
|
19 | import { ContributionProvider } from '../common/contribution-provider';
|
20 | import { IconThemeService, IconTheme } from './icon-theme-service';
|
21 | import { MaybePromise } from '../common/types';
|
22 | import { Disposable } from '../common/disposable';
|
23 |
|
24 | export const IconThemeContribution = Symbol('IconThemeContribution');
|
25 | export interface IconThemeContribution {
|
26 | registerIconThemes(iconThemes: IconThemeService): MaybePromise<void>;
|
27 | }
|
28 |
|
29 | @injectable()
|
30 | export class IconThemeApplicationContribution implements FrontendApplicationContribution {
|
31 |
|
32 | @inject(IconThemeService)
|
33 | protected readonly iconThemes: IconThemeService;
|
34 |
|
35 | @inject(ContributionProvider) @named(IconThemeContribution)
|
36 | protected readonly iconThemeContributions: ContributionProvider<IconThemeContribution>;
|
37 |
|
38 | async onStart(): Promise<void> {
|
39 | for (const contribution of this.iconThemeContributions.getContributions()) {
|
40 | await contribution.registerIconThemes(this.iconThemes);
|
41 | }
|
42 | }
|
43 |
|
44 | }
|
45 |
|
46 | @injectable()
|
47 | export class DefaultFileIconThemeContribution implements IconTheme, IconThemeContribution {
|
48 |
|
49 | readonly id = 'theia-file-icons';
|
50 | readonly label = 'File Icons (Theia)';
|
51 | readonly hasFileIcons = true;
|
52 | readonly hasFolderIcons = true;
|
53 |
|
54 | registerIconThemes(iconThemes: IconThemeService): MaybePromise<void> {
|
55 | iconThemes.register(this);
|
56 | }
|
57 |
|
58 |
|
59 | activate(): Disposable {
|
60 | return Disposable.NULL;
|
61 | }
|
62 |
|
63 | }
|