Page 1 of 1

Oxygen API to check whether file saved or not

Posted: Wed Jun 08, 2022 9:27 am
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.

Re: Oxygen API to check whether file saved or not

Posted: Wed Jun 08, 2022 9:41 am
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