<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
    <extension point="org.eclipse.ui.newWizards">
        <wizard
            canFinishEarly="false"
            category="org.python.pydev.PythonCategory"
            class="org.python.pydev.django.ui.wizards.project.DjangoProjectWizard"
            descriptionImage="icons/django_logo.png"
            finalPerspective="org.python.pydev.ui.PythonPerspective"
            hasPages="true"
            icon="icons/django_16x16.png"
            id="org.python.pydev.django.ui.wizards.project.DjangoProjectWizard"
            name="PyDev Django Project"
            preferredPerspectives="org.python.pydev.ui.PythonPerspective"
            project="true"/>         
    </extension>
    
    <!-- nature: currently only used to know if actions should appear or not -->
    <extension
         id="djangoNature"
         name="Django Nature"
         point="org.eclipse.core.resources.natures">
        <runtime>
            <run class="org.python.pydev.django.nature.DjangoNature"/>
        </runtime>
    </extension>  
    
    <!-- django config -->
   <extension point="org.eclipse.ui.propertyPages">
      <page name="PyDev - Django"
            class="org.python.pydev.django.ui.DjangoProjectProperties"
            id="org.python.pydev.django.ui.DjangoProjectProperties">
         <filter name="projectNature"
               value="org.python.pydev.django.djangoNature"/>
         <enabledWhen>
            <adapt type="org.eclipse.core.resources.IProject"/>
         </enabledWhen>
      </page>
   </extension>
    
    <!-- launch for django -->
    <extension point="org.eclipse.debug.core.launchConfigurationTypes">
        <launchConfigurationType
            delegate="org.python.pydev.django.launching.DjangoLaunchConfigurationDelegate"
            id="org.python.pydev.django.launching.DjangoLaunchConfigurationType"
            modes="run, debug"
            name="PyDev Django"
            public="true">
        </launchConfigurationType>
    </extension>
    
    <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
        <launchConfigurationTypeImage
            icon="icons/django_16x16.png"
            configTypeID="org.python.pydev.django.launching.DjangoLaunchConfigurationType"
            id="org.python.pydev.django.launching.DjangoLaunchConfigurationTypeImage">
        </launchConfigurationTypeImage>
    </extension>



   <extension point="org.eclipse.core.expressions.propertyTesters">
      <propertyTester
            namespace="org.python.pydev.django"
            properties="pydev_django"
            type="org.python.pydev.navigator.elements.IWrappedResource"
            class="org.python.pydev.django.launching.DjangoPropertyTester"
            id="org.python.pydev.django.IWrappedResource.django_wrapped_resource">
      </propertyTester>
      <propertyTester
            namespace="org.python.pydev.django"
            properties="pydev_django"
            type="org.eclipse.core.resources.IProject"
            class="org.python.pydev.django.launching.DjangoPropertyTester"
            id="org.python.pydev.django.IWrappedResource.django_project">
      </propertyTester>
   </extension>


    <extension point="org.eclipse.debug.ui.launchShortcuts">
        <shortcut
            label="PyDev: Django"
            icon="icons/django_16x16.png"
            modes="run, debug"
            class="org.python.pydev.django.launching.DjangoLaunchShortcut"
            id="org.python.pydev.django.launching.DjangoLaunchShortcut">
            <!--this adds it to run-as...-->
            <contextualLaunch>
               <enablement>
              <with variable="selection">
                 <count value="1"/>
                 <iterate>
                    <and>
                        <adapt type="org.eclipse.core.resources.IProject"/>
                        <test property="org.eclipse.debug.ui.projectNature" value="org.python.pydev.django.djangoNature"/>
                        <test property="org.python.pydev.django.pydev_django" forcePluginActivation="true"/>
                    </and>
                 </iterate>
              </with>
               </enablement>
            </contextualLaunch>
            <configurationType id="org.python.pydev.django.launching.DjangoLaunchConfigurationType"/>
        </shortcut>
    </extension>
    
    <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
        <!-- Note that it's the same as the regular python launch! -->    
        <launchConfigurationTabGroup
            type="org.python.pydev.django.launching.DjangoLaunchConfigurationType"
            class="org.python.pydev.debug.ui.ProjectDependentTabGroup"
            id="org.python.pydev.django.launching.DjangoTabGroup">
        </launchConfigurationTabGroup>
    </extension>

	
    <extension point="org.eclipse.ui.popupMenus">
         <objectContribution
             adaptable="true"
             id="org.python.pydev.django.ui.actions.project"
             objectClass="org.eclipse.core.resources.IProject">
			 <menu id="org.python.pydev.django.ui.django.menu" label="D&amp;jango" icon="icons/django_16x16.png">        
                 <separator name="common"/>
                 <separator name="db"/>
                 <separator name="misc"/>
                 <separator name="nature"/>
             </menu>			  
             
	         <!-- misc -->
	         <action
	                class="org.python.pydev.django.debug.ui.actions.DjangoCreateApp"
	                enablesFor="+"
	                id="org.python.pydev.django.ui.actions.project.djangoCreateApp"
	                label="Create application (manage.py startapp)"
	                menubarPath="org.python.pydev.django.ui.django.menu/misc"
	                tooltip="Create a new Django App inside this project">
             </action>
	         <action
	               class="org.python.pydev.django.debug.ui.actions.DjangoWar"
	               enablesFor="+"
	               id="org.python.pydev.django.ui.actions.project.djangoWar"
	               label="Build WAR Package"               
	               menubarPath="org.python.pydev.django.ui.django.menu/misc"
	               tooltip="Create deployable WAR package for Django project">
	         </action>
	         
	         <!-- common -->
	         <action
	               class="org.python.pydev.django.debug.ui.actions.DjangoShell"
	               enablesFor="+"
	               id="org.python.pydev.django.ui.actions.project.djangoShell"
	               label="Shell with django environment"
	               menubarPath="org.python.pydev.django.ui.django.menu/common"
	               tooltip="Run Python Interactive Interpreter">
	         </action>
	         <action
	               class="org.python.pydev.django.debug.ui.actions.DjangoTestAction"
	               enablesFor="+"
	               id="org.python.pydev.django.debug.ui.actions.project.djangoTest"
	               label="Run Django Tests (manage.py test)" 
	               menubarPath="org.python.pydev.django.ui.django.menu/common"
	               tooltip="Run Django Tests">
	         </action>
	         <action
	               class="org.python.pydev.django.debug.ui.actions.DjangoSyncDB"
	               enablesFor="+"
	               id="org.python.pydev.django.debug.ui.actions.project.djangoSyncDB"
	               label="SyncDB (Django &#60; 1.7) (manage.py syncdb)" 
	               menubarPath="org.python.pydev.django.ui.django.menu/common"
	               tooltip="Migrate database Django &#60; 1.7">
	         </action>	   
	         <action
	               class="org.python.pydev.django.debug.ui.actions.DjangoMigrate"
	               enablesFor="+"
	               id="org.python.pydev.django.debug.ui.actions.project.djangoMigrate"
	               label="Migrate (Django &#62;= 1.7) (manage.py migrate)" 
	               menubarPath="org.python.pydev.django.ui.django.menu/common"
	               tooltip="Migrate database Django &#62;= 1.7">
	         </action>	   
	         <action
	               class="org.python.pydev.django.debug.ui.actions.DjangoMakeMigrations"
	               enablesFor="+"
	               id="org.python.pydev.django.debug.ui.actions.project.djangoMakeMigrations"
	               label="Make Migrations (Django &#62;= 1.7) (manage.py makemigrations)" 
	               menubarPath="org.python.pydev.django.ui.django.menu/common"
	               tooltip="Make database migrations Django &#62;= 1.7">
	         </action>	   
	         <action
	               class="org.python.pydev.django.debug.ui.actions.DjangoCustomCommand"
	               enablesFor="+"
	               id="org.python.pydev.django.debug.ui.actions.djangoCustomCommand"
	               label="Custom command (manage.py ${custom_command})" 
	               menubarPath="org.python.pydev.django.ui.django.menu/common"
	               tooltip="Create a custom command to pass to manage.py">
	         </action>	   
	         
	         
	         
              <!-- remove nature -->
             <action
                   class="org.python.pydev.django.nature.DjangoRemoveNatureAction"
                   enablesFor="1"
                   icon="icons/django_remove_nature.png"
                   id="org.python.pydev.django.nature.djangoRemoveNatureAction"
                   label="Remove Django Project Config"
                   menubarPath="org.python.pydev.django.ui.django.menu/nature"
                   tooltip="Remove the Django project configuration">
             </action>
	         <visibility><objectState name="projectNature" value="org.python.pydev.django.djangoNature"/></visibility>
          </objectContribution>
      
          <!-- add nature -->
          <objectContribution
                adaptable="true"
                id="org.python.pydev.django.nature.DjangoAddNatureAction"
                objectClass="org.eclipse.core.resources.IProject">
             <!-- note that the add is under PyDev (and the remove under Django) -->
             <menu id="org.python.pydev.ui.actions.menu" label="PyDev"/>
             <action
                   class="org.python.pydev.django.nature.DjangoAddNatureAction"
                   enablesFor="1"
                   icon="icons/django_nature.png"
                   id="org.python.pydev.django.nature.djangoAddNatureAction"
                   label="Set as Django Project"
                   menubarPath="org.python.pydev.ui.actions.menu/pydev"
                   tooltip="Set project as a Django project">
             </action>
             <visibility><not><objectState name="projectNature" value="org.python.pydev.django.djangoNature"/></not></visibility>
          </objectContribution>
      
          
    </extension>
    
    
<!-- Create the needed actions -->
   <extension point="org.python.pydev.pydev_pyedit_listener">
        <pyedit_listener_participant class="org.python.pydev.django.debug.ui.actions.DjangoActionCreatorPyEditListener"/>
   </extension>
       

</plugin>
