Skip to content

Commit

Permalink
fix CI build
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Sep 12, 2019
1 parent dff8292 commit c70d6a3
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 36 deletions.
49 changes: 49 additions & 0 deletions packages/core/src/browser/frontend-application-bindings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/********************************************************************************
* Copyright (C) 2019 TypeFox and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import { interfaces } from 'inversify';
import { bindContributionProvider, DefaultResourceProvider, MessageClient, MessageService, ResourceProvider, ResourceResolver } from '../common';
import {
bindPreferenceSchemaProvider, PreferenceProvider,
PreferenceProviderProvider, PreferenceSchemaProvider, PreferenceScope,
PreferenceService, PreferenceServiceImpl
} from './preferences';

export function bindMessageService(bind: interfaces.Bind): interfaces.BindingWhenOnSyntax<MessageService> {
bind(MessageClient).toSelf().inSingletonScope();
return bind(MessageService).toSelf().inSingletonScope();
}

export function bindPreferenceService(bind: interfaces.Bind): void {
bind(PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(PreferenceScope.User);
bind(PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(PreferenceScope.Workspace);
bind(PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(PreferenceScope.Folder);
bind(PreferenceProviderProvider).toFactory(ctx => (scope: PreferenceScope) => {
if (scope === PreferenceScope.Default) {
return ctx.container.get(PreferenceSchemaProvider);
}
return ctx.container.getNamed(PreferenceProvider, scope);
});
bind(PreferenceServiceImpl).toSelf().inSingletonScope();
bind(PreferenceService).toService(PreferenceServiceImpl);
bindPreferenceSchemaProvider(bind);
}

export function bindResourceProvider(bind: interfaces.Bind): void {
bind(DefaultResourceProvider).toSelf().inSingletonScope();
bind(ResourceProvider).toProvider(context => uri => context.container.get(DefaultResourceProvider).get(uri));
bindContributionProvider(bind, ResourceResolver);
}
40 changes: 7 additions & 33 deletions packages/core/src/browser/frontend-application-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
********************************************************************************/

import '../../src/browser/style/index.css';
require('../../src/browser/style/materialcolors.css').use();
import 'font-awesome/css/font-awesome.min.css';
import 'file-icons-js/css/style.css';

import { ContainerModule, interfaces } from 'inversify';
import { ContainerModule } from 'inversify';
import {
bindContributionProvider,
SelectionService,
ResourceProvider, ResourceResolver, DefaultResourceProvider,
ResourceResolver,
CommandContribution, CommandRegistry, CommandService, commandServicePath,
MenuModelRegistry, MenuContribution,
MessageService,
MessageClient,
InMemoryResources,
messageServicePath
Expand All @@ -51,10 +51,7 @@ import {
import { StatusBar, StatusBarImpl } from './status-bar/status-bar';
import { LabelParser } from './label-parser';
import { LabelProvider, LabelProviderContribution, DefaultUriLabelProviderContribution } from './label-provider';
import {
PreferenceProviderProvider, PreferenceProvider, PreferenceScope, PreferenceService,
PreferenceServiceImpl, bindPreferenceSchemaProvider, PreferenceSchemaProvider
} from './preferences';
import { PreferenceService } from './preferences';
import { ContextMenuRenderer } from './context-menu-renderer';
import { ThemingCommandContribution, ThemeService, BuiltinThemeProvider } from './theming';
import { ConnectionStatusService, FrontendConnectionStatusService, ApplicationConnectionStatusContribution, PingService } from './connection-status-service';
Expand Down Expand Up @@ -85,6 +82,9 @@ import { DispatchingProgressClient } from './progress-client';
import { ProgressStatusBarItem } from './progress-status-bar-item';
import { TabBarDecoratorService, TabBarDecorator } from './shell/tab-bar-decorator';
import { ContextMenuContext } from './menu/context-menu-context';
import { bindResourceProvider, bindMessageService, bindPreferenceService } from './frontend-application-bindings';

export { bindResourceProvider, bindMessageService, bindPreferenceService };

export const frontendApplicationModule = new ContainerModule((bind, unbind, isBound, rebind) => {
const themeService = ThemeService.get();
Expand Down Expand Up @@ -287,29 +287,3 @@ export const frontendApplicationModule = new ContainerModule((bind, unbind, isBo

bind(ContextMenuContext).toSelf().inSingletonScope();
});

export function bindMessageService(bind: interfaces.Bind): interfaces.BindingWhenOnSyntax<MessageService> {
bind(MessageClient).toSelf().inSingletonScope();
return bind(MessageService).toSelf().inSingletonScope();
}

export function bindPreferenceService(bind: interfaces.Bind): void {
bind(PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(PreferenceScope.User);
bind(PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(PreferenceScope.Workspace);
bind(PreferenceProvider).toSelf().inSingletonScope().whenTargetNamed(PreferenceScope.Folder);
bind(PreferenceProviderProvider).toFactory(ctx => (scope: PreferenceScope) => {
if (scope === PreferenceScope.Default) {
return ctx.container.get(PreferenceSchemaProvider);
}
return ctx.container.getNamed(PreferenceProvider, scope);
});
bind(PreferenceServiceImpl).toSelf().inSingletonScope();
bind(PreferenceService).toService(PreferenceServiceImpl);
bindPreferenceSchemaProvider(bind);
}

export function bindResourceProvider(bind: interfaces.Bind): void {
bind(DefaultResourceProvider).toSelf().inSingletonScope();
bind(ResourceProvider).toProvider(context => uri => context.container.get(DefaultResourceProvider).get(uri));
bindContributionProvider(bind, ResourceResolver);
}
2 changes: 0 additions & 2 deletions packages/core/src/browser/theming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import { FrontendApplicationConfigProvider } from './frontend-application-config
import { MenuContribution, MenuModelRegistry } from '../common/';
import { CommonMenus } from './common-frontend-contribution';

require('../../src/browser/style/materialcolors.css').use();

export const ThemeServiceSymbol = Symbol('ThemeService');

export interface Theme {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Container } from 'inversify';
import { FileUri } from '@theia/core/lib/node/file-uri';
import { DisposableCollection, Disposable } from '@theia/core/lib/common/disposable';
import { PreferenceService, PreferenceServiceImpl, PreferenceScope } from '@theia/core/lib/browser/preferences/preference-service';
import { bindPreferenceService, bindMessageService, bindResourceProvider } from '@theia/core/lib/browser/frontend-application-module';
import { bindPreferenceService, bindMessageService, bindResourceProvider } from '@theia/core/lib/browser/frontend-application-bindings';
import { bindFileSystem } from '@theia/filesystem/lib/node/filesystem-backend-module';
import { bindFileResource } from '@theia/filesystem/lib/browser/filesystem-frontend-module';
import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
Expand Down

0 comments on commit c70d6a3

Please sign in to comment.