Page 1 of 1

Editor - predefined templates for inserting

Posted: Wed Sep 02, 2009 10:23 am
by honyk
Hello,

it would be nice to have possibility to specify custom templates (code fragments), which could be pasted similarly to other developer tools (Netbeans) - by writing short abbreviation (defined) and pressing Tab. For me it would be useful for identity transform in xslt templates. I use it very often but I still haven't remembered it yet.

Jan

Re: Editor - predefined templates for inserting

Posted: Wed Sep 02, 2009 11:05 am
by sorin_ristache
Hello,

Code templates (both built-in ones and user defined ones) are available and can be inserted using the content completion window. You define custom templates in Preferences -> Editor -> Templates -> Code Templates.

You insert a code template in the same way as inserting XML elements and attributes with content completion: you type a prefix of the name of the prefix and Ctrl-Space displays all the templates with that prefix. The XSLT identity transform template has the name ct (the copy template).


Regards,
Sorin

Re: Editor - predefined templates for inserting

Posted: Wed Sep 02, 2009 12:59 pm
by honyk
Wow, I wasn't aware of it! Excellent functionality, as usual. Thanks for quick response.

Re: Editor - predefined templates for inserting

Posted: Sun Sep 13, 2009 11:46 pm
by ra0543
Is this functionality available in Author view? If not, can the option to insert arbitrary user-defined code templates in Author view be added to a forthcoming release?

Re: Editor - predefined templates for inserting

Posted: Tue Sep 15, 2009 5:48 pm
by sorin_ristache
Hello,

In Author mode you insert a custom code template that are different than the elements inserted by content completion or by double click in Elements view with a custom extension action that you configure in the document type for your Author document. Custom extension actions are created based on the Author API published in the Author SDK (which includes also many examples of source code of Author actions) and are configured in the document type in Preferences -> Document Type Association.


Regards,
Sorin