From e22d16ccbd71fafb9f137ec09a258110fd354453 Mon Sep 17 00:00:00 2001 From: Tobias Ortmayr Date: Sat, 6 Jul 2024 10:49:48 +0200 Subject: [PATCH] GLSP-1362: Register `GLSPDiagramManagers` as open with handler (#223) Fixes https://github.com/eclipse-glsp/glsp/issues/1362 --- .github/workflows/theia-compat.yml | 2 +- README.md | 6 ++--- .../src/common/workflow-language.ts | 5 ++-- .../browser/diagram/glsp-diagram-manager.ts | 23 +++++++++++++++++-- .../browser/glsp-theia-container-module.ts | 8 ++++++- .../src/common/glsp-diagram-language.ts | 10 ++++++-- 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/.github/workflows/theia-compat.yml b/.github/workflows/theia-compat.yml index 1c2bc3cb..89fee479 100644 --- a/.github/workflows/theia-compat.yml +++ b/.github/workflows/theia-compat.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - theia_version: [1.45.1, 1.49.1, latest] + theia_version: [1.49.1, latest] steps: - uses: actions/checkout@v4.1.7 - uses: actions/setup-node@v4.0.2 diff --git a/README.md b/README.md index 965a80b9..26535928 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ For details on building the project, please see the [README file of the theia-in | 1.0.0-theia1.34.0 | >=1.34.0 < 1.39.0 | | 2.0.0 | >=1.39.0 < 1.45.0 | | 2.1.x | >=1.39.0 < 1.45.0 | -| 2.1.0-theia1.45.0 | >=1.45.0 < 1.50.0 | -| 2.1.0-theia1.50.0 | >=1.50.0 | -| next | >=1.50.0 | +| 2.1.0-theia1.45.0 | >=1.45.0 < 1.49.0 | +| 2.1.0-theia1.49.0 | >=1.49.0 | +| next | >=1.49.0 | > Note: For versions <=1.0.0 it is not possible to safely restrict the maximum version of Theia packages. If you encounter build errors related to multiple resolved Theia versions please add a resolutions block to the `package.json` of your project e.g. for `1.0.0-theia1.27.0`: diff --git a/examples/workflow-theia/src/common/workflow-language.ts b/examples/workflow-theia/src/common/workflow-language.ts index ee7da4f2..eae24aff 100644 --- a/examples/workflow-theia/src/common/workflow-language.ts +++ b/examples/workflow-theia/src/common/workflow-language.ts @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2019-2021 EclipseSource and others. + * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at @@ -17,7 +17,8 @@ import { GLSPDiagramLanguage } from '@eclipse-glsp/theia-integration/lib/common' export const WorkflowLanguage: GLSPDiagramLanguage = { contributionId: 'workflow', - label: 'Workflow Diagram', + label: 'Workflow Editor', + providerName: 'GLSP Diagram', diagramType: 'workflow-diagram', fileExtensions: ['.wf'], iconClass: 'codicon codicon-type-hierarchy-sub' diff --git a/packages/theia-integration/src/browser/diagram/glsp-diagram-manager.ts b/packages/theia-integration/src/browser/diagram/glsp-diagram-manager.ts index 5db7eb45..39098b2d 100644 --- a/packages/theia-integration/src/browser/diagram/glsp-diagram-manager.ts +++ b/packages/theia-integration/src/browser/diagram/glsp-diagram-manager.ts @@ -21,12 +21,14 @@ import { ApplicationShell, FrontendApplicationContribution, OpenHandler, + OpenWithHandler, + OpenWithService, WidgetFactory, WidgetOpenerOptions, WidgetOpenHandler } from '@theia/core/lib/browser'; import URI from '@theia/core/lib/common/uri'; -import { inject, injectable, interfaces } from '@theia/core/shared/inversify'; +import { inject, injectable, interfaces, postConstruct } from '@theia/core/shared/inversify'; import { EditorManager } from '@theia/editor/lib/browser'; import { DiagramServiceProvider } from '../diagram-service-provider'; import { TheiaOpenerOptionsNavigationService } from '../theia-opener-options-navigation-service'; @@ -48,7 +50,7 @@ export function registerDiagramManager( } @injectable() -export abstract class GLSPDiagramManager extends WidgetOpenHandler implements WidgetFactory { +export abstract class GLSPDiagramManager extends WidgetOpenHandler implements WidgetFactory, OpenWithHandler { @inject(TheiaOpenerOptionsNavigationService) protected readonly diagramNavigationService: TheiaOpenerOptionsNavigationService; @@ -61,6 +63,9 @@ export abstract class GLSPDiagramManager extends WidgetOpenHandler { const options: WidgetOpenerOptions = { mode: 'activate', @@ -170,6 +185,10 @@ export abstract class GLSPDiagramManager extends WidgetOpenHandler