<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
  <extension point="org.eclipse.ui.commands">
    <command id="com.microsoft.azuretools.container.commands.dockerize" name="Add Docker Support" categoryId="com.microsoft.ui.dropdown.category"></command>
    <command id="com.microsoft.azuretools.container.commands.dockerrun" name="Docker Run" categoryId="com.microsoft.ui.dropdown.category"></command>
    <command id="com.microsoft.azuretools.container.commands.pushimage" name="Push Image" categoryId="com.microsoft.ui.dropdown.category"></command>
    <command id="com.microsoft.azuretools.container.commands.publishwebappcontainers" name="Publish to Web App for Containers..." categoryId="com.microsoft.ui.dropdown.category"></command>
  </extension>
  <extension point="org.eclipse.ui.handlers">
    <handler commandId="com.microsoft.azuretools.container.commands.dockerize" class="com.microsoft.azuretools.container.handlers.DockerizeHandler"></handler>
    <handler commandId="com.microsoft.azuretools.container.commands.dockerrun" class="com.microsoft.azuretools.container.handlers.DockerRunHandler"></handler>
    <handler commandId="com.microsoft.azuretools.container.commands.pushimage" class="com.microsoft.azuretools.container.handlers.PushImageHandler"></handler>
    <handler commandId="com.microsoft.azuretools.container.commands.publishwebappcontainers" class="com.microsoft.azuretools.container.handlers.PublishHandler"></handler>
  </extension>
  <extension point="org.eclipse.ui.menus">
    <menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
      <menu label="Azure" id="com.microsoft.azuretools.webprojmenu" icon="icons/windowsAzure.png">
        <separator visible="true" name="Docker related commands"/>
        <command name="dockerize" commandId="com.microsoft.azuretools.container.commands.dockerize">
          <visibleWhen checkEnabled="false">
            <with variable="selection">
                <count value="1"/>
                <iterate>
                    <adapt type="org.eclipse.core.resources.IProject">
                        <not><reference definitionId="when.is.dockerized"/></not>
                        <test property="com.microsoft.ui.webapp.property.isSupportedProj"/>
                    </adapt>
                </iterate>
            </with>
          </visibleWhen>
        </command>
        <command name="dockerrun" commandId="com.microsoft.azuretools.container.commands.dockerrun">
            <visibleWhen checkEnabled="false">
                <with variable="selection">
                    <count value="1"/> 
                    <iterate>
                        <adapt type="org.eclipse.core.resources.IProject">
                            <test property="com.microsoft.ui.webapp.property.isSupportedProj"/>
                        </adapt>
                    </iterate> 
                </with>
            </visibleWhen>
        </command>
        <command name="pushimage" commandId="com.microsoft.azuretools.container.commands.pushimage">
            <visibleWhen checkEnabled="false">
                <with variable="selection">
                    <count value="1"/>
                    <iterate>
                        <adapt type="org.eclipse.core.resources.IProject">
                            <test property="com.microsoft.ui.webapp.property.isSupportedProj"/>
                        </adapt>
                    </iterate>
                </with>
            </visibleWhen>
        </command>
        <command name="publishwebappcontainers" commandId="com.microsoft.azuretools.container.commands.publishwebappcontainers">
            <visibleWhen checkEnabled="false">
                <with variable="selection">
                    <count value="1"/> 
                    <iterate>
                        <adapt type="org.eclipse.core.resources.IProject">
                            <test property="com.microsoft.ui.webapp.property.isSupportedProj"/>
                        </adapt>
                    </iterate> 
                </with>
            </visibleWhen>
        </command>
      </menu>
    </menuContribution>
    <menuContribution locationURI="menu:com.microsoft.ui.dropdown.toolbar.command">
      <command commandId="com.microsoft.azuretools.container.commands.publishwebappcontainers" style="push">
        <visibleWhen checkEnabled="false">
          <with variable="selection">
            <count value="1"/> 
            <iterate>
              <adapt type="org.eclipse.core.resources.IProject">
                <test property="com.microsoft.ui.webapp.property.isSupportedProj"/>
              </adapt>
            </iterate> 
          </with>
        </visibleWhen>
      </command>
    </menuContribution>
  </extension>
  <extension point="org.eclipse.core.expressions.definitions">
    <definition id="when.is.dockerized">
      <test property="com.microsoft.azuretools.container.testers.isDockerized" forcePluginActivation="true"></test>
    </definition>
  </extension>
  <extension point="org.eclipse.core.expressions.propertyTesters">
    <propertyTester class="com.microsoft.azuretools.container.testers.DockerizedTester" id="com.microsoft.azuretools.container.testers.DockerizedTester" namespace="com.microsoft.azuretools.container.testers" properties="isDockerized" type="java.lang.Object"></propertyTester>
  </extension>
  <extension point="org.eclipse.ui.commandImages">
    <image commandId="com.microsoft.azuretools.container.commands.publishwebappcontainers" icon="icons/PublishWebAppOnLinux_16.png"></image>
    <image commandId="com.microsoft.azuretools.container.commands.dockerrun" icon="icons/DockerRun_16.png"></image>
    <image commandId="com.microsoft.azuretools.container.commands.dockerize" icon="icons/Dockerize_16.png"></image>
    <image commandId="com.microsoft.azuretools.container.commands.pushimage" icon="icons/PushImage_16.png"></image>
  </extension>
</plugin>