How to use the sprotty/lib.TYPES.ILogger function in sprotty

To help you get started, we’ve selected a few sprotty 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 eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / request-response / support.ts View on Github external
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 ********************************************************************************/
import { inject, injectable } from "inversify";
import { Action, ActionHandlerRegistry, IActionDispatcher, IActionHandlerInitializer, ILogger, TYPES } from "sprotty/lib";
import { v4 as uuid } from "uuid";

import { IdentifiableRequestAction, IdentifiableResponseAction, isIdentifiableResponseAction } from "./action-definitions";


@injectable()
export class RequestResponseSupport implements IActionHandlerInitializer {
    private requestedResponses = new Map();

    @inject(TYPES.IActionDispatcher) protected actionDispatcher: IActionDispatcher;
    @inject(TYPES.ActionHandlerRegistryProvider) protected registry: ActionHandlerRegistry;
    @inject(TYPES.ILogger) protected logger: ILogger;

    initialize(registry: ActionHandlerRegistry): void {
        registry.register(IdentifiableResponseAction.KIND, this);
    }

    handle(response: Action) {
        if (isIdentifiableResponseAction(response)) {
            const responseId = response.id;
            if (this.requestedResponses.has(responseId)) {
                this.requestedResponses.set(responseId, response.action);
            } else {
                this.logger.log(this, "[RequestResponse] " + responseId + ": Response without request, ignore.");
            }
        }
    }
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / tool-feedback / feedback-action-dispatcher.ts View on Github external
constructor(
        @inject(TYPES.IActionDispatcherProvider) protected actionDispatcher: () => Promise,
        @inject(TYPES.ILogger) protected logger: ILogger) {
    }
github theia-ide / theia-sprotty-example / theia-dsl-extension / src / browser / processor / di.config.ts View on Github external
const multicoreModule = new ContainerModule((bind, unbind, isBound, rebind) => {
    rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope()
    rebind(TYPES.LogLevel).toConstantValue(LogLevel.log)
    rebind(TYPES.IModelFactory).to(ChipModelFactory).inSingletonScope()
})
github eclipsesource / graphical-lsp / client / packages / glsp-sprotty / src / features / tool-palette / tool-palette.ts View on Github external
constructor(
        @inject(TYPES.ViewerOptions) protected options: ViewerOptions,
        @inject(TYPES.IActionDispatcherProvider) protected actionDispatcherProvider: IActionDispatcherProvider,
        @inject(TYPES.ILogger) protected logger: ILogger) {
        super(options, actionDispatcherProvider, logger);
    }
github TypeFox / npm-dependency-graph / depgraph-navigator / src / browser / graph / model-source.ts View on Github external
constructor(@inject(TYPES.IActionDispatcher) actionDispatcher: IActionDispatcher,
        @inject(TYPES.ActionHandlerRegistry) actionHandlerRegistry: ActionHandlerRegistry,
        @inject(TYPES.ViewerOptions) viewerOptions: ViewerOptions,
        @inject(IGraphGenerator) public readonly graphGenerator: IGraphGenerator,
        @inject(ElkGraphLayout) protected readonly elk: ElkGraphLayout,
        @inject(TYPES.ILogger) protected readonly logger: ILogger,
        @inject(TYPES.PopupModelFactory)@optional() popupModelFactory?: PopupModelFactory,
        @inject(TYPES.StateAwareModelProvider)@optional() modelProvider?: IStateAwareModelProvider
    ) {
        super(actionDispatcher, actionHandlerRegistry, viewerOptions, popupModelFactory, modelProvider);
        this.onModelSubmitted = (newRoot) => {
            if (this.loadIndicator) {
                this.loadIndicator(false);
            }
            const selection = this.pendingSelection;
            if (selection.length > 0) {
                this.actionDispatcher.dispatch(new SelectAction(selection));
                this.pendingSelection = [];
            }
            const center = this.pendingCenter;
            if (center.length > 0) {
                this.actionDispatcher.dispatch(new CenterAction(center));
github theia-ide / theia-sprotty-example / theia-dsl-extension / src / browser / flow / di.config.ts View on Github external
const flowModule = new ContainerModule((bind, unbind, isBound, rebind) => {
    rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope()
    rebind(TYPES.LogLevel).toConstantValue(LogLevel.log)
    rebind(TYPES.IModelFactory).to(FlowModelFactory).inSingletonScope()
})
github eclipsesource / graphical-lsp / client / packages / glsp-sprotty / src / base / model / update-model-command.ts View on Github external
constructor(@inject(TYPES.Action) action: UpdateModelAction,
        @inject(TYPES.ILogger) protected logger: ILogger,
        @inject(GLSP_TYPES.IFeedbackActionDispatcher) @optional() protected readonly feedbackActionDispatcher: IFeedbackActionDispatcher,
        @inject(TYPES.ActionHandlerRegistryProvider) protected actionHandlerRegistryProvider: () => Promise) {
        super(action);
    }
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / command-palette / command-palette.ts View on Github external
constructor(
        @inject(TYPES.ViewerOptions) protected options: ViewerOptions,
        @inject(TYPES.IActionDispatcherProvider) protected actionDispatcherProvider: IActionDispatcherProvider,
        @inject(GLSP_TYPES.ICommandPaletteActionProviderRegistry) protected actionProvider: ICommandPaletteActionProviderRegistry,
        @inject(TYPES.ILogger) protected logger: ILogger) {
        super(options, actionDispatcherProvider, logger);
    }
github eclipsesource / graphical-lsp / client / examples / theia-ecore / sprotty-ecore / src / di.config.ts View on Github external
const classDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) => {
        rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
        rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn);
        const context = { bind, unbind, isBound, rebind };
        configureModelElement(context, 'graph', EcoreGraph, SGraphView);
        configureModelElement(context, 'node:class', ClassNode, ClassNodeView);
        configureModelElement(context, 'node:enum', ClassNode, ClassNodeView);
        configureModelElement(context, 'node:datatype', ClassNode, ClassNodeView);
        configureModelElement(context, 'label:heading', SLabel, SLabelView);
        configureModelElement(context, 'node:attribute', SNode, RectangularNodeView);
        configureModelElement(context, 'node:enumliteral', SNode, RectangularNodeView);
        configureModelElement(context, 'node:operation', SNode, RectangularNodeView);
        configureModelElement(context, 'label:text', SLabel, SLabelView);
        configureModelElement(context, 'comp:comp', SCompartment, SCompartmentView);
        configureModelElement(context, 'comp:header', SCompartment, SCompartmentView);
        configureModelElement(context, 'icon', Icon, IconView);
        configureModelElement(context, 'label:icon', SLabel, SLabelView);
        configureModelElement(context, 'html', HtmlRoot, HtmlRootView);