Modify File > New?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
alolen
Posts: 6
Joined: Sat Apr 28, 2012 12:25 am

Modify File > New?

Post by alolen »

Is there a way to customize the File > New dialog so that when a certain type of new file is selected, for example a book file, we can put up a form to capture some information from the user, and then do some actions on their system to build the file? Not just create a book file, but a whole book directory and set of default files?
Radu
Posts: 9449
Joined: Fri Jul 09, 2004 5:18 pm

Re: Modify File > New?

Post by Radu »

Hi Anathea,

We have support for having editor variables in a file template.
For example if you open the file template:

OXYGEN_INSTALL_DIR\frameworks\dita\templates\topic\Topic.dita

you will see that it contains an ${id} editor variable which gets expanded when the user creates a new DITA topic.

The full list of editor variables can be found here:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ables.html

The most interesting editor variable is ${ask('user-message', param-type, 'default-value')} which would allow you to ask the user for certain values and have those values present instead of the editor variable when the user creates a new file from the template.

That would allow you to control the content of the newly created file but would not help with the other request (creating default files).

Also, when you create in Oxygen a new file from a certain template, the file is not saved right away, it is untitled, if the user closes it without saving, no modification on disk is made so maybe it would not be a good idea to start creating structures on disk if the user can close the newly created content and discard the created structure.

A way to achieve your full goal would be to implement a Workspace Access plugin (using our Java API):

http://www.oxygenxml.com/oxygen_sdk.htm ... er_Plugins

and maybe provide your own New button to the toolbar.
In this way you could have your own custom New dialog which would allow the user to choose from your templates list, create a certain structure on disk and then use our API to open the book file in Oxygen.

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