<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<!--
   Copyright (c) 2013, 2018 Red Hat, Inc. 
   
   This program and the accompanying materials are made
   available under the terms of the Eclipse Public License 2.0
   which is available at https://www.eclipse.org/legal/epl-2.0/
  
   SPDX-License-Identifier: EPL-2.0

   Contributors: Red Hat - initial API and implementation
-->

<plugin>
 <extension
       point="org.eclipse.ui.commands">
        <category
            name="RPMStubby Commands"
            description="Commands for the RPM Stubby plugin"
            id="rpmstubby.commands">
      </category>

        <command
            categoryId="rpmstubby.commands"
            id="rpmstubby.stubifyFeature"
            description="%action.label"
            name="%action.label">
      </command>
       <command
            categoryId="rpmstubby.commands"
            id="rpmstubby.stubifyPom"
            description="%action.label"
            name="%action.label">
      </command>
       <command
             categoryId="rpmstubby.commands"
             description="%action.label"
             id="rpmstubby.stubifyEgg"
             name="%action.label">
       </command>
       <command
             categoryId="rpmstubby.commands"
             description="%action.label"
             id="rpmstubby.stubifyGem"
             name="%action.label">
       </command>
       <command
             categoryId="rpmstubby.commands"
             description="%action.label"
             id="rpmstubby.stubifyMakefilePL"
             name="%action.label">
       </command>

 </extension>
 <extension
       point="org.eclipse.ui.handlers">
    <handler
    	  class="org.eclipse.linuxtools.internal.rpmstubby.popup.actions.StubifyFeatureHandler"
          commandId="rpmstubby.stubifyFeature">
    </handler>
     <handler
    	  class="org.eclipse.linuxtools.internal.rpmstubby.popup.actions.StubifyPomHandler"
          commandId="rpmstubby.stubifyPom">
    </handler>
     <handler
           class="org.eclipse.linuxtools.internal.rpmstubby.popup.actions.StubifyEggHandler"
           commandId="rpmstubby.stubifyEgg">
     </handler>
     <handler
           class="org.eclipse.linuxtools.internal.rpmstubby.popup.actions.StubifyGemHandler"
           commandId="rpmstubby.stubifyGem">
     </handler>
     <handler
           class="org.eclipse.linuxtools.internal.rpmstubby.popup.actions.StubifyMakefilePLHandler"
           commandId="rpmstubby.stubifyMakefilePL">
     </handler>
 </extension>
  <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
         <command
               commandId="rpmstubby.stubifyFeature">
               <visibleWhen>
               <or>
                <with variable="selection">
        <iterate ifEmpty="false">
            <adapt type="org.eclipse.core.resources.IResource">
                <test property="org.eclipse.core.resources.name"
                         value="feature.xml"/>
            </adapt>
        </iterate>
    </with>
               </or>
               </visibleWhen>
         </command>
         <command
               commandId="rpmstubby.stubifyPom">
                <visibleWhen>
                <with variable="selection">
        <iterate ifEmpty="false">
            <adapt type="org.eclipse.core.resources.IResource">
                <test property="org.eclipse.core.resources.name"
                         value="pom.xml"/>
            </adapt>
        </iterate>
    </with>
                </visibleWhen>
         </command>
         <command
               commandId="rpmstubby.stubifyEgg">
            <visibleWhen>
               <with
                     variable="selection">
                  <iterate
                        ifEmpty="false">
                     <adapt
                           type="org.eclipse.core.resources.IResource">
                        <test
                              property="org.eclipse.core.resources.name"
                              value="setup.py">
                        </test>
                     </adapt>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
         <command
               commandId="rpmstubby.stubifyGem">
            <visibleWhen>
               <with
                     variable="selection">
                  <iterate
                        ifEmpty="false">
                     <adapt
                           type="org.eclipse.core.resources.IResource">
                        <test
                              property="org.eclipse.core.resources.name"
                              value="*.gemspec">
                        </test>
                     </adapt>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
         <command
               commandId="rpmstubby.stubifyMakefilePL">
            <visibleWhen>
               <with
                     variable="selection">
                  <iterate
                        ifEmpty="false">
                     <adapt
                           type="org.eclipse.core.resources.IResource">
                        <test
                              property="org.eclipse.core.resources.name"
                              value="*.PL">
                        </test>
                     </adapt>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
      </extension>
</plugin>
