<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<!-- templates -->
   <extension
         point="org.eclipse.ui.editors.templates">
      <template
            autoinsert="true"
            name="main"
            icon="icons/template.gif"
            description="Main function pattern."
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.main">
<pattern>
if __name__ == '__main__':
    ${cursor}
</pattern>
      </template>
      <template
            autoinsert="true"
            name="ifmain"
            icon="icons/template.gif"
            description="Main function pattern."
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.main">
<pattern>
if __name__ == '__main__':
    ${cursor}
</pattern>
      </template>
      <template
            autoinsert="true"
            name="pd"
            icon="icons/template.gif"
            description="pdb"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.pdb">
         <pattern>import pdb;pdb.set_trace()</pattern>
      </template>
      <template
            autoinsert="true"
            name="pydevd"
            icon="icons/template.gif"
            description="pydevd.settrace()"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.pydevd">
         <pattern>import pydevd;pydevd.settrace()</pattern>
      </template>
      <template
            autoinsert="true"
            name="stdout"
            icon="icons/template.gif"
            description="Prints to sys.stdout"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.stdout">
         <pattern>print >> sys.stdout, ${data}</pattern>
      </template>
      <template
            autoinsert="true"
            name="stderr"
            icon="icons/template.gif"
            description="Prints to sys.stderr"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.stderr">
         <pattern>print >> sys.stderr, ${data}</pattern>
      </template>
      <template
            autoinsert="true"
            name="eq"
            icon="icons/template.gif"
            description="equals and not equals"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.eq">
<pattern>
def __eq__(self, o):
    if isinstance(o, self.__class__):
        ${pass}${cursor}

    return False

def __ne__(self, o):
	return not self == o
</pattern>

      </template>
      <template
            autoinsert="true"
            name="debugger"
            icon="icons/template.gif"
            description="Creates an in-module debugger"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.debug">
<pattern>
import sys
debugToggle = 1
def debug(*values):
    if debugToggle == 0: return
    print >> sys.stderr, "DBG>", 
    for v in values: print >> sys.stderr,  v,
    print >> sys.stderr, '.'
${cursor}
</pattern>
      </template>
      
      <template
            autoinsert="true"
            contextTypeId="org.python.pydev.editor.templates.python"
            description="print a debug line.(use the debugger macro to define an in-module global debug method first!)"
            icon="icons/template.gif"
            id="org.python.pydev.editor.templates.python.dbg"
            name="dbg">
         <pattern>debug('==>', ${data})${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            contextTypeId="org.python.pydev.editor.templates.python"
            description="Class definition (subclass)"
            icon="icons/template.gif"
            id="org.python.pydev.editor.templates.python.classo"
            name="classs">
         <pattern>class ${class}(${object}):${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            contextTypeId="org.python.pydev.editor.templates.python"
            description="Class definition (simple)"
            icon="icons/template.gif"
            id="org.python.pydev.editor.templates.python.class"
            name="class">
         <pattern>class ${class}:${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            contextTypeId="org.python.pydev.editor.templates.python"
            description="Method definition (class)"
            icon="icons/template.gif"
            id="org.python.pydev.editor.templates.python.defc"
            name="defc">
         <pattern>def ${method}(self):${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            contextTypeId="org.python.pydev.editor.templates.python"
            description="def __init__(self):"
            icon="icons/template.gif"
            id="org.python.pydev.editor.templates.python.ini"
            name="ini">
         <pattern>def __init__(self):${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            contextTypeId="org.python.pydev.editor.templates.python"
            description="def __init__(self, ${params})"
            icon="icons/template.gif"
            id="org.python.pydev.editor.templates.python.init"
            name="inip">
         <pattern>def __init__(self, ${params}):${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            contextTypeId="org.python.pydev.editor.templates.python"
            description="Method definition (class - with parameters)"
            icon="icons/template.gif"
            id="org.python.pydev.editor.templates.python.defp"
            name="defp">
         <pattern>def ${method}(self, ${params}):${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            name="def"
            icon="icons/template.gif"
            description="Method definition (global)"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.def">
         <pattern>def ${method}():${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            name="print"
            icon="icons/template.gif"
            description="print"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.print">
         <pattern>print ${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            name="printexc"
            icon="icons/template.gif"
            description="print current traceback"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.printexc">
         <pattern>import traceback;traceback.print_exc()${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            name="raiseruntimeerror"
            icon="icons/template.gif"
            description="raise RuntimeError('desc')"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.raiseruntimeerror">
         <pattern>raise RuntimeError('$(desc)')${cursor}</pattern>
      </template>
      <template
            autoinsert="true"
            name="raise"
            icon="icons/template.gif"
            description="raise"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.raise">
         <pattern>raise ${cursor}</pattern>
      </template>
      <template
            autoinsert="false"
            name="testCase"
            icon="icons/template.gif"
            description="Complete test-case module with pyunit"
            contextTypeId="org.python.pydev.editor.templates.python"
            id="org.python.pydev.editor.templates.python.testCase">
         <pattern>import unittest

class ${TestCase}(unittest.TestCase):
    
    def setUp(self):
        unittest.TestCase.setUp(self)
    
    def tearDown(self):
        unittest.TestCase.tearDown(self)
        
    def test${Met1}(self):
        ${pass}${cursor}
        
if __name__ == '__main__':
    unittest.main()
</pattern>


      </template>
      
      
      
      
      
      
      
      
      <!-- keywords
Done with:
template = '''<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="%s keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.%s"
   name="%s">
   <pattern>%s ${cursor}</pattern>
</template>'''

import keyword
for k in keyword.kwlist:
   print template % (k,k,k,k)
   
   but removing the ones that were already there (class def print raise)
       -->
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="and keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.and"
   name="and">
   <pattern>and ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="assert keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.assert"
   name="assert">
   <pattern>assert ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="break keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.break"
   name="break">
   <pattern>break${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="continue keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.continue"
   name="continue">
   <pattern>continue${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="del keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.del"
   name="del">
   <pattern>del ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="elif keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.elif"
   name="elif">
   <pattern>elif${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="else keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.else"
   name="else">
   <pattern>else${cursor}</pattern>
</template>
<!-- removed try.. related
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="except keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.except"
   name="except">
   <pattern>except${cursor}:</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="exec keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.exec"
   name="exec">
   <pattern>exec ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="finally keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.finally"
   name="finally">
   <pattern>finally:${cursor}</pattern>
</template>
-->
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="for keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.for"
   name="for">
   <pattern>for ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="from keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.from"
   name="from">
   <pattern>from ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="global keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.global"
   name="global">
   <pattern>global ${cursor}</pattern>
</template>
<!-- removed short ones
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="if keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.if"
   name="if">
   <pattern>if ${cursor}:</pattern>
</template>
-->
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="import keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.import"
   name="import">
   <pattern>import ${cursor}</pattern>
</template>
<!-- removed short ones
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="in keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.in"
   name="in">
   <pattern>in ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="is keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.is"
   name="is">
   <pattern>is ${cursor}</pattern>
</template>
-->
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="lambda keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.lambda"
   name="lambda">
   <pattern>lambda ${args}:${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="not keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.not"
   name="not">
   <pattern>not ${cursor}</pattern>
</template>
<!-- removed short ones
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="or keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.or"
   name="or">
   <pattern>or ${cursor}</pattern>
</template>
-->
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="pass keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.pass"
   name="pass">
   <pattern>pass${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="return keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.return"
   name="return">
   <pattern>return ${cursor}</pattern>
</template>
<!-- removed the try.. related because ctrl+1 handles it in a block (and better)
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="try keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.try"
   name="try">
   <pattern>try:${cursor}</pattern>
</template>
-->
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="while keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.while"
   name="while">
   <pattern>while ${cursor}:</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="yield keyword"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.yield"
   name="yield">
   <pattern>yield ${cursor}</pattern>
</template>
<template
   autoinsert="true"
   contextTypeId="org.python.pydev.editor.templates.python"
   description="property creation from inner methods"
   icon="icons/template.gif"
   id="org.python.pydev.editor.templates.python.property_inner"
   name="property_inner">
   <pattern>def ${prop}(): #@NoSelf
    doc = """${Docstring}""" #@UnusedVariable
   
    def fget(self):
        return self._${prop}
       
    def fset(self, value):
        self._${prop} = value
       
    def fdel(self):
        del self._${prop}
       
    return locals()
   
${prop} = property(**${prop}())${cursor}</pattern>
</template>

   </extension>

</plugin>
