UNPKG

@eclipse-glsp/client

Version:

A sprotty-based client for GLSP

54 lines 3.28 kB
/******************************************************************************** * Copyright (c) 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 { GModelElement, Point } from '@eclipse-glsp/sprotty'; import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter'; import { ContainerElement } from '../../hints/model'; import { IChangeBoundsManager } from '../change-bounds/change-bounds-manager'; export interface InsertOptions extends Record<string, unknown> { /** Flag to indicate whether the location within a container needs to be valid. Default: false */ validateLocationInContainer?: boolean; /** Overwrite for location validation if validation result is already known. Default: undefined */ validLocationOverwrite?: boolean; /** Mouse event to be used for finding the container. Default: undefined */ evt?: MouseEvent; } export declare const DEFAULT_INSERT_OPTIONS: InsertOptions; export interface TrackedInsert { elementTypeId: string; location: Point; container?: GModelElement; valid: boolean; options: InsertOptions; } export interface IContainerManager { insert(proxy: GModelElement, location: Point, elementTypeId: string, opts?: Partial<InsertOptions>): TrackedInsert; isCreationAllowed(container: ContainerElement | undefined, elementTypeId: string, opts?: Partial<InsertOptions>): boolean; findContainer(location: Point, ctx: GModelElement, evt?: MouseEvent): ContainerElement | undefined; addInsertFeedback(feedback: FeedbackEmitter, trackedInsert: TrackedInsert, ctx?: GModelElement, event?: MouseEvent): FeedbackEmitter; } /** * The default {@link IContainerManager} implementation. * This class class manages the insertion of elements into containers by validating their positions and types, * providing feedback on the insertion process, and determining the appropriate container based on the location and context. */ export declare class ContainerManager implements IContainerManager { protected readonly changeBoundsManager: IChangeBoundsManager; insert(proxy: GModelElement, location: Point, elementTypeId: string, opts?: Partial<InsertOptions>): TrackedInsert; isCreationAllowed(container: ContainerElement | undefined, elementTypeId: string, opts?: Partial<InsertOptions>): boolean; findContainer(location: Point, ctx: GModelElement, evt?: MouseEvent): ContainerElement | undefined; addInsertFeedback(feedback: FeedbackEmitter, trackedInsert: TrackedInsert, ctx?: GModelElement, event?: MouseEvent): FeedbackEmitter; } //# sourceMappingURL=container-manager.d.ts.map