Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
}
constructor(@inject(TYPES.IActionDispatcher) protected actionDispatcher: GLSPActionDispatcher) { }
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();
}
* 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.");
}
}
constructor(@inject(MouseTool) protected mouseTool: MouseTool,
@inject(KeyTool) protected keyTool: KeyTool,
@inject(TYPES.IActionDispatcher) protected actionDispatcher: ActionDispatcher) { }
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)
}
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)
}
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
}