How to use the sprotty/lib.TYPES.IActionDispatcher 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 theia-ide / yangster / theia-yang-extension / src / frontend / diagram / theia-diagram-server.ts View on Github external
    constructor(@inject(TYPES.IActionDispatcher) public actionDispatcher: IActionDispatcher,
                @inject(TYPES.ActionHandlerRegistry) actionHandlerRegistry: ActionHandlerRegistry,
                @inject(TYPES.ViewerOptions) viewerOptions: ViewerOptions,
                @inject(TYPES.SModelStorage) storage: SModelStorage,
                @inject(TYPES.ILogger) logger: ILogger) {
        super(actionDispatcher, actionHandlerRegistry, viewerOptions, storage, logger)
        this.waitForConnector()
    }
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / tool-palette / tool-palette.ts View on Github external
IActionHandler,
    ICommand,
    SetUIExtensionVisibilityAction,
    SModelRoot,
    TYPES
} from "sprotty/lib";

import { isSetOperationsAction, Operation, parentGroup } from "../operation/set-operations";
import { deriveToolId } from "../tools/creation-tool";
import { MouseDeleteTool } from "../tools/delete-tool";
import { RequestMarkersAction } from "../validation/validate";

const CLICKED_CSS_CLASS = "clicked";
@injectable()
export class ToolPalette extends AbstractUIExtension {
    @inject(TYPES.IActionDispatcher) protected readonly actionDispatcher: IActionDispatcher;
    static readonly ID = "glsp_tool_palette";

    readonly id = ToolPalette.ID;
    readonly containerClass = "tool-palette";
    protected operations: Operation[];
    protected lastActivebutton?: HTMLElement;
    protected defaultToolsButton: HTMLElement;
    modelRootId: string;


    initialize() {
        if (!this.operations) {
            return false;
        }
        return super.initialize();
    }
github eclipsesource / graphical-lsp / client / packages / sprotty-client / src / features / request-response / support.ts View on Github external
* https://www.gnu.org/software/classpath/license.html.
 *
 * 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 / glsp-sprotty / src / features / tools / resize-tool.ts View on Github external
constructor(@inject(MouseTool) protected mouseTool: MouseTool,
        @inject(KeyTool) protected keyTool: KeyTool,
        @inject(TYPES.IActionDispatcher) protected actionDispatcher: ActionDispatcher) { }
github eclipsesource / graphical-lsp / client / chillisp-client-extension / src / browser / diagram-server.ts View on Github external
    constructor(@inject(TYPES.IActionDispatcher) public actionDispatcher: IActionDispatcher,
        @inject(TYPES.ActionHandlerRegistry) actionHandlerRegistry: ActionHandlerRegistry,
        @inject(TYPES.ViewerOptions) viewerOptions: ViewerOptions,
        @inject(TYPES.SModelStorage) storage: SModelStorage,
        @inject(TYPES.ILogger) logger: ILogger) {
        super(actionDispatcher, actionHandlerRegistry, viewerOptions, storage, logger)
    }
github theia-ide / theia-sprotty-example / theia-dsl-extension / src / browser / diagram / theia-diagram-server.ts View on Github external
    constructor(@inject(TYPES.IActionDispatcher) public actionDispatcher: IActionDispatcher,
                @inject(TYPES.ActionHandlerRegistry) actionHandlerRegistry: ActionHandlerRegistry,
                @inject(TYPES.ViewerOptions) viewerOptions: ViewerOptions,
                @inject(TYPES.SModelStorage) storage: SModelStorage,
                @inject(TYPES.ILogger) logger: ILogger) {
        super(actionDispatcher, actionHandlerRegistry, viewerOptions, storage, logger)
    }
github eclipsesource / graphical-lsp / client / examples / workflow-glsp-extension / src / browser / workflow-diagram-manager.ts View on Github external
protected createDiagramWidget(uri: URI): DiagramWidget {
        const widgetId = this.widgetRegistry.nextId()
        const svgContainerId = widgetId + '_sprotty'
        const diagramConfiguration = this.diagramConfigurationRegistry.get(this.diagramType)
        const diContainer = diagramConfiguration.createContainer(svgContainerId)
        const modelSource = diContainer.get(TYPES.ModelSource)
        if (modelSource instanceof DiagramServer)
            modelSource.clientId = widgetId
        if (modelSource instanceof TheiaLSPDiagramServer && this.diagramConnector)
            this.diagramConnector.connect(modelSource)
        else if (modelSource instanceof TheiaWebsocketDiagramServer) {
            modelSource.listen(this.glspClient.webSocket)
        }
        const newWidget = this.diagramWidgetFactory({
            id: widgetId, svgContainerId, uri, diagramType: this.diagramType, modelSource,
            actionDispatcher: diContainer.get(TYPES.IActionDispatcher)
        })
        newWidget.title.closable = true
        newWidget.title.label = uri.path.base
        newWidget.title.icon = this.iconClass
        this.widgetRegistry.addWidget(uri, this.diagramType, newWidget)
        newWidget.disposed.connect(() => {
            this.widgetRegistry.removeWidget(uri, this.diagramType)
            if (modelSource instanceof TheiaLSPDiagramServer && this.diagramConnector)
                this.diagramConnector.disconnect(modelSource)
        })
        return newWidget


    }