Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [che-dev] How to set the content to the editor

It has to be updated.
Try to get file from the editor, update content and set the file again.


On Wed, Apr 13, 2016 at 1:17 PM, Maxim Gorbunkov <m.gorbunkov@xxxxxxxxx> wrote:
Did you mean that I must get the file from editor and set it back?

VirtualFile file = activeEditor.getEditorInput().getFile();
activeEditor.getEditorInput().setFile(file);
activeEditor.onFileChanged();

This doesn't work:(

2016-04-13 12:48 GMT+04:00 Vitaliy Guliy <vguliy@xxxxxxxxxxx>:
Hi!
Let you try 
activeEditor.getEditorInput().setFile(file);
activeEditor.onFileChanged();


On Wed, Apr 13, 2016 at 10:35 AM, Maxim Gorbunkov <m.gorbunkov@xxxxxxxxx> wrote:
Hi!
I'm trying to create an IDE action that will reload the opened file from disk. I've found how to get the file content. I'm doing it this way:

    public void actionPerformed(ActionEvent e) {
        EditorPartPresenter activeEditor = editorAgent.getActiveEditor();
        if (activeEditor != null) {
            VirtualFile file = activeEditor.getEditorInput().getFile();
            file.getContent().then(new Operation<String>() {
                @Override
                public void apply(String result) throws OperationException {
                    notificationManager.notify(result);
                }
            }).catchError(new Operation<PromiseError>() {
                @Override
                public void apply(PromiseError arg) throws OperationException {
                }
            });
        }
    }

Please, give me a hint what is the proper way to set the content to the opened editor.

--
Regards,
Maxim Gorbunkov

_______________________________________________
che-dev mailing list
che-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/che-dev




_______________________________________________
che-dev mailing list
che-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/che-dev



Back to the top