Making a file readonly

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

Making a file readonly

Post by sijomon » Fri Jan 15, 2010 7:01 pm

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?


Posts: 6979
Joined: Fri Jul 09, 2004 5:18 pm

Re: Making a file readonly

Post by Radu » Mon Jan 18, 2010 10:28 am

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.

Radu Coravu
<oXygen/> XML Editor

Posts: 83
Joined: Wed May 20, 2009 1:18 pm

Re: Making a file readonly

Post by sijomon » Tue Jan 19, 2010 1:14 pm

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).

Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Making a file readonly

Post by sorin_ristache » Tue Feb 02, 2010 6:51 pm


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: ...


Post Reply