@eclipse-glsp/theia-integration
Version:
Glue code to integrate GLSP clients into Eclipse Theia
52 lines • 2.86 kB
TypeScript
/********************************************************************************
* Copyright (c) 2026 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 { ExportFormat, ExportResultAction } from '@eclipse-glsp/client';
import { CommandHandler, MessageService, URI } from '@theia/core';
import { ApplicationShell, QuickInputService } from '@theia/core/lib/browser';
import { FileDialogService } from '@theia/filesystem/lib/browser/file-dialog/file-dialog-service';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import { FileStat } from '@theia/filesystem/lib/common/files';
import { GLSPDiagramWidget } from '../../glsp-diagram-widget';
interface ExportFormatChoice {
label: string;
format: ExportFormat;
extension: string;
filterLabel: string;
}
/**
* {@link CommandHandler} for the "Export Diagram" menu command. Asks the user for the target
* format up front, then opens the save dialog with a single matching filter so the resulting
* URI's extension is unambiguous. Uses the request/response dispatcher path so the export
* result lands here directly rather than fanning out to action handlers.
*/
export declare class TheiaExportCommandHandler implements CommandHandler {
protected readonly shell: ApplicationShell;
protected readonly fileService: FileService;
protected readonly fileDialogService: FileDialogService;
protected readonly quickInputService: QuickInputService;
protected readonly messageService: MessageService;
constructor(shell: ApplicationShell, fileService: FileService, fileDialogService: FileDialogService, quickInputService: QuickInputService, messageService: MessageService);
execute(): Promise<void>;
isEnabled(): boolean;
isVisible(): boolean;
protected pickFormat(): Promise<ExportFormatChoice | undefined>;
protected ensureExtension(file: URI, extension: string): URI;
protected writeResult(file: URI, result: ExportResultAction): Promise<unknown>;
protected decodeBase64(data: string): Uint8Array;
protected getExportFolder(widget: GLSPDiagramWidget): Promise<FileStat>;
}
export {};
//# sourceMappingURL=theia-export-command-handler.d.ts.map