UNPKG

@eclipse-glsp/client

Version:

A sprotty-based client for GLSP

96 lines 5.23 kB
/******************************************************************************** * Copyright (c) 2019-2025 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, GModelRoot, IActionDispatcher, IActionHandler, ICommand, PaletteItem } from '@eclipse-glsp/sprotty'; import { EditorContextService, IEditModeListener } from '../../base/editor-context-service'; import { FocusTracker } from '../../base/focus/focus-tracker'; import { IDiagramStartup } from '../../base/model/diagram-loader'; import { GLSPAbstractUIExtension } from '../../base/ui-extension/ui-extension'; import { IDebugManager } from '../debug/debug-manager'; import { IGridManager } from '../grid/grid-manager'; export interface EnableToolPaletteAction extends Action { kind: typeof EnableToolPaletteAction.KIND; } export declare namespace EnableToolPaletteAction { const KIND = "enableToolPalette"; function is(object: any): object is EnableToolPaletteAction; function create(): EnableToolPaletteAction; } export declare class ToolPalette extends GLSPAbstractUIExtension implements IActionHandler, IEditModeListener, IDiagramStartup { static readonly ID = "tool-palette"; protected actionDispatcher: IActionDispatcher; protected editorContext: EditorContextService; protected focusTracker: FocusTracker; protected gridManager?: IGridManager; protected debugManager?: IDebugManager; protected paletteItems: PaletteItem[]; protected paletteItemsCopy: PaletteItem[]; protected dynamic: boolean; protected toggleButton?: HTMLElement; protected headerDiv?: HTMLElement; protected bodyDiv?: HTMLElement; protected lastActiveButton?: HTMLElement; protected defaultToolsButton: HTMLElement; protected searchField: HTMLInputElement; modelRootId: string; id(): string; containerClass(): string; postConstruct(): void; initialize(): boolean; protected initializeContents(containerElement: HTMLElement): void; protected onBeforeShow(_containerElement: HTMLElement, root: Readonly<GModelRoot>): void; protected addMinimizePaletteButton(): void; protected updateMinimizePaletteButtonTooltip(button: HTMLDivElement): void; protected isPaletteMaximized(): boolean; protected createBody(): void; protected createHeader(): void; protected createHeaderTools(): HTMLElement; protected createDefaultToolButton(): HTMLElement; protected createMouseDeleteToolButton(): HTMLElement; protected createMarqueeToolButton(): HTMLElement; protected createValidateButton(): HTMLElement; protected createResetViewportButton(): HTMLElement; protected createToggleGridButton(): HTMLElement; protected createToggleDebugButton(): HTMLElement; protected createSearchButton(): HTMLElement; protected createHeaderSearchField(): HTMLInputElement; protected createHeaderTitle(): HTMLElement; protected createToolButton(item: PaletteItem, index: number): HTMLElement; protected onClickCreateToolButton(button: HTMLElement, item: PaletteItem): (_ev: MouseEvent) => void; protected onClickStaticToolButton(button: HTMLElement, toolId?: string): (_ev: MouseEvent) => void; changeActiveButton(button?: HTMLElement): void; handle(action: Action): ICommand | Action | void; editModeChanged(_newValue: string, _oldValue: string): void; protected clearOnEscape(event: KeyboardEvent): void; protected clearToolOnEscape(event: KeyboardEvent): void; protected requestFilterUpdate(filter: string): void; /** * @deprecated This hook is no longer used by the ToolPalette. * It is kept for compatibility reasons and will be removed in the future. * Move initialization logic to the `postRequestModel` method. * This ensures that tool palette initialization does not block the diagram loading process. */ preRequestModel(): Promise<void>; postRequestModel(): Promise<void>; protected setPaletteItems(): Promise<void>; protected hasDynamicAction(item: PaletteItem): boolean; protected reloadPaletteBody(): Promise<void>; } export declare function compare(a: PaletteItem, b: PaletteItem): number; export declare function createIcon(codiconId: string): HTMLElement; export declare function createToolGroup(item: PaletteItem): HTMLElement; export declare function changeCSSClass(element: Element, css: string): void; export declare function changeCodiconClass(element: Element, codiconId: string): void; //# sourceMappingURL=tool-palette.d.ts.map