Reload Editor Contents from Workspace Plugin
Posted: Wed Jan 24, 2018 9:20 am
Hi,
I am creating a CMS plugin. I have implemented my plugin as a WorkspaceAccess plugin with a custom protocol handler implementation.
Now, I need to give the user an option of reloading the contents of their editor (discarding any local changes) from the original source (the custom protocol URL). I found the following 2 methods in the SDK documentation:
1) WSEditor.reloadContent(Reader) -- Reloads from provided reader.
2) ro.sync.ecss.extensions.commons.operations.ReloadContentOperation.doOperation(AuthorAccess, ArgumentsMap) -- Reloads from the original source.
I am currently using the first (1) method, but it doesn't quite fit my requirement as it marks the file dirty. While all I want is to just tell the editor that the file has been modified from outside, and just reload from the original source and mark it not dirty instead.
The second method seems perfect for my use case, just that I could not find a way to obtain an instance of AuthorAccess in a WorkspaceAccess plugin.
I want to know if there is a better way of achieving what I'm trying to do? Or how to obtain the AuthorAccess instance so that I can call ReloadContentOperation.
Thanks,
Ankit
I am creating a CMS plugin. I have implemented my plugin as a WorkspaceAccess plugin with a custom protocol handler implementation.
Now, I need to give the user an option of reloading the contents of their editor (discarding any local changes) from the original source (the custom protocol URL). I found the following 2 methods in the SDK documentation:
1) WSEditor.reloadContent(Reader) -- Reloads from provided reader.
2) ro.sync.ecss.extensions.commons.operations.ReloadContentOperation.doOperation(AuthorAccess, ArgumentsMap) -- Reloads from the original source.
I am currently using the first (1) method, but it doesn't quite fit my requirement as it marks the file dirty. While all I want is to just tell the editor that the file has been modified from outside, and just reload from the original source and mark it not dirty instead.
The second method seems perfect for my use case, just that I could not find a way to obtain an instance of AuthorAccess in a WorkspaceAccess plugin.
I want to know if there is a better way of achieving what I'm trying to do? Or how to obtain the AuthorAccess instance so that I can call ReloadContentOperation.
Thanks,
Ankit