Page 1 of 1

Making a file readonly

Posted: Fri Jan 15, 2010 7:01 pm
by sijomon
Hi, Happy new year one and all,

I am using the method 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?


Re: Making a file readonly

Posted: Mon Jan 18, 2010 10:28 am
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:

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.


Re: Making a file readonly

Posted: Tue Jan 19, 2010 1:14 pm
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).

Re: Making a file readonly

Posted: Tue Feb 02, 2010 6:51 pm
by sorin_ristache

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

- Windows (includes a JRE):

- All Platforms:

and also using the Author SDK: ...

and the Plugins SDK: ...