2003-11-28 21:50:02 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
< html lang = "en" >
< head >
< meta http-equiv = "Content-Language" content = "en-us" >
< meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" >
< title > Creating and editing code templates< / title >
< link rel = "stylesheet" type = "text/css" href = "../help.css" >
< / head >
< body >
< h1 > Creating and editing code templates< / h1 >
2004-06-24 10:49:13 +00:00
< p > Content Assist uses code templates enable you to use commonly used code snippets quickly. < / p >
2003-11-28 21:50:02 +00:00
< p > To create a code template:< / p >
< ol >
< li > Click < b > Window > Preferences< / b > .< / li >
< li > Expand < b > C/C++< / b > , and click < b > Code Templates< / b > .< / li >
2004-04-26 15:41:43 +00:00
< li > Click < b > New< / b > .< br >
2004-06-14 11:25:12 +00:00
< img src = "../images/code_templates_new.png" alt = "Creating a new Code Template Window" >
2004-04-26 15:41:43 +00:00
< / li >
2004-06-24 10:49:13 +00:00
< li > < p > Do the following: (if required)< / p >
2003-11-28 21:50:02 +00:00
< ul >
< li > In the < b > Name< / b > field, enter a template name.< / li >
2004-06-21 10:33:03 +00:00
< li > Select < b > Structure< / b > , < b > Global< / b > or < b > Function< / b > for either < b > C< / b > or < b > C++< / b > from the Context drop down list.< / li >
2004-06-24 10:49:13 +00:00
< li > In the < b > Description< / b > field, enter a description for your new code template.< / li >
2003-11-28 21:50:02 +00:00
< li > In the < b > Pattern< / b > field, enter the code for your template.< / li >
2004-06-24 10:49:13 +00:00
< li > Click < b > Insert Variable< / b > to add a variable from the list to the code you have entered in the Pattern box.< / li >
2003-11-28 21:50:02 +00:00
< / ul >
< / li >
< li > Click < b > OK< / b > .< br >
The new code template is now displayed in the list.< / li >
< / ol >
< p > To edit a code template:< / p >
< ol >
< li > Click < b > Window > Preferences< / b > .< / li >
< li > Expand < b > C/C++< / b > , and click < b > Code Templates< / b > .< / li >
2004-04-26 15:41:43 +00:00
< li > Click < b > Edit< / b > . The New Template dialog box opens.< br >
2004-06-14 11:25:12 +00:00
< img src = "../images/codetemplates_example.png" alt = "Editing a Code Template" >
2004-04-26 15:41:43 +00:00
< / li >
2003-11-28 21:50:02 +00:00
< li > < p > Do the following:< / p >
< ul >
< li > In the < b > Name< / b > field, change the template name to create a new
template based on the current template. < / li >
2004-06-24 10:49:13 +00:00
< li > Select < b > Structure< / b > , < b > Global< / b > or < b > Function< / b > for either < b > C< / b > or < b > C++< / b > from the Context drop down list to select where the template will appear.< / li >
2003-11-28 21:50:02 +00:00
< li > In the < b > Description< / b > field, change the description of the code
template to reflect your changes.< / li >
< li > In the < b > Pattern< / b > field, edit the code.< / li >
< li > Click < b > Insert Variable< / b > to add a variable from the list to the
code you have edited in the Pattern box.< / li >
< / ul >
< / li >
< li > Click < b > OK< / b > .< / li >
< / ol >
< p > < img border = "0" src = "../images/ngconcepts.gif" ALT = "Related concepts" width = "143" height = "21" >
< br >
< a href = "../concepts/cdt_c_content_assist.htm" > Content Assist< / a > < / p >
< p > < img border = "0" src = "../images/ngtasks.gif" ALT = "Related tasks" width = "143" height = "21" >
< br >
< a href = "cdt_t_contentassist.htm" > Using Content Assist< / a > < br >
< a href = "cdt_t_imp_code_temp.htm" > Importing and exporting code templates< / a > < / p >
< p > < img border = "0" src = "../images/ngref.gif" ALT = "Related reference" width = "143" height = "21" > < br >
< a href = "../reference/cdt_u_code_temp.htm" > Code Templates page, Preferences window< / a > < br >
< a href = "../reference/cdt_u_code_temp.htm" > Code Templates page< / a > < / p >
< p >
2004-06-24 10:49:13 +00:00
< img src = "../images/ng00_04a.gif" ALT = "IBM Copyright Statement" >
2003-11-28 21:50:02 +00:00
< / body >
< / html >