/********************************************************************************
 * 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, GModelElement, IActionHandler, ICommand, KeyListener, LazyInjector, MaybePromise } from '@eclipse-glsp/sprotty';
import { EditorContextService, IEditModeListener } from '../editor-context-service';
import { IDiagramStartup } from '../model/diagram-loader';
import { Tool } from './tool';
/**
 * A tool manager coordinates the state of tools in the context of an editor.
 *
 * One instance of a tool manager is intended per editor, coordinating the state of all tools within
 * this editor. A tool can be active or not. A tool manager ensures that activating a set of tools
 * will disable all other tools, allowing them to invoke behavior when they become enabled or disabled.
 */
export interface IToolManager {
    /** All tools managed by this tool manager. */
    readonly managedTools: Tool[];
    /** The tools that are enabled by default, whenever no other tool is enabled. */
    readonly defaultTools: Tool[];
    /** The currently active tools, which are either specifically enabled tools, or the default tools. */
    readonly activeTools: Tool[];
    /** Flag to indicate that the default tools are enabled and no other tool was explicitly enabled. */
    readonly defaultToolsEnabled: boolean;
    /**
     * Enables the tools with the specified `toolIds`.
     * Therefore, this manager first disables currently active tools and then enable the
     * tools indicated in `toolIds`, making them the currently active tools. If this manager
     * doesn't manage one or more tools specified in `toolIds`, it'll do nothing. If not a
     * single tool that shall be enabled was found in the managed tools, it'll fall back to
     * the default tools.
     *
     * @param tools The tools to be enabled.
     */
    enable(toolIds: string[]): void;
    /**
     * Enables all default tools. If the default tools are already enabled, this is a no-op.
     */
    enableDefaultTools(): void;
    /** Disables all currently active tools. After this call, no tool will be active anymore. */
    disableActiveTools(): void;
    registerDefaultTools(...tools: Tool[]): void;
    registerTools(...tools: Tool[]): void;
}
/**
 * The default {@link IToolManager} implementation. Allows
 * registration of tools via Dependency Injection.
 */
export declare class ToolManager implements IToolManager, IDiagramStartup, IEditModeListener {
    protected editorContext: EditorContextService;
    protected readonly lazyInjector: LazyInjector;
    readonly actives: Tool[];
    readonly tools: Tool[];
    readonly defaultTools: Tool[];
    protected _defaultToolsEnabled: boolean;
    get defaultToolsEnabled(): boolean;
    preLoadDiagram(): MaybePromise<void>;
    get managedTools(): Tool[];
    get activeTools(): Tool[];
    get rank(): number;
    registerDefaultTools(...tools: Tool[]): void;
    registerTools(...tools: Tool[]): void;
    disableActiveTools(): void;
    enableDefaultTools(force?: boolean): void;
    enable(toolIds: string[]): void;
    tool(toolId: string): Tool | undefined;
    disableEditTools(): void;
    editModeChanged(newValue: string, oldValue: string): void;
}
export declare class ToolManagerActionHandler implements IActionHandler {
    readonly toolManager: IToolManager;
    handle(action: Action): void | ICommand | Action;
}
export declare class DefaultToolsEnablingKeyListener extends KeyListener {
    keyDown(element: GModelElement, event: KeyboardEvent): Action[];
}
//# sourceMappingURL=tool-manager.d.ts.map