diff --git a/documentation/trunk/eiffelstudio/eiffelstudio-reference/eiffelstudio-editor/Code-Templates.wiki b/documentation/trunk/eiffelstudio/eiffelstudio-reference/eiffelstudio-editor/Code-Templates.wiki index de836fbe..61cf5f79 100644 --- a/documentation/trunk/eiffelstudio/eiffelstudio-reference/eiffelstudio-editor/Code-Templates.wiki +++ b/documentation/trunk/eiffelstudio/eiffelstudio-reference/eiffelstudio-editor/Code-Templates.wiki @@ -51,111 +51,6 @@ When you insert a template into your code, it will often have some highlighted f [[Image:targetless_template_1_4|680px]] Figure 4. Targetless Auto-completion with code templates option list. - -====Context templates==== -The next example shows how to define a template that will be applicable to types that conforms ARRAY [COMPARABLE]. - -EiffelStudio editor provides automatic help to use code templates, in the case of context templates, when you type a dot ('.') character after a feature name, as part of feature call auto-completion, a new option will be available by pressing crtl+space -the list of available templates will be display. - -[[Image:target_template_1_0]] -Figure 1. Auto-completion with code template option - -At this point a user can select an available template, to insert into the current feature, back to the list of completion possibles by pressing crtl+space, or just ignore and continue editing the code. - -[[Image:target_template_1_1]] -Figure 2. Auto-completion with code templates option list - - - - -note - description: "[ - Code templates for Arrays of COMPARABLES. - ]" - template_version: "1.0" - - -class ARRAY_TEMPLATE [T -> COMPARABLE] - -inherit - - TEMPLATE [ARRAY [T]] - -feature -- Templates - - maximum: T - -- Maximum of `target' array. - note - tags: "Algorithm, Maximum, ARRAY" - do - across target as element loop - Result := Result.max (element.item) - end - end - - slice_maximum (low, high: INTEGER): T - -- Get the maximum of an array, - -- where the interval is defined by default - -- by array.lower |..| array.upper. - note - tags: "Algorithm, Maximum, ARRAY" - default: "target.lower, target.upper" - do - across low |..| high as i loop - Result := Result.max (target [i.item]) - end - end -end - - -====Targetless Templates==== -The next example shows how to define a template that will be applicable without any specific target. -To show the list of available targetless templates by pressing crtl+space you will see a new option in the list -of completion possibilities. - -[[Image:target_template_1_3]] -Figure 3. Targetless Auto-completion with code template option - -By pressing again crtl+space, the list of targetless templates will be available. - -[[Image:target_template_1_4|780px]] -Figure 4. Targetless Auto-completion with code templates option list. - - - -class TEMPLATE_DIRECTORY_GLOBAL - -inherit - - TEMPLATE - -feature -- Templates - - entries - -- Display entries of current directory. - note - title: "Entries for a directory" - tags: "Algorithm, entries , DIRECTORY" - local - l_path: PATH - l_dir: DIRECTORY - i,j: INTEGER - do - - create l_path.make_current - create l_dir.make_with_path (l_path) - - across - l_dir.entries as ic - loop - print (ic.item.name) - io.put_new_line - end - end -end - - ==Associating GUI with Template definition== The following image shows the relationship between the template definition and how they will look in the GUI.