@eclipse-glsp/theia-integration
Version:
Glue code to integrate GLSP clients into Eclipse Theia
122 lines • 5.63 kB
TypeScript
import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
import { GLSPDiagramLanguage } from '../common/glsp-diagram-language';
/**
* A wrapper interface to get access to the binding related functions
* for a inversify container.
*/
export interface ContainerContext {
bind: interfaces.Bind;
unbind: interfaces.Unbind;
isBound: interfaces.IsBound;
rebind: interfaces.Rebind;
}
/**
* The `GLSPTheiaFrontendModule` provides the necessary required module configuration
* to implement a theia GLSP diagram language integration.
*/
export declare abstract class GLSPTheiaFrontendModule extends ContainerModule {
protected abstract diagramLanguage: GLSPDiagramLanguage;
protected enableLayoutCommands: boolean;
protected enableMarkerNavigationCommands: boolean;
protected enableCopyPaste: boolean;
constructor();
initialize(context: ContainerContext): void;
/**
* Defines the binding for the glsp client contribution of the diagram integration. A {@link ConfigurableGLSPClientContribution}
* with the same id as the diagramLanguage is bound. Can be overwritten in subclasses to provide a custom binding using
* the {@link GLSPClientContribution} service identifier.
*
* For example:
* ```typescript
* context.bind(GLSPClientContribution).toSelf(MyCustomGLSPClientContribution);
* ```
* Note that glsp client contribution bindings are consumed via multi-injection. This means binding the {@link GLSPClientContribution}
* service identifier in singleton scope has no effect.
*
* @param context the container context
*/
bindGLSPClientContribution(context: ContainerContext): void;
/**
* Defines the binding for the diagram configuration of the diagram integration. Diagram configurations are multi-injected
* and typically just bound to the `DiagramConfiguration` service identifier with the to() syntax.
*
* For example:
* ```typescript
* context.bind(DiagramConfiguration).to(MyCustomDiagramConfiguration);
* ```
*
* Note that diagram configuration bindings are consumed via multi-injection. This means binding the `DiagramConfiguration`
* service identifier in singleton scope has no effect.
*
* @param context the container context
*/
abstract bindDiagramConfiguration(context: ContainerContext): void;
/**
* Defines the binding for the {@link DiagramWidgetFactory} of the diagram integration. Per default a
* factory that constructs a {@link GLSPDiagramWidget} instance is bound.
* Can be overwritten in subclasses to provide a custom binding using
* the {@link DiagramWidgetFactory} service identifier.
*
* For example:
* ```typescript
* context.bind(DiagramWidgetFactory)
* .toDynamicValue(ctx => createDiagramWidgetFactory(ctx, this.diagramLanguage.diagramType, MyDiagramWidget));
*
* ```
* Note that glsp diagram factory bindings are consumed via multi-injection. This means binding the {@link DiagramWidgetFactory}
* service identifier in singleton scope has no effect.
*
* @param context the container context
*/
bindDiagramWidgetFactory(context: ContainerContext): void;
/**
* Configures the bindings for the diagram manager of the diagram integration. A {@link ConfigurableGLSPDiagramManager}
* is bound to a generated service identifier in singleton scope and then additional bindings for this service
* identifier are registered. Can be overwritten in subclasses to provide a custom binding.
*
* For example:
* ```typescript
* context.bind(MyDiagramManager).to(MyDiagramManager).inSingletonScope();
* registerDiagramManager(context.bind, MyDiagramManager);
* ```
* @param context the container context
*/
configureDiagramManager(context: ContainerContext): void;
/**
* Can be overwritten by subclasses to provide additional configuration (e.g. extra bindings)
* for this module.
*
* For example:
* ```typescript
* context.bind(MyCustomClass).toSelf().inSingletonScope()
* ```
* @param context the container context
*/
configure(context: ContainerContext): void;
/**
* Optional configuration to enable the default diagram layout commands for the diagram integration.
* Can be enabled/disabled using the {@link GLSPTheiaFrontendModule.enableLayoutCommands} property flag.
*
* @param context the diagram context
*/
configureDiagramLayoutCommands(context: ContainerContext): void;
/**
* Optional configuration for copy & paste functionality of the diagram integration.
* Can be enabled/disabled using the {@link GLSPTheiaFrontendModule.enableCopyPaste} property flag.
* Note that the glsp server also needs to support copy & paste for this diagram configuration.
*
* @param context the diagram context
*/
configureCopyPasteContextMenu(context: ContainerContext): void;
/**
* Optional configuration to enable marker navigation for the diagram integration.
* Can be enabled/disabled using the {@link GLSPTheiaFrontendModule.enableMarkerNavigationCommands} property flag.
* Note that the glsp server also needs to support copy & paste for this diagram configuration.
*
* @param context the diagram context
*/
configureMarkerNavigationCommands(context: ContainerContext): void;
}
declare const GLSPDiagramLanguage: unique symbol;
export {};
//# sourceMappingURL=glsp-theia-container-module.d.ts.map