Making a file readonly

Having trouble installing Oxygen? Got a bug to report? Post it all here.
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Making a file readonly

Post by sijomon »

Hi, Happy new year one and all,

I am using the method AuthorWorkspaceAccess.open(URL) to open a number of files from an within an author operation.

I need for some of these files to be treated as readonly. Is there any direct support for informing Oxygen that certain documents should be treated as readonly?

I have approximated this behaviour by provodong a readonly marker in the URL, and skipping the actual output stream processing in the custom protocol handler when this marker is present. To Oxygen it appears the file has been saved, but no data has actually been written. Unfortunately the user still thinks a save has been performed. Ideally I want Oxygen to not even display the save option, or alternatively to display the option but perform no action when it is selected (including validation).

Is this possible?

Simon.
Radu
Posts: 9439
Joined: Fri Jul 09, 2004 5:18 pm

Re: Making a file readonly

Post by Radu »

Hi Simon,

Support to mark URLs as Read-Only from the custom protocol handler should be available in Oxygen 11.2.
See this public issue:
http://issues.oxygenxml.com/browse/EXM-15992

If time allows we'll also try to make a beta kit available for tests.

Oxygen will behave if an URL is marked by the interface as read-only as if it is a local file marked as read-only:
The file will be opened with a read-only icon in the tab.
Pressing "Save" will open the "Save As" dialog instead.
From the Oxygen Preferences->Editor page you will be able to uncheck the "Can edit read-only files" checbox to disallow any editing in read-only files.

Now for a workaround to your current approach:
You can throw an IOException with a custom message when the user tries to save to the output stream you provide.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
sijomon
Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: Making a file readonly

Post by sijomon »

Thanks for the info. Unfortunately we will be using 10.3 for the forseeable future (regression testing cost/time will scupper any upgrade plans I suspect).
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Making a file readonly

Post by sorin_ristache »

Hello,

We implemented the support for read-only URLs. You can test the new Author API with an Oxygen build for:

- Windows (includes a JRE):

http://www.oxygenxml.com/update/11.2/Windows/oxygen.zip

- All Platforms:

http://www.oxygenxml.com/update/11.2/All/oxygen.tar.gz

and also using the Author SDK:

http://www.oxygenxml.com/update/11.2/De ... horSDK.zip

and the Plugins SDK:

http://www.oxygenxml.com/update/11.2/Pl ... entKit.zip


Regards,
Sorin
Post Reply