Skip to content

Commit

Permalink
GH-1155: Added support to handle the connection issues gracefully.
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <kittaakos@gmail.com>
  • Loading branch information
kittaakos committed Feb 5, 2018
1 parent 6ed692a commit e2d95ce
Show file tree
Hide file tree
Showing 6 changed files with 550 additions and 2 deletions.
24 changes: 22 additions & 2 deletions packages/core/src/browser/frontend-application-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
MessageService,
MessageClient
} from "../common";
import { FrontendApplication, FrontendApplicationContribution } from './frontend-application';
import { FrontendApplication, FrontendApplicationContribution, DefaultFrontendApplicationContribution } from './frontend-application';
import { DefaultOpenerService, OpenerService, OpenHandler } from './opener-service';
import { HttpOpenHandler } from './http-open-handler';
import { CommonFrontendContribution } from './common-frontend-contribution';
Expand All @@ -32,14 +32,22 @@ import {
import { StatusBar, StatusBarImpl } from "./status-bar/status-bar";
import { LabelParser } from './label-parser';
import { LabelProvider, LabelProviderContribution, DefaultUriLabelProviderContribution } from "./label-provider";
import { ThemingCommandContribution, ThemeService } from './theming';
import {
FrontendConnectionStatusService,
ApplicationConnectionStatusContribution,
ConnectionStatusStatusBarContribution,
ConnectionStatusService
} from './frontend-connection-status';
import { FrontendIdleService, DefaultFrontendIdleService } from './frontend-idle-status';

import '../../src/browser/style/index.css';
import 'font-awesome/css/font-awesome.min.css';
import "file-icons-js/css/style.css";
import { ThemingCommandContribution, ThemeService } from './theming';

export const frontendApplicationModule = new ContainerModule((bind, unbind, isBound, rebind) => {
bind(FrontendApplication).toSelf().inSingletonScope();
bind(DefaultFrontendApplicationContribution).toSelf();
bindContributionProvider(bind, FrontendApplicationContribution);

bind(ApplicationShellOptions).toConstantValue({});
Expand Down Expand Up @@ -108,6 +116,18 @@ export const frontendApplicationModule = new ContainerModule((bind, unbind, isBo
bind(LabelProviderContribution).to(DefaultUriLabelProviderContribution).inSingletonScope();

bind(CommandContribution).to(ThemingCommandContribution).inSingletonScope();

bind(DefaultFrontendIdleService).toSelf().inSingletonScope();
bind(FrontendIdleService).toDynamicValue(ctx => ctx.container.get(DefaultFrontendIdleService)).inSingletonScope();
bind(FrontendApplicationContribution).toDynamicValue(ctx => ctx.container.get(DefaultFrontendIdleService)).inSingletonScope();

bind(FrontendConnectionStatusService).toSelf().inSingletonScope();
bind(ConnectionStatusService).toDynamicValue(ctx => ctx.container.get(FrontendConnectionStatusService)).inSingletonScope();
bind(FrontendApplicationContribution).toDynamicValue(ctx => ctx.container.get(FrontendConnectionStatusService)).inSingletonScope();
bind(ApplicationConnectionStatusContribution).toSelf().inSingletonScope();
bind(FrontendApplicationContribution).toDynamicValue(ctx => ctx.container.get(ApplicationConnectionStatusContribution)).inSingletonScope();
bind(ConnectionStatusStatusBarContribution).toSelf().inSingletonScope();
bind(FrontendApplicationContribution).toDynamicValue(ctx => ctx.container.get(ConnectionStatusStatusBarContribution)).inSingletonScope();
});

const theme = ThemeService.get().getCurrentTheme().id;
Expand Down
13 changes: 13 additions & 0 deletions packages/core/src/browser/frontend-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ export interface FrontendApplicationContribution {
initializeLayout?(app: FrontendApplication): MaybePromise<void>;
}

/**
* Default frontend contribution that can be extended by clients if they do not want to implement any of the
* methods from the interface but still want to contribute to the frontend application.
*/
@injectable()
export abstract class DefaultFrontendApplicationContribution implements FrontendApplicationContribution {

initialize() {
// NOOP
}

}

@injectable()
export class FrontendApplication {

Expand Down
Loading

0 comments on commit e2d95ce

Please sign in to comment.