diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java index dfaa8b9e1e7..2cfed737828 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/opentype/ElementSelectionDialog.java @@ -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); diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java index b6633f70a1c..2e27320dcde 100644 --- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java +++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/ui/browser/typeinfo/TypeSelectionDialog.java @@ -501,10 +501,12 @@ public class TypeSelectionDialog extends TwoPaneElementSelector { section.put(SETTINGS_X_POS, location.x); section.put(SETTINGS_Y_POS, location.y); - Point size = getShell().getSize(); - section.put(SETTINGS_WIDTH, size.x); - section.put(SETTINGS_HEIGHT, size.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))); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java index 7cb4d43cf4b..219506e0d0e 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java @@ -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$ diff --git a/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_comments.htm b/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_comments.htm index 47d9fe847b9..2573ad2b11d 100644 --- a/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_comments.htm +++ b/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_comments.htm @@ -38,7 +38,7 @@ Type com+Ctrl+Space, 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. */ @@ -54,8 +54,7 @@ Type com+Ctrl+Space, and the following code is entered at the cursor lo Commenting out code
-C/C++ editor, code templates and search
-preferences
diff --git a/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_content_assist.htm b/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_content_assist.htm
index 1c70c3cacdc..2587fead256 100644
--- a/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_content_assist.htm
+++ b/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_content_assist.htm
@@ -41,23 +41,23 @@ You trigger the Code completion feature when you call Content Assist (such as wh
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.
-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 +
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.
When you enter a letter combination in the C/C++ editor, and type CTRL+SPACE (or right-click and click Content Assist), a -list of code elements and code templates that start with the letter combination that you typed is displayed.
+list of code elements and templates that start with the letter combination that you typed is displayed. -You can then select a code template from the list and it is inserted directly into your code.
+You can then select a template from the list and it is inserted directly into your code.
For example, the code template do while statement contains the following code:
+For example, the template do while statement contains the following code:
When you select the do code template from the list, you insert the following code:
+When you select the do template from the list, you insert the following code:
do { } while (condition);@@ -83,8 +83,8 @@ main(int argc, char **argv) {
Using Content Assist
-Creating and editing code templates
-Importing and exporting code templates
-
Creating and editing code templates
+
Creating and editing templates
Using templates
-
Importing and exporting code templates
+
Importing and exporting templates
diff --git a/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml b/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml
index f5e8610ea76..58bf70dea7a 100644
--- a/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml
+++ b/doc/org.eclipse.cdt.doc.user/contexts_CDT.xml
@@ -337,5 +337,14 @@
The
+
+
+C/C++ > Code Style > Code Templates preference page
+lets you configure the format of newly generated code stubs, comments and files.
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.
+ Action + |
+
+ Description + |
+
---|---|
+ New... + |
+
+ Opens the Code Template dialog to create a new file template. + |
+
+ Edit... + |
+
+ Opens the Code Template dialog to edit the currently selected code template. + |
+
+ Remove + |
+
+ Removes a user added file template. Predefined templates cannot be removed. + |
+
+ Import... + |
+
+ Imports templates from the file system. + |
+
+ Export... + |
+
+ Exports all selected templates to the file system. + |
+
+ Export All... + |
+
+ Exports all templates to the file system. + |
+
+ Template Name + |
+
+ Specifies + |
+
---|---|
+ Files + |
+
+ Header comment for new source or header files. +Note that this template can be referenced in source and header file templates with ${filecomment}. + |
+
+ Types + |
+
+ The comment for new types. +Note that this template can be referenced in source and header file templates with ${typecomment}. + |
+
+ Fields + |
+
+ The comment for new fields. + |
+
+ Constructors + |
+
+ The comment for new constructors. + |
+
+ Destructors + |
+
+ The comment for new destructors. + |
+
+ Methods + |
+
+ The comment for new methods. + |
+
+ Template Name + |
+
+ Description + |
+
---|---|
+ Method body + |
+
+ The 'Method body' templates are used when new method is created. + |
+
+ Constructor body + |
+
+ The 'Constructor body' templates are used when a constructor is created. + |
+
+ Destructor body + |
+
+ The 'Destructor body' templates are used when the destructor is created. + |
+
+ Template Name + |
+
+ Description + |
+
---|---|
+ Default C++ source template + |
+
+ Used by the New Class wizard and the New Source File wizard when a new C++ source file is created. +The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template. + |
+
+ Default C++ header template + |
+
+ Used by the New Class wizard and the New Header File wizard when a new C++ header file is created. +The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template. + |
+
+ Default C source template + |
+
+ Used by the New Source File wizard when a new C source file is created. +The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template. + |
+
+ Default C header template + |
+
+ Used by the New Header File wizard when a new C source file is created. +The template can specify where comments are added. Note that the template can contain the variable ${typecomment} and ${filecomment} that will be substituted by the evaluation of the Types respectively Files comment template. + |
+
+ Other file templates + |
+
+ File templates can be defined for other content types, e.g. Assembly or plain text. + |
+
The following fields and buttons appear in the dialog:
+
+ Action + |
+
+ Description + |
+
---|---|
+ Name + |
+
+ The name of the template. Only available for file templates. + |
+
+ Type + |
+
+ The file type (content type) of the template. Only available for file templates. + |
+
+ Description + |
+
+ A description of the template + |
+
+ Pattern + |
+
+ The template pattern. + |
+
+ Insert Variables... + |
+
+ Displays a list of pre-defined template specific variables. + |
+
Use the Templates preference panel to manipulate any of the common code templates predefined within CDT or create your own. To modify, delete, export, +
Use the Templates 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 Window > Preferences > C/C++ > Templates.
Opens the New Template dialog to create a new code template. | +Opens the New Template dialog to create a new template. | |
Opens the Edit Template dialog to edit the selected code template. | +Opens the Edit Template dialog to edit the selected template. | |
Removes the selected code templates from the list. | +Removes the selected templates from the list. | |
Imports a code template. | +Imports a template. | |
Exports the selected code templates. | +Exports the selected templates. | |
Enable to apply the currently selected code style to the code template. | +Enable to apply the currently selected code style to the template. |
The following topics provide information about code entry aids:
Content Assist uses code templates to enable you to quickly make use of commonly used code segments.
-To create a code template:
+Content Assist uses templates to enable you to quickly make use of commonly used code segments.
+To create a template:
To edit a code template:
+To edit a template:
Using Content Assist
-Importing and exporting code templates
-Code Templates page, Preferences window
Code Templates page
diff --git a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_comment_out.htm b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_comment_out.htm
index 46ebc3e3faa..ea513f2f0e5 100644
--- a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_comment_out.htm
+++ b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_comment_out.htm
@@ -42,8 +42,7 @@ described above.
-C/C++ editor, code templates and search
-preferences
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 +
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.
-To insert a code template or element:
+To insert a template or element:
-Creating and editing code templates
-Importing and exporting code templates
Content Assist page, Preferences window
diff --git a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_imp_code_temp.htm b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_imp_code_temp.htm
index 8e791624f28..be08f7cbd48 100644
--- a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_imp_code_temp.htm
+++ b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_imp_code_temp.htm
@@ -3,17 +3,17 @@
You can import and export code templates.
+You can import and export templates.
-Note: A code template must be an .xml file formatted as follows:
+Note: A template must be an .xml file formatted as follows:
<?xml version="1.0" encoding="UTF-8" ?> <templates> @@ -21,25 +21,25 @@ </templates>
To import a code template
+To import a template
To export a code template
+To export a template
@@ -48,11 +48,10 @@
Using Content Assist
-Creating and editing code templates
-Code Templates page, Preferences window
-Code Templates page
diff --git a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_shift_code.htm b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_shift_code.htm
index 37889481717..1718ae40a79 100644
--- a/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_shift_code.htm
+++ b/doc/org.eclipse.cdt.doc.user/tasks/cdt_t_shift_code.htm
@@ -37,8 +37,7 @@ editor.
-C/C++ editor, code templates and search
-preferences
-C/C++ editor, code templates and search
-preferences