Improved completion processor
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / corext / template / default-templates.xml
index cd33d19..d635aae 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-(c) Copyright IBM Corp. 2000, 2001.
-All Rights Reserved.
--->
-
 <templates>
-
-  <!-- php -->
-
-  <template description="iterate over array" name="for" context="php"
->for (int ${index} = 0; ${index} &lt; ${array}.length; ${index}++) {
-       ${cursor}
+<template name="class" description="class template with constructor" context="php" enabled="true">class ${class_name} {
+  function ${class_name}() {
+         ${cursor}
+  }
 }</template>
+<template name="class" description="class with attribute" context="php" enabled="true">class ${class_name} {
+  var $$${attribute};
+  function ${class_name}() {
+         ${cursor}
+  }
+  
+  function set_${attribute}( $$${attr} ) {
+    $$this->${attribute} = $$${attr};
+       }
 
-  <template description="iterate over array w/ temporary variable" name="for" context="php"
->for (int ${index} = 0; ${index} &lt; ${array}.length; ${index}++) {
-       ${array_type} ${array_element} = ${array}[${index}];
-       ${cursor}
+       function get_${attribute}() {
+    return $$this->${attribute};
+       }
 }</template>
-
-  <template description="iterate over collection" name="for" context="php"
->for (Iterator ${iterator} = ${collection}.iterator(); ${iterator}.hasNext(); ) {
-       ${type} ${element} = (${type}) ${iterator}.next();
+<template name="for" description="iterate over array" context="php" enabled="true">for ($$${index} = 0; $$${index} &lt; sizeof($$${array}); $$${index}++) {
        ${cursor}
 }</template>
-
-  <template description="iterate with enumeration" name="while" context="php"
->while (${enumeration}.hasMoreElements()) {
-       ${type} ${element} = (${type}) ${enumeration}.nextElement();
+<template name="for" description="iterate over array w/ temporary variable" context="php" enabled="true">for ($$${index} = 0; $$${index} &lt; sizeof($$${array}); $$${index}++) {
+       $$${array_element} = $$${array}[$$${index}];
        ${cursor}
 }</template>
-
-  <template description="iterate with iterator" name="while" context="php"
->while (${iterator}.hasNext()) {
-       ${type} ${element} = (${type}) ${iterator}.next();
+<template name="function" description="function template" context="php" enabled="true">function ${function_name} () {
        ${cursor}
 }</template>
-
-  <template description="do while statement" name="do" context="php"
->do {
+<template name="function" description="function template with return" context="php" enabled="true">function ${function_name} () {
+       return (${cursor});
+}</template>
+<template name="while" description="while iteration" context="php" enabled="true">while (${condition}) {
        ${cursor}
-} while (${condition});</template>
-
-  <template description="switch case statement" name="switch" context="php"
->switch (${key}) {
+}</template>
+<template name="switch" description="switch case statement" context="php" enabled="true">switch (${key}) {
        case ${value}:
                ${cursor}
                break;
 
        default:
                break;
-}</template>
-
-  <template description="if statement" name="if" context="php"
->if (${condition}) {
+}</template><template name="if" description="if statement" context="php" enabled="true">if (${condition}) {
        ${cursor}
-}</template>
-
-  <template description="if else statement" name="ifelse" context="php"
->if (${condition}) {
+}</template><template name="ifelse" description="if else statement" context="php" enabled="true">if (${condition}) {
        ${cursor}
 } else {
        
-}</template>
-
-  <template description="else if block" name="elseif" context="php"
->else if (${condition}) {
-       ${cursor}
-}</template>
-
-  <template description="else block" name="else" context="php"
->else {
-       ${cursor}
-}</template>
-
-  <template description="try catch block" name="try" context="php"
->try {
+}</template><template name="elseif" description="else if block" context="php" enabled="true">elseif (${condition}) {
        ${cursor}
-} catch (${Exception} e) {
-}</template>
-
-  <template description="catch block" name="catch" context="php"
->catch (${Exception} e) {
-       ${cursor}
-}</template>
-
-  <template description="main method" name="main" context="php"
->
-public static void main(String[] args) {
-       ${cursor}
-}</template>
-
-  <template description="public method" name="public_method" context="php"
->
-public ${return_type} ${name}(${arguments}) {
+}</template><template name="else" description="else block" context="php" enabled="true">else {
        ${cursor}
 }</template>
-
-  <template description="protected method" name="protected_method" context="php"
->protected ${return_type} ${name}(${arguments}) {
-       ${cursor}
-}</template>
-
-  <template description="private method" name="private_method" context="php"
->private ${return_type} ${name}(${arguments}) {
-       ${cursor}
-}</template>
-
-  <template description="private static method" name="private_static_method" context="php"
->private static ${return_type} ${name}(${arguments}) {
-       ${cursor}
-}</template>
-
-  <template description="dynamic type test and cast" name="instanceof" context="php"
->if (${name} instanceof ${type}) {
-       ${type} ${new_name} = (${type})${name};
-       ${cursor}
-}</template>
-
-  <template description="dynamic cast" name="cast" context="php"
->${type} ${new_name} = (${type}) ${name};
-</template>
-
-  <template description="create new object" name="new" context="php"
->${type} ${name} = new ${type}(${arguments});
-</template>
-
-  <template description="lazy creation" name="lazy" context="php"
->if (${name} == null) {
-       ${name} = new ${type}(${arguments});
-       ${cursor}
-}
-
-return ${name};
-</template>
-
-  <template description="convert collection to array" name="toarray" context="php"
-  >(${type}[]) ${collection}.toArray(new ${type}[${collection}.size()]);</template>
-
-  <template context="php" description="file comment used by the class and interface wizards" enabled="true" name="filecomment">/**
- * Created on ${date}
+<template name="filecomment" description="file comment used by the class and interface wizards" context="php" enabled="true">/**
+ * Created on ${date} by ${user}
  *
- * To change this generated comment edit the template variable &quot;filecomment&quot;:
- * Window&gt;Preferences&gt;Java&gt;Templates.
- * To enable and disable the creation of file comments go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation.
- */</template>
-
-<template name="typecomment" description="type comment used by the class and interface wizards" context="php" enabled="true">/**
+ */</template><template name="functioncomment" description="function comment" context="php" enabled="true">/**
  * @author ${user}
  *
- * To change this generated comment edit the template variable &quot;typecomment&quot;:
- * Window&gt;Preferences&gt;Java&gt;Templates.
- * To enable and disable the creation of type comments go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation.
- */</template> 
-
-  <template description="print to standard out" name="stdout" context="php"
-  >System.out.println(${cursor});</template>
-
-  <template description="print to standard error" name="stderr" context="php"
-  >System.err.println(${cursor});</template>
-
-  <!-- html -->
-
-  <template description="&lt;code&gt;&lt;/code&gt;" name="&lt;code&gt;" context="html"
-  >&lt;code&gt;${cursor}&lt;/code&gt;</template>
-
-  <template description="&lt;code&gt;null&lt;/code&gt;" name="&lt;code&gt;" context="html"
-  >&lt;code&gt;null&lt;/code&gt;</template>
-
-  <template description="&lt;pre&gt;&lt;/pre&gt;" name="&lt;pre&gt;" context="html"
-  >&lt;pre&gt;${cursor}&lt;/pre&gt;</template>
-
-  <template description="&lt;b&gt;&lt;/b&gt;" name="&lt;b&gt;" context="html"
-  >&lt;b&gt;${cursor}&lt;/b&gt;</template>
-
-  <template description="&lt;i&gt;&lt;/i&gt;" name="&lt;i&gt;" context="html"
-  >&lt;i&gt;${cursor}&lt;/i&gt;</template>
-
-  <template description="author name" name="@author" context="html"
-  >@author ${user}</template>
-
-</templates>
+ */</template>
+ <template name="echo" description="echo a string" context="php" enabled="true">echo "${string}";
+  ${cursor}</template>
+ </templates>
\ No newline at end of file