create new file with assigned url?

Post here questions and problems related to oXygen frameworks/document types.
Patrik
Posts: 236
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

create new file with assigned url?

Post by Patrik » Thu Jun 08, 2017 5:02 pm

My requirement for a specific AuthorOperation is that i want to ensure that a specific file is opened in oXygen editor. (I will access it through the URIResolver.)

Currently, when the file is not existing I create the content, write it to disk and then open it.

Even better would be if I could create a new document with a specific URL assigned to it. This way there is no side-effect until the user saves the file.
I found a method to create a new file (Workspace.createNewEditor()) but I could not find a way to set a specific URL without explicitly saving it to disk!?

Thanks and regards,
Patrik

Radu
Posts: 6552
Joined: Fri Jul 09, 2004 5:18 pm

Re: create new file with assigned url?

Post by Radu » Fri Jun 09, 2017 10:29 am

Hi Patrik,

Sorry but we do not have such an API. I added an internal issue for this.
What you could do would be to create the file on disk, open it in Oxygen, mark the opened editor as modified (WSEditor.setModified(true)) and then remove if from disk.
This will probably not work that well when Oxygen 19.1 will be released because Oxygen 19.1 will detect the underlining file does not exist anymore and will show a dialog asking you what to do about it.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Patrik
Posts: 236
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: create new file with assigned url?

Post by Patrik » Fri Jun 09, 2017 10:32 am

Thanks. It's not that urgent anyway since the current behavior is good enough...

Regards,
Patrik

Post Reply