<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
   <extension point="org.python.pydev.pydev_refactoring">
  		<refactoring_participant class="com.python.pydev.refactoring.refactorer.Refactorer"/>
   </extension>
   <!--
   <extension point="org.python.pydev.pydev_formatter">
  		<refactoring_participant class="com.python.pydev.refactoring.visitors.Formatter"/>
   </extension>
   -->
   <extension point="org.python.pydev.pydev_pyedit_listener">
  		<pyedit_listener_participant class="com.python.pydev.refactoring.markoccurrences.MarkOccurrencesDispatcher"/>
   </extension>
   
<!-- Initialize our preferences -->
   <extension
         point="org.eclipse.core.runtime.preferences">
      <initializer class="com.python.pydev.refactoring.RefactoringPreferencesInitializer"/>
   </extension>
<!-- Mark Occurrences preferences -->
   <extension
         id="com.python.pydev.refactoring.markoccurrences"
         point="org.eclipse.ui.keywords">
      <keyword
            id="com.python.pydev.refactoring.markoccurrences"
            label="highlight occurrences mark">
      </keyword>
   </extension>

   <extension point="org.eclipse.ui.preferencePages">
      <page
            category="org.python.pydev.prefs.editor"
            class="com.python.pydev.refactoring.ui.MarkOccurrencesPreferencesPage"
            id="com.python.pydev.refactoring.ui.MarkOccurrencesPreferencesPage"
            name="Mark Occurrences">
         <keywordReference
               id="com.python.pydev.refactoring.markoccurrences">
         </keywordReference>
      </page>
   </extension>
<!-- Hyperlink -->
   <extension point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
      <hyperlinkDetector
            class="com.python.pydev.refactoring.hyperlink.PythonElementHyperlinkDetector"
            id="org.python.pydev.editor.PythonElementHyperlinkDetector"
            name="PyDev Hyperlink Detector"
            targetId="org.python.pydev.editor.PythonEditor">
      </hyperlinkDetector>
   </extension>

<!-- Generate code (tdd) -->
   <extension point="org.python.pydev.pydev_ctrl_1">
        <ctrl_1_participant class="com.python.pydev.refactoring.tdd.TddCodeGenerationQuickFixParticipant"/>
   </extension>


<!-- Create the needed actions -->
   <extension point="org.python.pydev.pydev_pyedit_listener">
  		<pyedit_listener_participant class="com.python.pydev.refactoring.actions.ActionCreatorPyEditListener"/>
   </extension>
   
    <!--[[[cog
    #Note: run the install.py to regenerate the actions contents!
    #Actions below available only to PyDev editors (generating code for new actions now).
    import cog

    cog.outl('''
    <extension point="org.eclipse.ui.commands">
    ''')

    generate = [
        ('com.python.pydev.refactoring.actions.ToggleMarkOccurrences', 'Toggle Mark Occurrences', 'M2+M3+O'),
    ]
    for class_, desc, binding in generate:
        template = '''<command categoryId="org.python.pydev.ui.category.source"
        defaultHandler="%(class_)s"
        id="%(class_)s"
        name="%(desc)s">
    </command>'''
        cog.outl(template % dict(class_=class_, desc=desc, binding=binding))


    cog.outl('''
    </extension>
    ''')


    cog.outl('''
    <extension point="org.eclipse.ui.bindings">
    ''')


    for class_, desc, binding in generate:
        if not isinstance(binding, list):
            binding = [binding]
        for b in binding:
            template = '''<key commandId="%(class_)s"
            contextId="org.python.pydev.ui.editor.scope"
            sequence="%(binding)s"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
    </key>'''
            cog.outl(template % dict(class_=class_, desc=desc, binding=b))

    cog.outl('''
    </extension>
    ''')
    ]]]-->

    <extension point="org.eclipse.ui.commands">

    <command categoryId="org.python.pydev.ui.category.source"
        defaultHandler="com.python.pydev.refactoring.actions.ToggleMarkOccurrences"
        id="com.python.pydev.refactoring.actions.ToggleMarkOccurrences"
        name="Toggle Mark Occurrences">
    </command>

    </extension>


    <extension point="org.eclipse.ui.bindings">

    <key commandId="com.python.pydev.refactoring.actions.ToggleMarkOccurrences"
            contextId="org.python.pydev.ui.editor.scope"
            sequence="M2+M3+O"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
    </key>

    </extension>

    <!--[[[end]]]-->
   
   
   <extension point="org.eclipse.ui.bindings">
<!-- command: Find all references-->
      <key
            sequence="M1+M2+G"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="com.python.pydev.refactoring.actions.PyFindAllOccurrences"	
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>
<!-- command: Go To Defition-->
      <key
            sequence="F3"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.editor.actions.navigation.pyGoToDefinition"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>
      <key
            commandId="org.python.pydev.refactoring.ui.actions.GeneratePropertiesCommand"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M3+M2+T P"/>
      <key
            commandId="org.python.pydev.refactoring.ui.actions.ConstructorFieldCommand"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M3+M2+T C"/>
      <key
            commandId="org.python.pydev.refactoring.ui.actions.RenameCommand"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M3+M2+R"/>
      <key
            commandId="org.python.pydev.refactoring.ui.actions.OverrideMethodsCommand"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M3+M2+T O"/>
      <key
            sequence="M2+M3+L"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.refactoring.ui.actions.ExtractLocalCommand"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>
      <key
            sequence="M3+M2+T L"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.refactoring.ui.actions.ExtractLocalCommand"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>
      <key
            sequence="M2+M3+I"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.refactoring.ui.actions.InlineLocalCommand"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>
      <key
            sequence="M3+M2+T I"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.refactoring.ui.actions.InlineLocalCommand"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>
      <!-- waiting for bug fixes
      <key
            commandId="org.python.pydev.refactoring.ui.actions.GenerateDocstringCommand"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M3+M2+T D"/>
      <key
            sequence="M2+M3+I"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.refactoring.inlinelocalvariable"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>
      <key
            sequence="M3+M2+T I"
            contextId="org.python.pydev.ui.editor.scope"
            commandId="org.python.pydev.refactoring.inlinelocalvariable"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
      </key>

      -->
            
      <!--[[[cog
      import plugin_install
      import cog
      
      template = '''
      <key
            commandId="%s"
            sequence="%s"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
      '''
      
      for action in plugin_install.ACTIONS_AND_BINDING:
          for key in action.key:
              cog.outl(template % (action.id, key))
      ]]]-->

      <key
            commandId="org.python.pydev.refactoring.ui.actions.ExtractMethodActionCommand"
            sequence="M2+M3+M"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>


      <key
            commandId="org.python.pydev.refactoring.ui.actions.ExtractMethodActionCommand"
            sequence="M3+M2+T E"
            contextId="org.python.pydev.ui.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>

      <!--[[[end]]]-->
      
   </extension>

   <extension
         id="com.python.pydev.refactoring.search.FindOccurrencesSearchResultPage"
         point="org.eclipse.search.searchResultViewPages">
      <viewPage
            class="com.python.pydev.refactoring.search.FindOccurrencesSearchResultPage"
            id="com.python.pydev.refactoring.search.FindOccurrencesSearchResultPage"
            label="Python Search Result"
            searchResultClass="com.python.pydev.refactoring.search.FindOccurrencesSearchResult"/>
   </extension>










   <extension
         id="org.python.pydev.refactoring.commandContribution"
         point="org.eclipse.ui.commands">
      <category
            id="org.python.pydev.refactoring.pepticCategory"
            name="%peptic.category"
            description="%peptic.description"/>
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.GeneratePropertiesDescription"
            id="org.python.pydev.refactoring.ui.actions.GeneratePropertiesCommand"
            name="%peptic.GeneratePropertiesLabel"/>
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.GenerateConstructorFieldDescription"
            id="org.python.pydev.refactoring.ui.actions.ConstructorFieldCommand"
            name="%peptic.GenerateConstructorFieldLabel"/>
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.RenameDescription"
            id="org.python.pydev.refactoring.ui.actions.RenameCommand"
            name="%peptic.RenameLabel"/>
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.OverrideMethodsDescription"
            id="org.python.pydev.refactoring.ui.actions.OverrideMethodsCommand"
            name="%peptic.OverrideMethodsLabel"/>
            
      <!--[[[cog
      import plugin_install
      import cog
      
      template = '''
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%%peptic.%sDescription"
            id="%s"
            name="%%peptic.%sLabel"/>
      '''
      
      for action in plugin_install.ACTIONS_AND_BINDING:
          cog.outl(template % (action.desc, action.id, action.desc))
      ]]]-->

      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.ExtractMethodDescription"
            id="org.python.pydev.refactoring.ui.actions.ExtractMethodActionCommand"
            name="%peptic.ExtractMethodLabel"/>

      <!--[[[end]]]-->
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.ExtractLocalDescription"
            id="org.python.pydev.refactoring.ui.actions.ExtractLocalCommand"
            name="%peptic.ExtractLocalLabel"/>
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.InlineLocalDescription"
            id="org.python.pydev.refactoring.ui.actions.InlineLocalCommand"
            name="%peptic.InlineLocalLabel"/>
<!-- command: Find all references-->
      <command
            description="Find all references"
            id="com.python.pydev.refactoring.actions.PyFindAllOccurrences"
            categoryId="org.python.pydev.ui.category.source"
            name="Find all references"/>
<!-- command: Go To Defition-->
      <command
            name="Python Go To Definition"
            description="Goes to the definition of a python element"
            categoryId="org.python.pydev.ui.category.source"
            id="org.python.pydev.editor.actions.navigation.pyGoToDefinition"/>
      <!-- waiting for bug fixes
      <command
            categoryId="org.python.pydev.refactoring.pepticCategory"
            description="%peptic.GenerateDocstringDescription"
            id="org.python.pydev.refactoring.ui.actions.GenerateDocstringCommand"
            name="%peptic.GenerateDocstringLabel"/>
      -->
   </extension>
   <extension
         id="org.python.pydev.refactoring.editorContribution"
         name="editorContribution"
         point="org.eclipse.ui.editorActions">
      <editorContribution
            id="org.python.pydev.refactoring.editorContribution"
            targetID="org.python.pydev.editor.PythonEditor">
         <menu
               id="org.python.pydev.refactoring.refactoringMenu"
               label="Refac&amp;toring"
               path="edit">
            <separator name="pepticRefactoringGroup"/>
            <separator name="pepticSourceGroup"/>
            <separator name="tddGroup"/>
         </menu>
         <action
               class="com.python.pydev.refactoring.actions.PyRename"
               definitionId="org.python.pydev.refactoring.ui.actions.RenameCommand"
               id="org.python.pydev.refactoring.ui.actions.RenameMenuAction"
               label="%peptic.RenameLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticSourceGroup"
               style="push"/>
         <action
               class="org.python.pydev.refactoring.ui.actions.OverrideMethodsAction"
               definitionId="org.python.pydev.refactoring.ui.actions.OverrideMethodsCommand"
               id="org.python.pydev.refactoring.ui.actions.OverrideMethodsMenuAction"
               label="%peptic.OverrideMethodsLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticSourceGroup"
               style="push"/>
        <action
               class="org.python.pydev.refactoring.ui.actions.ConstructorFieldAction"
               definitionId="org.python.pydev.refactoring.ui.actions.ConstructorFieldCommand"
               id="org.python.pydev.refactoring.ui.actions.ConstructorFieldMenuAction"
               label="%peptic.GenerateConstructorFieldLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticSourceGroup"
               style="push"/>
         <action
               class="org.python.pydev.refactoring.ui.actions.GeneratePropertiesAction"
               definitionId="org.python.pydev.refactoring.ui.actions.GeneratePropertiesCommand"
               id="org.python.pydev.refactoring.actions.GenerateMenuAction"
               label="%peptic.GeneratePropertiesLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticSourceGroup"
               style="push"/>
	     <!-- waiting for bug fixes
         <action
               class="org.python.pydev.refactoring.ui.actions.GenerateDocstringAction"
               definitionId="org.python.pydev.refactoring.ui.actions.GenerateDocstringCommand"
               id="org.python.pydev.refactoring.ui.actions.GenerateDocstringMenuAction"
               label="%peptic.GenerateDocstringLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticSourceGroup"
               style="push"/>
         -->
         <!--[[[cog
         import plugin_install
         import cog
         
         template = '''
         <action
               class="%s"
               definitionId="%s"
               id="%s"
               label="%%peptic.%sLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/%s"
               style="push"/>
         '''
         
         for action in plugin_install.ACTIONS_AND_BINDING:
             cog.outl(template % (action.class_, action.id, action.id, action.desc, action.group))
         ]]]-->

         <action
               class="org.python.pydev.refactoring.ui.actions.ExtractMethodAction"
               definitionId="org.python.pydev.refactoring.ui.actions.ExtractMethodActionCommand"
               id="org.python.pydev.refactoring.ui.actions.ExtractMethodActionCommand"
               label="%peptic.ExtractMethodLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticRefactoringGroup"
               style="push"/>

         <!--[[[end]]]-->
         <action
               class="org.python.pydev.refactoring.ui.actions.ExtractLocalAction"
               definitionId="org.python.pydev.refactoring.ui.actions.ExtractLocalCommand"
               id="org.python.pydev.refactoring.ui.actions.ExtractLocalMenuAction"
               label="%peptic.ExtractLocalLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticRefactoringGroup"
               style="push"/>
         <action
               class="org.python.pydev.refactoring.ui.actions.InlineLocalAction"
               definitionId="org.python.pydev.refactoring.ui.actions.InlineLocalCommand"
               id="org.python.pydev.refactoring.ui.actions.InlineLocalMenuAction"
               label="%peptic.InlineLocalLabel"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticRefactoringGroup"
               style="push"/>
               
               
         <action
               class="com.python.pydev.refactoring.actions.PyFindAllOccurrences"
               definitionId="com.python.pydev.refactoring.actions.PyFindAllOccurrences"
               id="com.python.pydev.refactoring.actions.PyFindAllOccurrences"
               label="Find all occurrences"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticRefactoringGroup"
               style="push"/>
         <action
               class="com.python.pydev.refactoring.actions.PyGoToDefinition"
               definitionId="org.python.pydev.editor.actions.navigation.pyGoToDefinition"
               id="org.python.pydev.editor.actions.navigation.pyGoToDefinition"
               label="Go to Definition"
               menubarPath="org.python.pydev.refactoring.refactoringMenu/pepticRefactoringGroup"
               style="push">
         </action>

      </editorContribution>
   </extension>
   <extension
         id="org.python.pydev.refactoring.popupContribution"
         point="org.eclipse.ui.popupMenus">
      <viewerContribution
            id="org.python.pydev.refactoring.popupContribution"
            targetID="#PyEditContext">
         <menu
               id="org.python.pydev.editor.refactoring"
               label="Refactoring"
               path="Refactoring">
            <separator name="pepticRefactoringGroup"/>
            <separator name="pepticSourceGroup"/>
            <separator name="tddGroup"/>
         </menu>
         <action
               class="com.python.pydev.refactoring.actions.PyRename"
               definitionId="org.python.pydev.refactoring.ui.actions.RenameCommand"
               id="org.python.pydev.refactoring.ui.actions.RenameAction"
               label="%peptic.RenameLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticRefactoringGroup"/>
         <action
               class="org.python.pydev.refactoring.ui.actions.OverrideMethodsAction"
               definitionId="org.python.pydev.refactoring.ui.actions.OverrideMethodsCommand"
               id="org.python.pydev.refactoring.ui.actions.OverrideMethodsAction"
               label="%peptic.OverrideMethodsLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticSourceGroup"/>
         <action
               class="org.python.pydev.refactoring.ui.actions.ConstructorFieldAction"
               definitionId="org.python.pydev.refactoring.ui.actions.ConstructorFieldCommand"
               id="org.python.pydev.refactoring.ui.actions.ConstructorFieldAction"
               label="%peptic.GenerateConstructorFieldLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticSourceGroup"/>
         <action
               class="org.python.pydev.refactoring.ui.actions.GeneratePropertiesAction"
               definitionId="org.python.pydev.refactoring.ui.actions.GeneratePropertiesCommand"
               id="org.python.pydev.refactoring.ui.actions.GeneratePropertiesAction"
               label="%peptic.GeneratePropertiesLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticSourceGroup"/>
         <!-- waiting for bug fixes
         <action
               class="org.python.pydev.refactoring.ui.actions.GenerateDocstringAction"
               definitionId="org.python.pydev.refactoring.ui.actions.GenerateDocstringCommand"
               id="org.python.pydev.refactoring.ui.actions.GenerateDocstringAction"
               label="%peptic.GenerateDocstringLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticSourceGroup"/>
         -->
         <!--[[[cog
         import plugin_install
         import cog
         
         template = '''
         <action
               class="%s"
               definitionId="%s"
               id="%s"
               label="%%peptic.%sLabel"
               menubarPath="org.python.pydev.editor.refactoring/%s">
         </action>
         '''
         
         for action in plugin_install.ACTIONS_AND_BINDING:
             cog.outl(template % (action.class_, action.id, action.id, action.desc, action.group))
         ]]]-->

         <action
               class="org.python.pydev.refactoring.ui.actions.ExtractMethodAction"
               definitionId="org.python.pydev.refactoring.ui.actions.ExtractMethodActionCommand"
               id="org.python.pydev.refactoring.ui.actions.ExtractMethodActionCommand"
               label="%peptic.ExtractMethodLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticRefactoringGroup">
         </action>

         <!--[[[end]]]-->

          <action
               class="org.python.pydev.refactoring.ui.actions.ExtractLocalAction"
               definitionId="org.python.pydev.refactoring.ui.actions.ExtractLocalCommand"
               id="org.python.pydev.refactoring.ui.actions.ExtractLocalAction"
               label="%peptic.ExtractLocalLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticRefactoringGroup">
         </action>
          <action
               class="org.python.pydev.refactoring.ui.actions.InlineLocalAction"
               definitionId="org.python.pydev.refactoring.ui.actions.InlineLocalCommand"
               id="org.python.pydev.refactoring.ui.actions.InlineLocalAction"
               label="%peptic.InlineLocalLabel"
               menubarPath="org.python.pydev.editor.refactoring/pepticRefactoringGroup">
         </action>
         
      </viewerContribution>
   </extension>





</plugin>
