@eclipse-glsp/theia-integration
Version:
Glue code to integrate GLSP clients into Eclipse Theia
60 lines • 2.83 kB
TypeScript
/********************************************************************************
* Copyright (c) 2018-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
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { DisposableCollection, EditorContextService, GModelRoot, ISelectionListener, ModelSource, ViewerOptions } from '@eclipse-glsp/client';
import { SelectionService as TheiaSelectionService } from '@theia/core';
export interface GlspSelection {
additionalSelectionData?: GlspSelectionData;
selectedElementsIDs: string[];
widgetId: string;
sourceUri?: string;
}
export declare namespace GlspSelection {
function is(object: unknown): object is GlspSelection;
}
/**
* Additional domain specific selection data that can be attached to a {@link GlspSelection}
*/
export interface GlspSelectionData {
selectionDataMap: Map<string, unknown>;
}
/**
* Optional service that can be implemented to provide additional {@link GlspSelectionData} for
* the {@link TheiaGLSPSelectionForwarder}
*/
export declare abstract class GlspSelectionDataService {
abstract getSelectionData(root: Readonly<GModelRoot>, selectedElementIds: string[]): Promise<GlspSelectionData>;
}
/**
* Reacts to diagram selection changes and forwards the corresponding {@link GlspSelection}
* to Theia`s {@link SelectionService}
*
* (bound in Diagram child DI container)
*/
export declare class TheiaGLSPSelectionForwarder implements ISelectionListener {
protected readonly selectionDataService?: GlspSelectionDataService;
protected viewerOptions: ViewerOptions;
protected theiaSelectionService: TheiaSelectionService;
protected modelSourceProvider: () => Promise<ModelSource>;
protected editorContext: EditorContextService;
protected sourceUri?: string;
protected toDispose: DisposableCollection;
protected init(): void;
protected dispose(): void;
protected getSourceUri(): Promise<string | undefined>;
selectionChanged(root: Readonly<GModelRoot>, selectedElements: string[]): void;
handleSelectionChanged(root: Readonly<GModelRoot>, selectedElementsIDs: string[]): Promise<void>;
}
//# sourceMappingURL=theia-glsp-selection-forwarder.d.ts.map