/********************************************************************************
 * Copyright (c) 2019-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 { Deferred, DirtyStateChange, EditorContextService, GLSPActionDispatcher } from '@eclipse-glsp/client';
import { Disposable, DisposableCollection, Emitter, Event } from '@theia/core';
import { Saveable } from '@theia/core/lib/browser';
type AutoSaveType = 'off' | 'afterDelay' | 'onFocusChange' | 'onWindowChange';
/**
 * The default {@link Saveable} implementation of the `GLSPDiagramWidget`.
 * Since Theia 1.50.0, handling the autosave functionality is done by a central `SaveableService` and is no longer the responsibility of the
 * {@link Saveable} itself. This implementation includes a compatibility layer for both the old saveable implementation prior
 * to Theia 1.50.0 and the new saveable implementation.
 * When using a Theia version >= 1.50.0, the autosave functionality is limited to the `afterDelay` strategy.
 * Other autosave types (`onWindowChange` | `onFocusChange`) are not supported. If the `autoSaveType` is set to an unsupported value, the
 * `afterDelay` save strategy will be used.
 */
export declare class GLSPSaveable implements Saveable, Disposable {
    protected actionDispatcher: GLSPActionDispatcher;
    protected editorContextService: EditorContextService;
    protected toDispose: DisposableCollection;
    readonly onDirtyChangedEmitter: Emitter<void>;
    get onDirtyChanged(): Event<void>;
    readonly onContentChangedEmitter: Emitter<void>;
    get onContentChanged(): Event<void>;
    protected pendingSave?: Deferred<void>;
    protected saveTimeout: number;
    constructor(actionDispatcher: GLSPActionDispatcher, editorContextService: EditorContextService);
    protected handleDirtyStateChange(change: DirtyStateChange): void;
    /**
     * Saves the current diagram by dispatching a `SaveModelAction` to the GLSP server.
     * The save operation is asynchronous and the method returns a promise that resolves once the save operation is completed.
     * or is rejected if the {@link saveTimeout} is reached before the server responds with a save confirmation.
     * Note: if the diagram is currently not dirty this is a no-op and no save action is dispatched.
     * @returns A promise that resolves once the save client-server roundtrip is completed i.e.
     * the server has responded with a save confirmation in the form of `SetDirtyStateAction`
     */
    save(): Promise<void>;
    get dirty(): boolean;
    dispose(): void;
    protected compatibilityLayerEnabled: boolean;
    protected _autoSave: AutoSaveType;
    autoSaveDelay: number;
    protected autoSaveJobs: DisposableCollection;
    protected doAutoSave(): void;
    protected get shouldAutoSave(): boolean;
    set autoSave(autoSave: AutoSaveType);
    get autoSave(): AutoSaveType;
    protected scheduleAutoSave(): void;
}
export {};
//# sourceMappingURL=glsp-saveable.d.ts.map