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

Hello Maxim! 
Try to inject in your class com.google.web.bindery.event.shared.EventBus 
and just fire update event:
eventBus.fireEvent(new FileContentUpdateEvent(file.getPath()));

On Wed, Apr 13, 2016 at 3:45 PM, Maxim Gorbunkov <m.gorbunkov@xxxxxxxxx> wrote:
I can't make it work. Can you please take a look at the code. Maybe I am doing anything wrong?


2016-04-13 16:00 GMT+04:00 Vitaliy Guliy <vguliy@xxxxxxxxxxx>:
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



_______________________________________________
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




--
http://codenvy.com | Valeriy Svydenko | Developer | codenvy.com

Back to the top