<?xml version="1.0" encoding="UTF-8"?>
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<?eclipse version="3.2"?>

<plugin>

   <!-- extension
         point="org.eclipse.debug.core.launchConfigurationTypes">
      <launchConfigurationType
            delegate="org.apache.hadoop.eclipse.launch.HadoopLaunchDelegate"
            id="org.apache.hadoop.eclipse.launch.StartServer"
            modes="run,debug"
            name="Start Hadoop Server"
            public="true"/> 
   </extension -->

   <extension 
         name="MapReduce Nature" 
         id="org.apache.hadoop.eclipse.Nature"
         point="org.eclipse.core.resources.natures">
      <runtime>
         <run class="org.apache.hadoop.eclipse.MapReduceNature"/>
      </runtime>
   </extension>

   <extension 
         point="org.eclipse.ui.ide.projectNatureImages">
   </extension>

   <!-- Wizards: new Mapper, Reducer, Driver -->
   <extension
         point="org.eclipse.ui.newWizards">
      <primaryWizard id="org.apache.hadoop.eclipse.NewProjectWizard"/> 
      <wizard
            category="org.apache.hadoop.eclipse.category"
            class="org.apache.hadoop.eclipse.NewMapReduceProjectWizard"
            finalPerspective="org.apache.hadoop.eclipse.Perspective"
            hasPages="true"
            icon="resources/Elephant16x16.gif"
            id="org.apache.hadoop.eclipse.NewProjectWizard"
            name="Map/Reduce Project"
            preferredPerspectives="org.apache.hadoop.eclipse.Perspective"
            project="true"/>
      <wizard
            category="org.apache.hadoop.eclipse.category"
            class="org.apache.hadoop.eclipse.NewMapperWizard"
            icon="resources/mapper16.png"
            id="org.apache.hadoop.eclipse.NewMapperWizard"
            name="Mapper"
            project="false"/>
      <wizard
            category="org.apache.hadoop.eclipse.category"
            class="org.apache.hadoop.eclipse.NewReducerWizard"
            icon="resources/reducer16.png"
            id="org.apache.hadoop.eclipse.NewReducerWizard"
            name="Reducer"
            project="false"/>
      <wizard
            category="org.apache.hadoop.eclipse.category"
            class="org.apache.hadoop.eclipse.NewDriverWizard"
            icon="resources/driver.png"
            id="org.apache.hadoop.eclipse.NewDriverWizard"
            name="MapReduce Driver"
            project="false"/>
      <category
            id="org.apache.hadoop.eclipse.category"
            name="Map/Reduce"/>
   </extension>

   <extension
         point="org.eclipse.debug.ui.launchConfigurationTypeImages">
      <launchConfigurationTypeImage
            configTypeID="org.apache.hadoop.eclipse.launch.Local"
            icon="resources/elephantblue16x16.gif"
            id="Hadouken.launchConfigurationTypeImage1"/>
   </extension>

   <extension
         point="org.eclipse.debug.ui.launchConfigurationTabGroups">
      <launchConfigurationTabGroup
            class="org.apache.hadoop.eclipse.launch.StartHadoopLaunchTabGroup"
            id="org.apache.hadoop.eclipse.launch.StartHadoopLaunchTabGroup"
            type="org.apache.hadoop.eclipse.launch.StartServer"/>
     
   </extension>

   <!-- Perspective: Map/Reduce -->
   <extension
         point="org.eclipse.ui.perspectives">
      <perspective
            class="org.apache.hadoop.eclipse.HadoopPerspectiveFactory"
            icon="resources/elephantblue16x16.gif"
            id="org.apache.hadoop.eclipse.Perspective"
            name="Map/Reduce"/>
   </extension>

   <!-- Needed: allows DFS Browsing in Navigator! [TODO] -->
   <extension
         point="org.eclipse.core.expressions.propertyTesters">
      <propertyTester
            class="org.apache.hadoop.eclipse.PropertyTester"
            id="mapreduce.deployable"
            namespace="mapreduce"
            properties="deployable"
            type="org.eclipse.core.resources.IResource"/>
      <propertyTester
            class="org.apache.hadoop.eclipse.PropertyTester"
            id="mapreduce.server"
            namespace="mapreduce"
            properties="server"
            type="org.eclipse.wst.server.core.IServer"/>
   </extension>

   <!-- Run on Hadoop action -->
   <extension
         point="org.eclipse.debug.ui.launchShortcuts">
      <shortcut
            class="org.apache.hadoop.eclipse.launch.HadoopApplicationLaunchShortcut"
            icon="resources/elephantblue16x16.gif"
            id="org.apache.hadoop.eclipse.launch.shortcut"
            label="Run on Hadoop"
            modes="run">
         <contextualLaunch>

           <enablement>
             <with variable="selection">
               <count value="1"/>
               <iterate>
                <or>
               	  <test property="org.eclipse.jdt.launching.hasMain"/>
               	  <and>
               	     <test property="org.eclipse.jdt.launching.isContainer"/>
               	     <test property="org.eclipse.jdt.launching.hasProjectNature" args="org.eclipse.jdt.core.javanature"/>
               	     <test property="org.eclipse.jdt.launching.hasProjectNature" args="org.apache.hadoop.eclipse.Nature"/>               	     
               	  </and>
               	</or>
               </iterate>
               </with>
           </enablement>
  		 </contextualLaunch>
         <perspective id="org.apache.hadoop.eclipse.Perspective"/>
      </shortcut>
   </extension>
   
   <!-- Hadoop locations view -->
   <extension
         point="org.eclipse.ui.views">
      <category
            id="org.apache.hadoop.eclipse.view.servers"
            name="MapReduce Tools"/>
      <view
            allowMultiple="false"
            category="org.apache.hadoop.eclipse.view.servers"
            class="org.apache.hadoop.eclipse.view.servers.ServerView"
            icon="resources/hadoop-logo-16x16.png"
            id="org.apache.hadoop.eclipse.view.servers"
            name="Map/Reduce Locations">
      </view>
   </extension>
   
   <!-- ??? -->
   <!-- extension
         point="org.eclipse.ui.cheatsheets.cheatSheetContent">
      <category
            id="org.apache.hadoop.eclipse.cheatsheet.Examples"
            name="MapReduce"/>
      <cheatsheet
            category="org.apache.hadoop.eclipse.cheatsheet.Examples"
            composite="true"
            contentFile="resources/HelloWorld.xml"
            id="org.apache.hadoop.eclipse.cheatsheet"
            name="Write a MapReduce application"/>
   </extension -->

   <!-- DFS Browser -->
   <extension
         point="org.eclipse.ui.navigator.navigatorContent">
      <navigatorContent
            activeByDefault="true"
            contentProvider="org.apache.hadoop.eclipse.dfs.DFSContentProvider"
            icon="resources/elephantblue16x16.gif"
            id="org.apache.hadoop.eclipse.views.dfscontent"
            labelProvider="org.apache.hadoop.eclipse.dfs.DFSContentProvider"
            name="Hadoop Distributed File Systems"
            priority="normal"
            providesSaveables="false">
         <triggerPoints>
         	<or>
             <instanceof value="org.apache.hadoop.eclipse.dfs.DFSPath"/>
             <adapt type="org.eclipse.core.resources.IResource">
                <test
                      forcePluginActivation="true"
                      property="mapreduce.deployable"/>
             </adapt>
    	    </or>
         </triggerPoints>
         <actionProvider class="org.apache.hadoop.eclipse.dfs.ActionProvider">
         </actionProvider>
         <possibleChildren>
         	<or>
    	        <instanceof value="org.eclipse.wst.server.core.IServer"/>
        	    <instanceof value="org.apache.hadoop.eclipse.dfs.DFSLocationsRoot"/>
        	    <instanceof value="org.apache.hadoop.eclipse.dfs.DFSLocation"/>
	            <instanceof value="org.apache.hadoop.eclipse.dfs.DFSPath"/>
        	</or>
         </possibleChildren>
      </navigatorContent>
   </extension>
   
   <!-- DFS Actions -->
   <extension
         point="org.eclipse.ui.navigator.viewer">
      <viewer
            viewerId="org.apache.hadoop.eclipse.dfs.DFSViewer">
            
          <popupMenu
                allowsPlatformContributions="true"
                id="org.apache.hadoop.eclipse.dfs.DFSViewer#PopupMenu">  
             <insertionPoint name="group.new"/>
             <insertionPoint
                   name="group.open"
                   separator="true"/>
             <insertionPoint name="group.openWith"/>   
             <insertionPoint name="group.edit"
                   separator="true"/>   
             <insertionPoint name="group.reorganize" />         
             <insertionPoint
                   name="group.port"
                   separator="true"/>     
             <insertionPoint
                   name="group.build"
                   separator="true"/> 
             <insertionPoint
                   name="group.generate"
                   separator="true"/> 
             <insertionPoint
                   name="group.search"
                   separator="true"/>              
             <insertionPoint
                   name="additions"
                   separator="true"/>              
             <insertionPoint
                   name="group.properties"
                   separator="true"/>
          </popupMenu>
            
      </viewer>
      <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
         <includes>
            <contentExtension
                  isRoot="false"
                  pattern="org.apache.hadoop.eclipse.views.dfscontent"/>
            <actionExtension pattern="org.apache.hadoop.eclipse.views.dfscontent.*"/>
         </includes>
      </viewerContentBinding>
   </extension>
   
   <!-- HDFS FileSystem registration [TODO] -->
   <!-- extension
         point="org.eclipse.core.filesystem.filesystems">
      <filesystem scheme="hdfs">
         <run class="org.apache.hadoop.eclipse.dfs.FileSystem"/>
      </filesystem>
   </extension -->
   
   <!--
   <extension
         point="org.eclipse.ui.popupMenus">
      <viewerContribution
            id="Hadouken.viewerContribution1"
            targetID="org.eclipse.ui.navigator.ProjectExplorer#PopupMenu"/>
   </extension> -->
   
   <!-- Preferences -->
   <extension
         point="org.eclipse.ui.preferencePages">
      <page
            class="org.apache.hadoop.eclipse.preferences.MapReducePreferencePage"
            id="org.apache.hadoop.eclipse.preferences.MapReducePreferencePage"
            name="Hadoop Map/Reduce"/>
   </extension>

   <extension
         point="org.eclipse.core.runtime.preferences">
      <initializer class="org.apache.hadoop.eclipse.preferences.PreferenceInitializer"/>
   </extension>
 
</plugin>
