Re: [oXygen-sdk] Check out a resource during Replace All

Hi Radu, The problem is solved for batch "Replace All" operations (Find/Replace in Files...) by overriding the function "getOutputStream". But, when using "Find/Replace..." on a single file, the file is not checked out, and when clicking the button "Replace All", a message "One match replaced" is shown, while nothing changes in the document itself. The read-only flag is set on the file, and the whole content is disabled. When trying to change the document by entering some text, a notification "Read-only content" is shown. How can we check out the document before it is changed by the "Replace All" operation? Or, if it is not possible, can the notification/message "Read-only content" be shown instead of "One match replaced", when the content is read-only? Kind regards, Jeroen www.sdl.com SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: SDL PLC, New Globe House, Vanwall Business Park, Vanwall Road, Maidenhead, SL6 4UB, U.K. -----Original Message----- From: oXygen-sdk [mailto:oxygen-sdk-bounces@oxygenxml.com] On Behalf Of oxygen-sdk-request@oxygenxml.com Sent: maandag 12 februari 2018 19:00 To: oxygen-sdk@oxygenxml.com Subject: oXygen-sdk Digest, Vol 51, Issue 5 Send oXygen-sdk mailing list submissions to oxygen-sdk@oxygenxml.com To subscribe or unsubscribe via the World Wide Web, visit https://www.oxygenxml.com/mailman/listinfo/oxygen-sdk or, via email, send a message with subject or body 'help' to oxygen-sdk-request@oxygenxml.com You can reach the person managing the list at oxygen-sdk-owner@oxygenxml.com When replying, please edit your Subject line so it is more specific than "Re: Contents of oXygen-sdk digest..." Today's Topics: 1. Re: Check out a resource during Replace All (Oxygen XML Editor Support (Radu Coravu) ) ---------------------------------------------------------------------- Message: 1 Date: Mon, 12 Feb 2018 09:53:58 +0200 From: "Oxygen XML Editor Support (Radu Coravu) " <support@oxygenxml.com> To: oxygen-sdk@oxygenxml.com Subject: Re: [oXygen-sdk] Check out a resource during Replace All Message-ID: <b845966d-0486-27bd-f754-d2e24e21ba1d@oxygenxml.com> Content-Type: text/plain; charset=utf-8; format=flowed Hi Jeroen, I agree with your findings, indeed somehow I wanted to give this callback before Oxygen actually starts to read the URL's contents, but before Oxygen starts reading the URL's contents it does not know if it will make changes to the contents so right now although the callback is named "aboutToModifyResource(BatchOperationInfo, URL)" we give it for each resource. So this is definitely not OK. I will add an issue on our side. Maybe for now you could detect when Oxygen calls your URL handler's "getOutputStream()" method. This means Oxygen is about to write to the file. If before "getOutputStream()" is called you also had a call of "aboutToModifyResource(BatchOperationInfo, URL)" for the same URL, this means that you need to check out the file (on the "getOutputStream()" method). So you should move the file checkout from "aboutToModifyResource" to "getOutputStream()". Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 2/9/2018 4:04 PM, Jeroen Laridon wrote:
Hi,
We use "aboutToModifyResource" in "TrisoftBatchOperationsListener" to check out a topic in a map before it is modified.
But "aboutToModifyResource" is triggered on all topics in the map, not only topics that will be modified.
That way all topics and the map are checked out, while only a few are changed.
Expected is that only resources that will change are checked out.
Is there a way to find out up front if a resource will be changed or not?
Kind regards,
Jeroen
*www.sdl.com* <http://www.sdl.com/>
SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: SDL PLC, New Globe House, Vanwall Business Park, Vanwall Road, Maidenhead, SL6 4UB, U.K.
_______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-sdk
------------------------------ Subject: Digest Footer _______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-sdk ------------------------------ End of oXygen-sdk Digest, Vol 51, Issue 5 *****************************************

Hi Jeroen, I understand, I will add an internal issue to maybe disable the "Replace" and "Replace all" buttons both in the Author visual editing mode and the Text editing mode if the entire document is read-only. I'm assuming you are using one of these API methods to set the page as read-only: ro.sync.exml.workspace.api.editor.WSEditor.setEditable(boolean) ro.sync.exml.workspace.api.editor.page.WSEditorPage.setReadOnly(ReadOnlyReason) ro.sync.exml.workspace.api.editor.page.WSEditorPage.setEditable(boolean) Regards, Radu Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 2/19/2018 4:44 PM, Jeroen Laridon wrote:
Hi Radu,
The problem is solved for batch "Replace All" operations (Find/Replace in Files...) by overriding the function "getOutputStream".
But, when using "Find/Replace..." on a single file, the file is not checked out, and when clicking the button "Replace All", a message "One match replaced" is shown, while nothing changes in the document itself. The read-only flag is set on the file, and the whole content is disabled. When trying to change the document by entering some text, a notification "Read-only content" is shown.
How can we check out the document before it is changed by the "Replace All" operation? Or, if it is not possible, can the notification/message "Read-only content" be shown instead of "One match replaced", when the content is read-only?
Kind regards,
Jeroen
*www.sdl.com* <http://www.sdl.com/>
SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: SDL PLC, New Globe House, Vanwall Business Park, Vanwall Road, Maidenhead, SL6 4UB, U.K.
-----Original Message----- From: oXygen-sdk [mailto:oxygen-sdk-bounces@oxygenxml.com] On Behalf Of oxygen-sdk-request@oxygenxml.com Sent: maandag 12 februari 2018 19:00 To: oxygen-sdk@oxygenxml.com Subject: oXygen-sdk Digest, Vol 51, Issue 5
Send oXygen-sdk mailing list submissions to oxygen-sdk@oxygenxml.com
To subscribe or unsubscribe via the World Wide Web, visit https://www.oxygenxml.com/mailman/listinfo/oxygen-sdk or, via email, send a message with subject or body 'help' to oxygen-sdk-request@oxygenxml.com
You can reach the person managing the list at oxygen-sdk-owner@oxygenxml.com
When replying, please edit your Subject line so it is more specific than "Re: Contents of oXygen-sdk digest..."
Today's Topics:
1. Re: Check out a resource during Replace All (Oxygen XML Editor Support (Radu Coravu) )
----------------------------------------------------------------------
Message: 1 Date: Mon, 12 Feb 2018 09:53:58 +0200 From: "Oxygen XML Editor Support (Radu Coravu) " <support@oxygenxml.com> To: oxygen-sdk@oxygenxml.com Subject: Re: [oXygen-sdk] Check out a resource during Replace All Message-ID: <b845966d-0486-27bd-f754-d2e24e21ba1d@oxygenxml.com> Content-Type: text/plain; charset=utf-8; format=flowed
Hi Jeroen,
I agree with your findings, indeed somehow I wanted to give this callback before Oxygen actually starts to read the URL's contents, but before Oxygen starts reading the URL's contents it does not know if it will make changes to the contents so right now although the callback is named "aboutToModifyResource(BatchOperationInfo, URL)" we give it for each resource. So this is definitely not OK. I will add an issue on our side. Maybe for now you could detect when Oxygen calls your URL handler's "getOutputStream()" method. This means Oxygen is about to write to the file. If before "getOutputStream()" is called you also had a call of "aboutToModifyResource(BatchOperationInfo, URL)" for the same URL, this means that you need to check out the file (on the "getOutputStream()" method). So you should move the file checkout from "aboutToModifyResource" to "getOutputStream()".
Regards, Radu
Radu Coravu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com
On 2/9/2018 4:04 PM, Jeroen Laridon wrote:
Hi,
We use "aboutToModifyResource" in "TrisoftBatchOperationsListener" to check out a topic in a map before it is modified.
But "aboutToModifyResource" is triggered on all topics in the map, not only topics that will be modified.
That way all topics and the map are checked out, while only a few are changed.
Expected is that only resources that will change are checked out.
Is there a way to find out up front if a resource will be changed or not?
Kind regards,
Jeroen
*www.sdl.com* <http://www.sdl.com/>
SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: SDL PLC, New Globe House, Vanwall Business Park, Vanwall Road, Maidenhead, SL6 4UB, U.K.
_______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-sdk
------------------------------
Subject: Digest Footer
_______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-sdk
------------------------------
End of oXygen-sdk Digest, Vol 51, Issue 5 *****************************************
_______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-sdk
participants (2)
-
Jeroen Laridon
-
Radu Coravu