UNPKG

@eclipse-glsp/client

Version:

A sprotty-based client for GLSP

76 lines 4.7 kB
/******************************************************************************** * Copyright (c) 2020-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 { Action, Args, Disposable, GModelElement, GhostElement, IModelFactory, TriggerNodeCreationAction } from '@eclipse-glsp/sprotty'; import '../../../../css/ghost-element.css'; import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener'; import { EditorContextService } from '../../../base/editor-context-service'; import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter'; import { MoveableElement } from '../../../utils/gmodel-util'; import { MouseTrackingElementPositionListener, PositioningTool } from '../../element-template/mouse-tracking-element-position-listener'; import { BaseCreationTool } from '../base-tools'; import { IChangeBoundsManager } from '../change-bounds/change-bounds-manager'; import { TrackedMove } from '../change-bounds/change-bounds-tracker'; import { IContainerManager, TrackedInsert } from './container-manager'; export declare class NodeCreationTool extends BaseCreationTool<TriggerNodeCreationAction> implements PositioningTool { static ID: string; protected isTriggerAction: typeof TriggerNodeCreationAction.is; readonly changeBoundsManager: IChangeBoundsManager; readonly containerManager: IContainerManager; modelFactory: IModelFactory; get id(): string; doEnable(): void; protected createInsertIndicator(): GModelElement; protected createGhostElementTracker(ghostElement: GhostElement, position: 'top-left' | 'middle'): Disposable; protected createNodeCreationListener(ghostElement: GhostElement): Disposable; protected createNodeCreationCursorFeedback(): FeedbackEmitter; } export interface ContainerPositioningTool extends PositioningTool { readonly containerManager: IContainerManager; } export declare class NodeInsertTrackingListener extends MouseTrackingElementPositionListener { protected elementTypeId: string; protected tool: ContainerPositioningTool; constructor(elementId: string, elementTypeId: string, tool: ContainerPositioningTool, cursorPosition?: 'top-left' | 'middle', editorContext?: EditorContextService); protected addMoveFeedback(move: TrackedMove, ctx: GModelElement, event: MouseEvent): void; } export declare class NodeCreationToolMouseListener extends DragAwareMouseListener { protected triggerAction: TriggerNodeCreationAction; protected tool: NodeCreationTool; protected ghostElement: GhostElement; protected cursorFeedback: FeedbackEmitter; protected ghostElementFeedback: FeedbackEmitter; protected ghostElementId: string; constructor(triggerAction: TriggerNodeCreationAction, tool: NodeCreationTool, ghostElement: GhostElement); get elementTypeId(): string; nonDraggingMouseUp(ctx: GModelElement, event: MouseEvent): Action[]; /** * Determines wether the tool should run in continuous mode (also called stamp mode) or not. * If continuous mode is enabled, the tool will stay after a successful creation. * The user can then create more elements of the same type without having to re-trigger the tool. * By default, continuous mode is enabled if the user holds the CTRL key. * @param ctx the current model context * @param event */ protected isContinuousMode(ctx: GModelElement, event: MouseEvent): boolean; protected getCreateOperation(ctx: GModelElement, event: MouseEvent, insert: TrackedInsert): Action; protected getCreateNodeOperationArgs(insert: TrackedInsert, ctx: GModelElement, event: MouseEvent): Args | undefined; protected createGhostElement(ghostElement: GhostElement): string; protected getGhostElement(ctx: GModelElement, event: MouseEvent): MoveableElement | undefined; protected getTrackedInsert(ctx: GModelElement, event: MouseEvent): TrackedInsert; protected disposeAllButGhostElement(): void; dispose(): void; } //# sourceMappingURL=node-creation-tool.d.ts.map