Skip to content

Commit

Permalink
Add model resources action (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
haydar-metin authored Oct 19, 2024
1 parent 1ae27fc commit 4308c5d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
37 changes: 37 additions & 0 deletions client/packages/uml-protocol/src/action-protocol/model.action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*********************************************************************************
* Copyright (c) 2023 borkdominik and others.
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*********************************************************************************/

import { Action, RequestAction, ResponseAction } from '@eclipse-glsp/protocol';

export interface RequestModelResourcesAction extends RequestAction<ModelResourcesResponseAction> {
kind: typeof RequestModelResourcesAction.KIND;
}
export namespace RequestModelResourcesAction {
export const KIND = 'requestModelResources';

export function create(): RequestModelResourcesAction {
return {
kind: KIND,
requestId: RequestAction.generateRequestId()
};
}
}

export interface ModelResourcesResponseAction extends ResponseAction {
kind: typeof ModelResourcesResponseAction.KIND;
resources: Record<string, string>;
}

export namespace ModelResourcesResponseAction {
export const KIND = 'modelResourcesResponse';

export function is(action: unknown): action is ModelResourcesResponseAction {
return Action.hasKind(action, KIND);
}
}
1 change: 1 addition & 0 deletions client/packages/uml-protocol/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
export * from './action-protocol/autocomplete.action';
export * from './action-protocol/editor.actions';
export * from './action-protocol/minimap.action';
export * from './action-protocol/model.action';
export * from './action-protocol/new-file.action';
export * from './action-protocol/outline.action';
export * from './action-protocol/outline.model';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { createUMLDiagramContainer } from '@borkdominik-biguml/uml-glsp/lib';

import '@eclipse-glsp/vscode-integration-webview/css/glsp-vscode.css';

import { GLSPIsReadyAction, MinimapExportSvgAction } from '@borkdominik-biguml/uml-protocol';
import { GLSPIsReadyAction, MinimapExportSvgAction, ModelResourcesResponseAction } from '@borkdominik-biguml/uml-protocol';
import { IActionDispatcher, IDiagramStartup, InitializeCanvasBoundsAction, TYPES } from '@eclipse-glsp/client';
import { ContainerConfiguration, MaybePromise, SetViewportAction, bindAsService, bindOrRebind } from '@eclipse-glsp/protocol';
import { GLSPStarter } from '@eclipse-glsp/vscode-integration-webview';
Expand All @@ -32,6 +32,7 @@ class UMLStarter extends GLSPStarter {
bindOrRebind(container, GLSPDiagramWidget).toService(UMLDiagramWidget);
container.bind(ExtensionActionKind).toConstantValue(GLSPIsReadyAction.KIND);
container.bind(ExtensionActionKind).toConstantValue(MinimapExportSvgAction.KIND);
container.bind(ExtensionActionKind).toConstantValue(ModelResourcesResponseAction.KIND);
container.bind(ExtensionActionKind).toConstantValue(SetViewportAction.KIND); // necessary to have it in the provider loop
container.bind(ExtensionActionKind).toConstantValue(InitializeCanvasBoundsAction.KIND); // necessary to have it in the provider loop
bindAsService(container, TYPES.IDiagramStartup, GLSPReadyStartup);
Expand Down

0 comments on commit 4308c5d

Please sign in to comment.