mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
Add context help id for Open Element Dialog
Add user docs for Code Templates preference page
This commit is contained in:
parent
8de29f871a
commit
e51565a4f7
20 changed files with 407 additions and 70 deletions
|
@ -52,6 +52,8 @@ import org.eclipse.cdt.ui.browser.typeinfo.TypeSelectionDialog;
|
|||
|
||||
import org.eclipse.cdt.internal.core.browser.util.IndexModelUtil;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
|
||||
/**
|
||||
* A dialog to select an element from a filterable list of elements.
|
||||
*
|
||||
|
@ -161,6 +163,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
*/
|
||||
public ElementSelectionDialog(Shell parent) {
|
||||
super(parent);
|
||||
setHelpContextId(ICHelpContextIds.OPEN_ELEMENT_DIALOG);
|
||||
setMatchEmptyString(false);
|
||||
fUpdateJob= new UpdateElementsJob(OpenTypeMessages.ElementSelectionDialog_UpdateElementsJob_name);
|
||||
fUpdateJob.setRule(SINGLE_INSTANCE_RULE);
|
||||
|
|
|
@ -501,10 +501,12 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
|
|||
section.put(SETTINGS_X_POS, location.x);
|
||||
section.put(SETTINGS_Y_POS, location.y);
|
||||
|
||||
if (getTray() == null) {
|
||||
// only save size if help tray is not shown
|
||||
Point size = getShell().getSize();
|
||||
section.put(SETTINGS_WIDTH, size.x);
|
||||
section.put(SETTINGS_HEIGHT, size.y);
|
||||
|
||||
}
|
||||
section.put(SETTINGS_SHOW_NAMESPACES, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_NAMESPACE)));
|
||||
section.put(SETTINGS_SHOW_CLASSES, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_CLASS)));
|
||||
section.put(SETTINGS_SHOW_STRUCTS, fFilterMatcher.getVisibleTypes().contains(new Integer(ICElement.C_STRUCT)));
|
||||
|
|
|
@ -123,6 +123,7 @@ public interface ICHelpContextIds {
|
|||
|
||||
// Dialogs
|
||||
public static final String EDIT_TEMPLATE_DIALOG = PREFIX + "edit_template_dialog_context"; //$NON-NLS-1$
|
||||
public static final String OPEN_ELEMENT_DIALOG = PREFIX + "open_element_dialog_context"; //$NON-NLS-1$
|
||||
|
||||
// view parts
|
||||
public static final String TYPE_HIERARCHY_VIEW= PREFIX + "type_hierarchy_view_context"; //$NON-NLS-1$
|
||||
|
|
|
@ -38,7 +38,7 @@ Type <tt>com+Ctrl+Space</tt>, and the following code is entered at the cursor lo
|
|||
* author userid
|
||||
*
|
||||
* To change this generated comment edit the template variable "comment":
|
||||
* Window>Preferences>C>Templates.
|
||||
* Window > Preferences > C/C++ > Editor > Templates.
|
||||
*/
|
||||
</pre>
|
||||
|
||||
|
@ -54,8 +54,7 @@ Type <tt>com+Ctrl+Space</tt>, and the following code is entered at the cursor lo
|
|||
<a href="../tasks/cdt_t_comment_out.htm">Commenting out code</a></p>
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
<br>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor, code templates and search
|
||||
preferences</a></p>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor preferences</a></p>
|
||||
|
||||
<p>
|
||||
<img src="../images/rh03_04.gif" ALT="Red Hat Copyright Statement"><br>
|
||||
|
|
|
@ -41,23 +41,23 @@ You trigger the Code completion feature when you call Content Assist (such as wh
|
|||
|
||||
<p>You can view the signature of each item on the list in a pop-up by pointing to it. You can then select an item in the list to insert it directly into your code. </p>
|
||||
|
||||
<h2>Code templates</h2>
|
||||
<h2>Templates</h2>
|
||||
|
||||
<p>You can create and save code templates for frequently used sections of code, which will be inserted according to scope. The Content Assist feature also provides quick access to code
|
||||
<p>You can create and save templates for frequently used sections of code, which will be inserted according to scope. The Content Assist feature also provides quick access to code
|
||||
templates.</p>
|
||||
|
||||
<p>When you enter a letter combination in the C/C++ editor, and type <tt>CTRL+SPACE</tt> (or right-click and click <b>Content Assist</b>), a
|
||||
list of code elements and code templates that start with the letter combination that you typed is displayed.</p>
|
||||
list of code elements and templates that start with the letter combination that you typed is displayed.</p>
|
||||
|
||||
<p>You can then select a code template from the list and it is inserted directly into your code.</p>
|
||||
<p>You can then select a template from the list and it is inserted directly into your code.</p>
|
||||
|
||||
<img src="../images/editor_c_codetemplates_use.png" alt="C++ example showing Code Assist popup"></p>
|
||||
|
||||
<p>For example, the code template <samp>do while statement</samp> contains the following code:</p>
|
||||
<p>For example, the template <samp>do while statement</samp> contains the following code:</p>
|
||||
|
||||
<p><img src="../images/codetemplates_example.png" alt="Code Template showing do-while example"></p>
|
||||
|
||||
<p> When you select the <samp>do</samp> code template from the list, you insert the following code:</p>
|
||||
<p> When you select the <samp>do</samp> template from the list, you insert the following code:</p>
|
||||
|
||||
<p><pre>do {
|
||||
} while (condition);</pre></p>
|
||||
|
@ -83,8 +83,8 @@ main(int argc, char **argv) {
|
|||
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
|
||||
<br>
|
||||
<a href="../tasks/cdt_t_contentassist.htm">Using Content Assist</a><br>
|
||||
<a href="../tasks/cdt_t_add_codetemp.htm">Creating and editing code templates</a><br>
|
||||
<a href="../tasks/cdt_t_imp_code_temp.htm">Importing and exporting code templates</a></p>
|
||||
<a href="../tasks/cdt_t_add_codetemp.htm">Creating and editing templates</a><br>
|
||||
<a href="../tasks/cdt_t_imp_code_temp.htm">Importing and exporting templates</a></p>
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
<br>
|
||||
<a href="../reference/cdt_u_icons.htm">C/C++ perspective icons</a></p>
|
||||
|
|
|
@ -28,9 +28,9 @@ The templates that begin with that character appear. Double-click on a template
|
|||
</p>
|
||||
|
||||
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
|
||||
<br><a href="../tasks/cdt_t_contentassist.htm">Creating and editing code templates</a>
|
||||
<br><a href="../tasks/cdt_t_contentassist.htm">Creating and editing templates</a>
|
||||
<br><a href="../tasks/cdt_t_add_codetemp.htm">Using templates</a>
|
||||
<br><a href="../tasks/cdt_t_imp_code_temp.htm">Importing and exporting code templates</a>
|
||||
<br><a href="../tasks/cdt_t_imp_code_temp.htm">Importing and exporting templates</a>
|
||||
</p>
|
||||
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
|
|
|
@ -337,5 +337,14 @@
|
|||
<topic href="reference/cdt_u_search.htm"
|
||||
label="C/C++ search page"/>
|
||||
</context>
|
||||
<context id ="open_element_dialog_context">
|
||||
<description>Click below to see help.</description>
|
||||
<topic href="reference/cdt_u_open_element.htm"
|
||||
label="Open Element"/>
|
||||
</context>
|
||||
<context id="code_templates_preference_context">
|
||||
<description>Specify the templates used for code generation and new files.</description>
|
||||
<topic label="Code Template Preferences" href="reference/cdt_u_c_code_templates_pref.htm"/>
|
||||
</context>
|
||||
|
||||
</contexts>
|
||||
|
|
|
@ -0,0 +1,327 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>
|
||||
Code templates
|
||||
</title>
|
||||
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
|
||||
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
Code templates
|
||||
</h1>
|
||||
<p>The
|
||||
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.cdt.ui.preferences.CodeTemplatePreferencePage)")'>
|
||||
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Code Templates preference page">
|
||||
<b>C/C++ > Code Style > Code Templates</b></a> preference page
|
||||
lets you configure the format of newly generated code stubs, comments and files.</p>
|
||||
|
||||
<p>The code templates page contains templates that are used by actions that generate code and/or source files.
|
||||
E.g. the New Class wizard uses source and header file templates to create new files and code templates to insert generated method stubs.
|
||||
Templates contain variables that are substituted when the template is applied. Some variables are available in all templates, some are specific to templates.</p><table
|
||||
border="1" cellspacing="0" cellpadding="5" width="600">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<p>Action</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>Description</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>New...</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Opens the Code Template dialog to create a new file template.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Edit...</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Opens the Code Template dialog to edit the currently selected code template.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Remove</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Removes a user added file template. Predefined templates cannot be removed.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Import...</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Imports templates from the file system.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Export...</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Exports all selected templates to the file system.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Export All...</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Exports all templates to the file system.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<h2>Comment Templates</h2>
|
||||
|
||||
<table border="1" cellspacing="0" cellpadding="5" width="600">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<p>Template Name</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>Specifies</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Files</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Header comment for new source or header files.</p>
|
||||
<p>Note that this template can be referenced in source and header file templates with <b>${filecomment}</b>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Types</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The comment for new types.</p>
|
||||
<p>Note that this template can be referenced in source and header file templates with <b>${typecomment}</b>.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Fields</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The comment for new fields.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Constructors</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The comment for new constructors.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Destructors</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The comment for new destructors.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Methods</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The comment for new methods.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Code Templates</h2>
|
||||
<p></p>
|
||||
<table
|
||||
border="1" cellspacing="0" cellpadding="5" width="600">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<p>Template Name</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>Description</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Method body</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The 'Method body' templates are used when new method is created.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Constructor body</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The 'Constructor body' templates are used when a constructor is created.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Destructor body</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The 'Destructor body' templates are used when the destructor is created.</p>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>File Templates</h2>
|
||||
File templates can not only be defined and modified for C/C++ files, but also for other content types, like Assembly files or plain text files.
|
||||
The New File from Template wizard can be used to create new files based on one of the templates defined in this page.
|
||||
<p></p>
|
||||
<table
|
||||
border="1" cellspacing="0" cellpadding="5" width="600">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<p>Template Name</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>Description</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Default C++ source template</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Used by the New Class wizard and the New Source File wizard when a new C++ source file is created.</p>
|
||||
<p>The template can specify where comments are added. Note that the template can contain the variable <b>${typecomment}</b> and <b>${filecomment}</b> that will be substituted by the evaluation of the <b>Types</b> respectively <b>Files</b> comment template.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Default C++ header template</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Used by the New Class wizard and the New Header File wizard when a new C++ header file is created.</p>
|
||||
<p>The template can specify where comments are added. Note that the template can contain the variable <b>${typecomment}</b> and <b>${filecomment}</b> that will be substituted by the evaluation of the <b>Types</b> respectively <b>Files</b> comment template.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Default C source template</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Used by the New Source File wizard when a new C source file is created.</p>
|
||||
<p>The template can specify where comments are added. Note that the template can contain the variable <b>${typecomment}</b> and <b>${filecomment}</b> that will be substituted by the evaluation of the <b>Types</b> respectively <b>Files</b> comment template.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p>Default C header template</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Used by the New Header File wizard when a new C source file is created.</p>
|
||||
<p>The template can specify where comments are added. Note that the template can contain the variable <b>${typecomment}</b> and <b>${filecomment}</b> that will be substituted by the evaluation of the <b>Types</b> respectively <b>Files</b> comment template.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%">
|
||||
<p><i>Other file templates</i></p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>File templates can be defined for other content types, e.g. Assembly or plain text.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Edit Template dialog</h2>
|
||||
|
||||
<p>The following fields and buttons appear in the dialog:</p>
|
||||
<table border="1" cellspacing="0" cellpadding="5" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<p>Action</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>Description</p>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Name</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The name of the template. Only available for file templates.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Type</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The file type (content type) of the template. Only available for file templates.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Description</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>A description of the template</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Pattern</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>The template pattern.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p>Insert Variables...</p>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<p>Displays a list of pre-defined template specific variables.</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21"> <br>
|
||||
<a href="../concepts/cdt_o_code_entry.htm">Coding aids</a></p>
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
<br>
|
||||
<a href="cdt_o_ceditor_pref.htm">C/C++ editor preferences</a></p>
|
||||
<img src="../images/ng00_07.gif" ALT="IBM Copyright Statement" >
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<h1>Templates preferences</h1>
|
||||
|
||||
<p>Use the <b>Templates</b> preference panel to manipulate any of the common code templates predefined within CDT or create your own. To modify, delete, export,
|
||||
<p>Use the <b>Templates</b> preference panel to manipulate any of the common templates predefined within CDT or create your own. To modify, delete, export,
|
||||
import, or create your own templates click <b>Window > Preferences > C/C++ > Templates</b>.</p>
|
||||
<img src="../images/code_templates.png" alt="Code Templates Preferences">
|
||||
<table width="600px" cellpadding="5" cellspacing="0" border="1" >
|
||||
|
@ -23,15 +23,15 @@ import, or create your own templates click <b>Window > Preferences > C/C++
|
|||
<tbody>
|
||||
<tr>
|
||||
<td><dt>New...</dt></td>
|
||||
<td>Opens the <b>New Template</b> dialog to create a new code template.</td>
|
||||
<td>Opens the <b>New Template</b> dialog to create a new template.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><dt>Edit...</dt></td>
|
||||
<td>Opens the <b>Edit Template</b> dialog to edit the selected code template.</td>
|
||||
<td>Opens the <b>Edit Template</b> dialog to edit the selected template.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><dt>Remove</dt></td>
|
||||
<td>Removes the selected code templates from the list.</td>
|
||||
<td>Removes the selected templates from the list.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><dt>Restore Removed</dt></td>
|
||||
|
@ -43,15 +43,15 @@ import, or create your own templates click <b>Window > Preferences > C/C++
|
|||
</tr>
|
||||
<tr>
|
||||
<td><dt>Import...</dt></td>
|
||||
<td>Imports a code template.</td>
|
||||
<td>Imports a template.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><dt>Export...</dt></td>
|
||||
<td>Exports the selected code templates.</td>
|
||||
<td>Exports the selected templates.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><dt>Use code formatter</dt></td>
|
||||
<td>Enable to apply the currently selected code style to the code template.</td>
|
||||
<td>Enable to apply the currently selected code style to the template.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<h1>Working with Content Assist</h1>
|
||||
<p>The following topics provide information about code entry aids:</p>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_contentassist.htm">Using Content Assist</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_add_codetemp.htm">Creating and editing code templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_imp_code_temp.htm">Importing and exporting code templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_add_codetemp.htm">Creating and editing templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_imp_code_temp.htm">Importing and exporting templates</a><br>
|
||||
|
||||
|
||||
<p><img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" ></p>
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_comment_out.htm">Commenting out code</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_o_con_assist.htm">Working with Content Assist</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="75" height="1" alt=""><a style="text-decoration:none" href="cdt_t_contentassist.htm">Using Content Assist</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="75" height="1" alt=""><a style="text-decoration:none" href="cdt_t_add_codetemp.htm">Creating and editing code templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="75" height="1" alt=""><a style="text-decoration:none" href="cdt_t_imp_code_temp.htm">Importing and exporting code templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="75" height="1" alt=""><a style="text-decoration:none" href="cdt_t_add_codetemp.htm">Creating and editing templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="75" height="1" alt=""><a style="text-decoration:none" href="cdt_t_imp_code_temp.htm">Importing and exporting templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_shift_code.htm">Shifting lines of code to the right or left</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_open_declarations.htm">Navigating to C/C++ declarations</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_open_definitions.htm">Navigating to C/C++ definitions</a><br>
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_comment_out.htm">Commenting out code</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_o_con_assist.htm">Working with Content Assist</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_contentassist.htm">Using Content Assist</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_add_codetemp.htm">Creating and editing code templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_imp_code_temp.htm">Importing and exporting code templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_add_codetemp.htm">Creating and editing templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="50" height="1" alt=""><a style="text-decoration:none" href="cdt_t_imp_code_temp.htm">Importing and exporting templates</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_shift_code.htm">Shifting lines of code to the right or left</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_search.htm">Searching for C/C++ elements</a><br>
|
||||
<img src="../images/trans.gif" border="0" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_t_sel_search.htm">Selection Searching for C/C++ elements</a><br>
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
<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>
|
||||
<title>Creating and editing templates</title>
|
||||
<link rel="stylesheet" type="text/css" href="../help.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Creating and editing code templates</h1>
|
||||
<p>Content Assist uses code templates to enable you to quickly make use of commonly used code segments. </p>
|
||||
<p>To create a code template:</p>
|
||||
<h1>Creating and editing templates</h1>
|
||||
<p>Content Assist uses templates to enable you to quickly make use of commonly used code segments. </p>
|
||||
<p>To create a template:</p>
|
||||
|
||||
<ol>
|
||||
<li>Click <b>Window > Preferences</b>.</li>
|
||||
<li>Expand <b>C/C++</b>, expand <b>Content Assist</b> and select <b>Templates</b>.</li>
|
||||
<li>Expand <b>C/C++</b>, expand <b>Editor</b> and select <b>Templates</b>.</li>
|
||||
<li>Click <b>New</b>.<p><br>
|
||||
<img src="../images/code_templates_new.png" alt="Creating a new Code Template Window"><br></p>
|
||||
<br>
|
||||
|
@ -25,20 +25,20 @@
|
|||
<ul>
|
||||
<li>In the <b>Name</b> field, type a template name.</li>
|
||||
<li>In the <b>Context</b> drop down list, select the context type for the new template; either <b>C/C++</b> or a <b>Comment</b>.</li>
|
||||
<li>In the <b>Description</b> field, type a description for the new code template.</li>
|
||||
<li>In the <b>Description</b> field, type a description for the new template.</li>
|
||||
<li>In the <b>Pattern</b> field, type the code for this template.</li>
|
||||
<li>Click <b>Insert Variable</b> to add a variable from the list to the code you have entered in the <b>Pattern</b> field.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Click <b>OK</b>.<br>
|
||||
The new code template displays in the Templates list. </li>
|
||||
The new template displays in the Templates list. </li>
|
||||
</ol>
|
||||
|
||||
<p>To edit a code template:</p>
|
||||
<p>To edit a template:</p>
|
||||
|
||||
<ol>
|
||||
<li>Click <b>Window > Preferences</b>.</li>
|
||||
<li>Expand <b>C/C++</b>, expand <b>Content Assist</b> and select <b>Templates</b>.</li>
|
||||
<li>Expand <b>C/C++</b>, expand <b>Editor</b> and select <b>Templates</b>.</li>
|
||||
<li>Click <b>Edit</b>. The Edit Template dialog opens.<p><br>
|
||||
<img src="../images/codetemplates_example.png" alt="Editing a Code Template"><br></p>
|
||||
<br></li>
|
||||
|
@ -63,9 +63,8 @@
|
|||
<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>
|
||||
<a href="cdt_t_imp_code_temp.htm">Importing and exporting 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>
|
||||
<img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" >
|
||||
|
|
|
@ -42,8 +42,7 @@ described above.</p>
|
|||
<a href="cdt_o_con_assist.htm">Working with Content Assist</a></p>
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
<br>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor, code templates and search
|
||||
preferences</a></p>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor preferences</a></p>
|
||||
<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" >
|
||||
|
||||
</body>
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
|
||||
<h1>Using Content Assist</h1>
|
||||
|
||||
<p>Use Content Assist to insert C/C++ elements of your project, and code templates into your code. You can insert a code template into your source code rather than retyping
|
||||
<p>Use Content Assist to insert C/C++ elements of your project, and templates into your code. You can insert a template into your source code rather than retyping
|
||||
commonly-used snippets of code.</p>
|
||||
|
||||
<p>To insert a code template or element:</p>
|
||||
<p>To insert a template or element:</p>
|
||||
|
||||
<ol>
|
||||
<li>In the C/C++ editor, type at least the first letter of a code template or
|
||||
<li>In the C/C++ editor, type at least the first letter of a template or
|
||||
element then <b>Ctrl+Space</b>.<br>
|
||||
A list displays the code templates
|
||||
A list displays the templates
|
||||
<img border="0" src="../images/template_obj.gif" width="16" height="16"> followed by the elements that start with the letter combination you typed.</li><br>
|
||||
<img src="../images/contentAssist_example.png" alt="Editor View showing Content Assist Example">
|
||||
|
||||
|
@ -63,8 +63,8 @@ commonly-used snippets of code.</p>
|
|||
<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_add_codetemp.htm">Creating and editing code templates</a><br>
|
||||
<a href="cdt_t_imp_code_temp.htm">Importing and exporting code templates</a></p>
|
||||
<a href="cdt_t_add_codetemp.htm">Creating and editing templates</a><br>
|
||||
<a href="cdt_t_imp_code_temp.htm">Importing and exporting templates</a></p>
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
<br>
|
||||
<a href="../reference/cdt_u_c_editor_con_assist.htm">Content Assist page, Preferences window</a><br>
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Importing and exporting code templates</title>
|
||||
<title>Importing and exporting templates</title>
|
||||
<link rel="stylesheet" type="text/css" href="../help.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Importing and exporting code templates</h1>
|
||||
<h1>Importing and exporting templates</h1>
|
||||
|
||||
<p>You can import and export code templates.</p>
|
||||
<p>You can import and export templates.</p>
|
||||
|
||||
<p><b>Note:</b> A code template must be an .xml file formatted as follows:</p>
|
||||
<p><b>Note:</b> A template must be an .xml file formatted as follows:</p>
|
||||
|
||||
<pre><?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates>
|
||||
|
@ -21,25 +21,25 @@
|
|||
</templates></pre>
|
||||
<img src="../images/code_templates.png" alt="Code Templates Preferences">
|
||||
|
||||
<p>To import a code template</p>
|
||||
<p>To import a template</p>
|
||||
<ol>
|
||||
<li>Click <b>Window > Preferences</b>.</li>
|
||||
<li>Expand <b>C/C++</b>, and click <b>Code Templates</b>.
|
||||
<li>Expand <b>C/C++</b>, expand <b>Editor</b> and click <b>Templates</b>.
|
||||
</li>
|
||||
<li>Click <b>Import</b>.</li>
|
||||
<li>Select the template file that you want to import.</li>
|
||||
<li>Click <b>OK</b>.<br>
|
||||
The code template list is updated to include the template that you imported.</li>
|
||||
The template list is updated to include the template that you imported.</li>
|
||||
</ol>
|
||||
<p>To export a code template</p>
|
||||
<p>To export a template</p>
|
||||
|
||||
<ol>
|
||||
<li>Click <b>Window > Preferences</b>.</li>
|
||||
<li>Expand <b>C/C++</b>, and click <b>Code Templates</b>.</li>
|
||||
<li>Select the templates that you want to export and click the <b>Export...</b> or <b>Export All...</b> button. The Exporting x dialog opens where x is the number of code templates that you are exporting.</li>
|
||||
<li>In <b>File name</b> box, type the path where you want your code templates file to be saved.</li>
|
||||
<li>Expand <b>C/C++</b>, expand <b>Editor</b> and click <b>Templates</b>.</li>
|
||||
<li>Select the templates that you want to export and click the <b>Export...</b> button. The Export Templates dialog opens.</li>
|
||||
<li>In <b>File name</b> box, type the path where you want your templates file to be saved.</li>
|
||||
<li>Click <b>Save</b>.<br>
|
||||
The templates.xml file containing the code templates you exported is saved in your file system.</li>
|
||||
The templates.xml file containing the templates you exported is saved in your file system.</li>
|
||||
</ol>
|
||||
|
||||
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
|
||||
|
@ -48,11 +48,10 @@
|
|||
<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_add_codetemp.htm">Creating and editing code templates</a></p>
|
||||
<a href="cdt_t_add_codetemp.htm">Creating and editing 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>
|
||||
<a href="../reference/cdt_u_code_temp.htm">Templates page</a></p><p>
|
||||
|
||||
<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" >
|
||||
|
||||
|
|
|
@ -37,8 +37,7 @@ editor</a>.</p>
|
|||
<a href="cdt_t_cust_cpp_editor.htm">Customizing the C/C++ editor</a></p>
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
<br>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor, code templates and search
|
||||
preferences</a></p>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor preferences</a></p>
|
||||
<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" >
|
||||
|
||||
</body>
|
||||
|
|
|
@ -46,8 +46,7 @@ view</a><br>
|
|||
</p>
|
||||
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
||||
<br>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor, code templates and search
|
||||
preferences</a></p>
|
||||
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ editor preferences</a></p>
|
||||
<img src="../images/ng00_07.gif" ALT="IBM Copyright Statement" >
|
||||
|
||||
</body>
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
</topic>
|
||||
|
||||
<topic label="Code Style preferences" href="reference/cdt_u_c_code_style_pref.htm">
|
||||
<topic label="Code Templates preferences" href="reference/cdt_u_c_code_templates_pref.htm"/>
|
||||
</topic>
|
||||
|
||||
<topic label="C/C++ Editor preferences" href="reference/cdt_o_ceditor_pref.htm">
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
<topic label="Comment out code" href="tasks/cdt_t_comment_out.htm"/>
|
||||
<topic label="Working with Content Assist" href="tasks/cdt_o_con_assist.htm">
|
||||
<topic label="Using Content Assist" href="tasks/cdt_t_contentassist.htm"/>
|
||||
<topic label="Creating and editing code templates" href="tasks/cdt_t_add_codetemp.htm"/>
|
||||
<topic label="Importing and exporting code templates" href="tasks/cdt_t_imp_code_temp.htm"/>
|
||||
<topic label="Creating and editing templates" href="tasks/cdt_t_add_codetemp.htm"/>
|
||||
<topic label="Importing and exporting templates" href="tasks/cdt_t_imp_code_temp.htm"/>
|
||||
</topic>
|
||||
<topic label="Shift lines of code to the left or right" href="tasks/cdt_t_shift_code.htm"/>
|
||||
<topic label="Navigate to C/C++ declarations by name" href="tasks/cdt_t_open_declarations.htm"/>
|
||||
|
|
Loading…
Add table
Reference in a new issue