Oxygen API to check whether file saved or not

Post here questions and problems related to oXygen frameworks/document types.
vishwavaranasi
Posts: 168
Joined: Fri Feb 28, 2020 4:02 pm

Oxygen API to check whether file saved or not

Post by vishwavaranasi »

Hello Team , We have a requirement , wanted to check that if a file opened inside the editor saved the changes or not , want to achive this from a plugin

any API that can be used for this purpose ,

expecting some API like below we used for preventing editing read only files. pluginWorkspaceAccess.setGlobalObjectProperty(APIAccessibleOptionTags.CAN_EDIT_READ_ONLY_FILES, Boolean.FALSE);

thanks much.
Thanks,
vishwa
Radu
Posts: 9431
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen API to check whether file saved or not

Post by Radu »

Hi,

Sure, we have API to check if an opened document is modified:

Code: Select all

    PluginWorkspace pluginWorkspace = PluginWorkspaceProvider.getPluginWorkspace();
    URL[] allOpenedEditorLocations = pluginWorkspace.getAllEditorLocations(PluginWorkspace.MAIN_EDITING_AREA);
    for (int i = 0; i < allOpenedEditorLocations.length; i++) {
      WSEditor openedEditor = pluginWorkspace.getEditorAccess(allOpenedEditorLocations[i], PluginWorkspace.MAIN_EDITING_AREA);
      boolean modified = openedEditor.isModified();
    }
https://www.oxygenxml.com/InstData/Edit ... Modified--
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply