Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 'showSaveDialog' method of plugin API #2173

Closed
4 tasks done
ashumilova opened this issue Jun 23, 2018 · 1 comment
Closed
4 tasks done

Implement 'showSaveDialog' method of plugin API #2173

ashumilova opened this issue Jun 23, 2018 · 1 comment
Assignees
Labels
plug-in system issues related to the plug-in system Team: Che-Editors issues regarding the che-editors team

Comments

@ashumilova
Copy link

ashumilova commented Jun 23, 2018

Add ability to show the save dialog to the user, which allows to select a file for saving-purposes, with the Plugin API usage. There should be possible to provide save options:

The task includes following items to be done:

  • define the API for showSaveDialog
  • document the API
  • develop the defined API
  • test it on the sample plugin
@vitaliy-guliy
Copy link
Contributor

Code to test

    const showSaveDialogCommand: theia.Command = {
        id: 'plugin-api-show-save-dialog',
        label: 'Plugin API: Show Save Dialog'
    };

    disposables.push(
        theia.commands.registerCommand(showSaveDialogCommand, (...args: any[]) => {
            const options = {
                saveLabel: 'Save now',
                defaultUri: theia.Uri.parse('file:///home/vitaliy/temp'),
                filters: {
                    'Text files': ['txt', 'text'],
                    'JS, TS': ['ts', 'tsx', 'js'],
                    'HTML': ['htm', 'html']
                }
            } as theia.SaveDialogOptions;

            theia.window.showSaveDialog(options).then(value => {
                if (value) {
                    theia.window.showInformationMessage('Save result: ' + value.path);
                } else {
                    theia.window.showInformationMessage('Save dialog has been closed');
                }
            });
        })
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plug-in system issues related to the plug-in system Team: Che-Editors issues regarding the che-editors team
Projects
None yet
Development

No branches or pull requests

2 participants