sprotty
Version:
A next-gen framework for graphical views
61 lines • 2.96 kB
TypeScript
/********************************************************************************
* Copyright (c) 2018 TypeFox 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, ApplyLabelEditAction } from 'sprotty-protocol/lib/actions';
import { CommandExecutionContext, CommandReturn, Command } from '../../base/commands/command';
import { SModelElementImpl } from '../../base/model/smodel';
import { MouseListener } from '../../base/views/mouse-tool';
import { KeyListener } from '../../base/views/key-tool';
import { EditableLabel } from './model';
export interface EditLabelAction extends Action {
kind: typeof EditLabelAction.KIND;
labelId: string;
}
export declare namespace EditLabelAction {
const KIND = "EditLabel";
function create(labelId: string): EditLabelAction;
}
export declare function isEditLabelAction(element?: any): element is EditLabelAction;
export declare function isApplyLabelEditAction(element?: any): element is ApplyLabelEditAction;
export declare class ResolvedLabelEdit {
label: EditableLabel;
oldLabel: string;
newLabel: string;
}
export declare class ApplyLabelEditCommand extends Command {
protected readonly action: ApplyLabelEditAction;
static readonly KIND = "applyLabelEdit";
protected resolvedLabelEdit: ResolvedLabelEdit;
constructor(action: ApplyLabelEditAction);
execute(context: CommandExecutionContext): CommandReturn;
undo(context: CommandExecutionContext): CommandReturn;
redo(context: CommandExecutionContext): CommandReturn;
}
export interface IEditLabelValidator {
validate(value: string, label: EditableLabel & SModelElementImpl): Promise<EditLabelValidationResult>;
}
export interface EditLabelValidationResult {
readonly severity: Severity;
readonly message?: string;
}
export type Severity = 'ok' | 'warning' | 'error';
export declare class EditLabelMouseListener extends MouseListener {
doubleClick(target: SModelElementImpl, event: MouseEvent): (Action | Promise<Action>)[];
}
export declare class EditLabelKeyListener extends KeyListener {
keyDown(element: SModelElementImpl, event: KeyboardEvent): Action[];
}
export declare function getEditableLabel(element: SModelElementImpl): EditableLabel & SModelElementImpl | undefined;
//# sourceMappingURL=edit-label.d.ts.map