How to use the @theia/core/lib/browser.bindViewContribution function in @theia/core

To help you get started, we’ve selected a few @theia/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / search-in-workspace / src / browser / search-in-workspace-frontend-module.ts View on Github external
export default new ContainerModule(bind => {
    bind(SearchInWorkspaceContextKeyService).toSelf().inSingletonScope();

    bind(SearchInWorkspaceWidget).toSelf();
    bind(WidgetFactory).toDynamicValue(ctx => ({
        id: SearchInWorkspaceWidget.ID,
        createWidget: () => ctx.container.get(SearchInWorkspaceWidget)
    }));
    bind(SearchInWorkspaceResultTreeWidget).toDynamicValue(ctx => createSearchTreeWidget(ctx.container));

    bindViewContribution(bind, SearchInWorkspaceFrontendContribution);
    bind(FrontendApplicationContribution).toService(SearchInWorkspaceFrontendContribution);
    bind(TabBarToolbarContribution).toService(SearchInWorkspaceFrontendContribution);

    // The object that gets notified of search results.
    bind(SearchInWorkspaceClientImpl).toSelf().inSingletonScope();

    bind(SearchInWorkspaceService).toSelf().inSingletonScope();

    // The object to call methods on the backend.
    bind(SearchInWorkspaceServer).toDynamicValue(ctx => {
        const client = ctx.container.get(SearchInWorkspaceClientImpl);
        return WebSocketConnectionProvider.createProxy(ctx.container, SIW_WS_PATH, client);
    }).inSingletonScope();

    bind(InMemoryTextResourceResolver).toSelf().inSingletonScope();
    bind(ResourceResolver).toService(InMemoryTextResourceResolver);
github eclipse-theia / theia / packages / debug / src / browser / console / debug-console-contribution.tsx View on Github external
static bindContribution(bind: interfaces.Bind): void {
        bind(InDebugReplContextKey).toDynamicValue(({ container }) =>
            container.get(ContextKeyService).createKey('inDebugRepl', false)
        ).inSingletonScope();
        bind(DebugConsoleSession).toSelf().inSingletonScope();
        bindViewContribution(bind, DebugConsoleContribution).onActivation((context, _) => {
            // eagerly initialize the debug console session
            context.container.get(DebugConsoleSession);
            return _;
        });
        bind(TabBarToolbarContribution).toService(DebugConsoleContribution);
        bind(WidgetFactory).toDynamicValue(({ container }) => ({
            id: DebugConsoleContribution.options.id,
            createWidget: () => DebugConsoleContribution.create(container)
        }));
    }
github eclipse-theia / theia / packages / output / src / browser / output-frontend-module.ts View on Github external
export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => {
    bindOutputPreferences(bind);
    bind(OutputWidget).toSelf();
    bind(OutputChannelManager).toSelf().inSingletonScope();

    bind(WidgetFactory).toDynamicValue(context => ({
        id: OUTPUT_WIDGET_KIND,
        createWidget: () => context.container.get(OutputWidget)
    }));

    bindViewContribution(bind, OutputContribution);
    bind(OutputToolbarContribution).toSelf().inSingletonScope();
    bind(TabBarToolbarContribution).toService(OutputToolbarContribution);
});
github eclipse-theia / theia / packages / plugin-ext / src / main / browser / plugin-ext-frontend-module.ts View on Github external
onStart(app: FrontendApplication): MaybePromise {
            ctx.container.get(HostedPluginSupport).onStart(ctx.container);
        }
    }));
    bind(HostedPluginServer).toDynamicValue(ctx => {
        const connection = ctx.container.get(WebSocketConnectionProvider);
        const hostedWatcher = ctx.container.get(HostedPluginWatcher);
        return connection.createProxy(hostedServicePath, hostedWatcher.getHostedPluginClient());
    }).inSingletonScope();

    bind(PluginPathsService).toDynamicValue(ctx => {
        const connection = ctx.container.get(WebSocketConnectionProvider);
        return connection.createProxy(pluginPathsServicePath);
    }).inSingletonScope();

    bindViewContribution(bind, PluginFrontendViewContribution);

    bind(PluginWidget).toSelf();
    bind(WidgetFactory).toDynamicValue(ctx => ({
        id: PluginFrontendViewContribution.PLUGINS_WIDGET_FACTORY_ID,
        createWidget: () => ctx.container.get(PluginWidget)
    }));

    bind(PluginExtDeployCommandService).toSelf().inSingletonScope();
    bind(PluginServer).toDynamicValue(ctx => {
        const provider = ctx.container.get(WebSocketConnectionProvider);
        return provider.createProxy(pluginServerJsonRpcPath);
    }).inSingletonScope();

    bind(ViewContextKeyService).toSelf().inSingletonScope();

    bind(PluginTreeViewNodeLabelProvider).toSelf().inSingletonScope();
github eclipse-theia / theia / packages / callhierarchy / src / browser / callhierarchy-frontend-module.ts View on Github external
export default new ContainerModule(bind => {
    bind(CurrentEditorAccess).toSelf().inSingletonScope();

    bindContributionProvider(bind, CallHierarchyService);
    bind(CallHierarchyServiceProvider).to(CallHierarchyServiceProvider).inSingletonScope();

    bindViewContribution(bind, CallHierarchyContribution);

    bind(WidgetFactory).toDynamicValue(context => ({
        id: CALLHIERARCHY_ID,
        createWidget: () => createHierarchyTreeWidget(context.container)
    }));
});
github eclipse-theia / theia / packages / markers / src / browser / problem / problem-frontend-module.ts View on Github external
export default new ContainerModule(bind => {
    bindProblemPreferences(bind);

    bind(ProblemManager).toSelf().inSingletonScope();

    bind(ProblemWidget).toDynamicValue(ctx =>
        createProblemWidget(ctx.container)
    );
    bind(WidgetFactory).toDynamicValue(context => ({
        id: PROBLEMS_WIDGET_ID,
        createWidget: () => context.container.get(ProblemWidget)
    }));
    bind(ApplicationShellLayoutMigration).to(ProblemLayoutVersion3Migration).inSingletonScope();

    bindViewContribution(bind, ProblemContribution);
    bind(FrontendApplicationContribution).toService(ProblemContribution);
    bind(TabBarToolbarContribution).toService(ProblemContribution);

    bind(ProblemDecorator).toSelf().inSingletonScope();
    bind(NavigatorTreeDecorator).toService(ProblemDecorator);
    bind(ProblemTabBarDecorator).toSelf().inSingletonScope();
    bind(TabBarDecorator).toService(ProblemTabBarDecorator);

    bind(MarkerTreeLabelProvider).toSelf().inSingletonScope();
    bind(LabelProviderContribution).toService(MarkerTreeLabelProvider);
});
github eclipse-theia / theia / packages / extension-manager / src / browser / extension-frontend-module.ts View on Github external
export default new ContainerModule(bind => {
    bind(ExtensionServer).toDynamicValue(ctx => {
        const provider = ctx.container.get(WebSocketConnectionProvider);
        return provider.createProxy(extensionPath);
    }).inSingletonScope();
    bind(ExtensionManager).toSelf().inSingletonScope();

    bindViewContribution(bind, ExtensionContribution);

    bind(ExtensionWidget).toSelf();
    bind(WidgetFactory).toDynamicValue(ctx => ({
        id: EXTENSIONS_WIDGET_FACTORY_ID,
        createWidget: () => ctx.container.get(ExtensionWidget)
    }));

    bind(ExtensionWidgetFactory).toSelf().inSingletonScope();
    bind(WidgetFactory).toService(ExtensionWidgetFactory);

    bind(ExtensionOpenHandler).toSelf().inSingletonScope();
    bind(OpenHandler).toService(ExtensionOpenHandler);
});
github eclipse-theia / theia / packages / git / src / browser / diff / git-diff-frontend-module.ts View on Github external
export function bindGitDiffModule(bind: interfaces.Bind): void {

    bind(GitDiffWidget).toSelf();
    bind(WidgetFactory).toDynamicValue(ctx => ({
        id: GIT_DIFF,
        createWidget: () => ctx.container.get(GitDiffWidget)
    }));

    bindViewContribution(bind, GitDiffContribution);
    bind(TabBarToolbarContribution).toService(GitDiffContribution);

}
github eclipse-theia / theia / packages / scm / src / browser / scm-frontend-module.ts View on Github external
id: SCM_VIEW_CONTAINER_ID,
                progressLocationId: 'scm'
            });
            viewContainer.setTitleOptions(SCM_VIEW_CONTAINER_TITLE_OPTIONS);
            const widget = await container.get(WidgetManager).getOrCreateWidget(SCM_WIDGET_FACTORY_ID);
            viewContainer.addWidget(widget, {
                canHide: false,
                initiallyCollapsed: false
            });
            return viewContainer;
        }
    })).inSingletonScope();
    bind(ApplicationShellLayoutMigration).to(ScmLayoutVersion3Migration).inSingletonScope();

    bind(ScmQuickOpenService).toSelf().inSingletonScope();
    bindViewContribution(bind, ScmContribution);
    bind(FrontendApplicationContribution).toService(ScmContribution);
    bind(ColorContribution).toService(ScmContribution);

    bind(NavigatorTreeDecorator).to(ScmNavigatorDecorator).inSingletonScope();
    bind(ScmDecorationsService).toSelf().inSingletonScope();

    bind(ScmAvatarService).toSelf().inSingletonScope();

    bindDirtyDiff(bind);
});
github eclipse-theia / theia / packages / plugin-ext / src / main / browser / plugin-ext-frontend-module.ts View on Github external
ctx.container.get(HostedPluginSupport).checkAndLoadPlugin(ctx.container);
        }
    }));
    bind(HostedPluginServer).toDynamicValue(ctx => {
        const connection = ctx.container.get(WebSocketConnectionProvider);
        const hostedWatcher = ctx.container.get(HostedPluginWatcher);
        return connection.createProxy(hostedServicePath, hostedWatcher.getHostedPluginClient());
    }).inSingletonScope();

    bind(PluginPathsService).toDynamicValue(ctx => {
        const connection = ctx.container.get(WebSocketConnectionProvider);
        return connection.createProxy(pluginPathsServicePath);
    }).inSingletonScope();
    bind(StoragePathService).toSelf().inSingletonScope();

    bindViewContribution(bind, PluginFrontendViewContribution);

    bind(PluginWidget).toSelf();
    bind(WidgetFactory).toDynamicValue(ctx => ({
        id: PluginFrontendViewContribution.PLUGINS_WIDGET_FACTORY_ID,
        createWidget: () => ctx.container.get(PluginWidget)
    }));

    bind(PluginExtDeployCommandService).toSelf().inSingletonScope();
    bind(PluginServer).toDynamicValue(ctx => {
        const provider = ctx.container.get(WebSocketConnectionProvider);
        return provider.createProxy(pluginServerJsonRpcPath);
    }).inSingletonScope();

    bind(ViewRegistry).toSelf().inSingletonScope();
    bind(MenusContributionPointHandler).toSelf().inSingletonScope();