<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
    Copyright (c) 2016 EfficiOS Inc. and others

    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License 2.0
    which accompanies this distribution, and is available at
    https://www.eclipse.org/legal/epl-2.0/

    SPDX-License-Identifier: EPL-2.0
 -->

<plugin>
   <extension
         point="org.eclipse.ui.handlers">
      <handler
            class="org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.handler.RunAnalysisHandler"
            commandId="org.eclipse.ui.navigate.openResource">
         <activeWhen>
            <and>
               <count
                     value="1">
               </count>
               <iterate
                     operator="and">
                  <instanceof
                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfOnDemandAnalysisElement">
                  </instanceof>
               </iterate>
            </and>
         </activeWhen>
      </handler>
      <handler
            class="org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.handler.OpenReportHandler"
            commandId="org.eclipse.ui.navigate.openResource">
         <activeWhen>
            <and>
               <iterate
                     ifEmpty="false"
                     operator="and">
                  <instanceof
                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfReportElement">
                  </instanceof>
               </iterate>
            </and>
         </activeWhen>
      </handler>
      <handler
            class="org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.handler.DeleteReportHandler"
            commandId="org.eclipse.tracecompass.tmf.ui.command.report_delete">
         <activeWhen>
            <and>
               <iterate
                     ifEmpty="false"
                     operator="and">
                  <instanceof
                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfReportElement">
                  </instanceof>
               </iterate>
            </and>
         </activeWhen>
      </handler>
      <handler
            class="org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.handler.RemoveAnalysisHandler"
            commandId="org.eclipse.tracecompass.tmf.ui.command.analysis_remove">
         <activeWhen>
            <and>
               <iterate
                     ifEmpty="false"
                     operator="and">
                  <instanceof
                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfUserDefinedOnDemandAnalysisElement">
                  </instanceof>
               </iterate>
            </and>
         </activeWhen>
      </handler>
      <handler
            class="org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.handler.AddAnalysisHandler"
            commandId="org.eclipse.tracecompass.tmf.ui.command.analysis_add">
         <activeWhen>
            <and>
               <count
                     value="1">
               </count>
               <iterate
                     operator="and">
                  <instanceof
                        value="org.eclipse.tracecompass.tmf.ui.project.model.TmfOnDemandAnalysesElement">
                  </instanceof>
               </iterate>
            </and>
         </activeWhen>
      </handler>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            categoryId="org.eclipse.linuxtools.tmf.ui.commands.category"
            description="%command.analysis_remove.description"
            id="org.eclipse.tracecompass.tmf.ui.command.analysis_remove"
            name="%command.analysis_remove">
      </command>
      <command
            categoryId="org.eclipse.linuxtools.tmf.ui.commands.category"
            description="%command.analysis_add.description"
            id="org.eclipse.tracecompass.tmf.ui.command.analysis_add"
            name="%command.analysis_add">
      </command>
      <command
            categoryId="org.eclipse.linuxtools.tmf.ui.commands.category"
            description="%command.report_delete.description"
            id="org.eclipse.tracecompass.tmf.ui.command.report_delete"
            name="%command.report_delete">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="popup:org.eclipse.ui.popup.any?after=group.open">
         <command
               commandId="org.eclipse.ui.navigate.openResource"
               label="%command.analysis_run"
               mnemonic="%command.analysis_run.mnemonic"
               style="push"
               tooltip="%command.analysis_run.description">
            <visibleWhen
                  checkEnabled="false">
               <with
                     variable="selection">
                  <count
                        value="1">
                  </count>
                  <iterate
                        ifEmpty="false"
                        operator="and">
                     <instanceof
                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfOnDemandAnalysisElement">
                     </instanceof>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
      <menuContribution
            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
         <command
               commandId="org.eclipse.tracecompass.tmf.ui.command.analysis_remove"
               label="%command.analysis_remove"
               mnemonic="%command.analysis_remove.mnemonic"
               style="push"
               tooltip="%command.analysis_remove.description">
            <visibleWhen
                  checkEnabled="false">
               <with
                     variable="selection">
                  <iterate
                        ifEmpty="false">
                     <instanceof
                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfUserDefinedOnDemandAnalysisElement">
                     </instanceof>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
      <menuContribution
            locationURI="popup:org.eclipse.ui.popup.any?after=additions">
         <command
               commandId="org.eclipse.tracecompass.tmf.ui.command.analysis_add"
               label="%command.analysis_add"
               mnemonic="%command.analysis_add.mnemonic"
               style="push"
               tooltip="%command.analysis_add.description">
            <visibleWhen
                  checkEnabled="false">
               <with
                     variable="selection">
                  <count
                        value="1">
                  </count>
                  <iterate>
                     <instanceof
                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfOnDemandAnalysesElement">
                     </instanceof>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
      <menuContribution
            allPopups="false"
            locationURI="popup:org.eclipse.ui.popup.any?after=group.open">
         <command
               commandId="org.eclipse.ui.navigate.openResource"
               label="%command.report_open"
               mnemonic="%command.report_open.mnemonic"
               style="push"
               tooltip="%command.report_open.description">
            <visibleWhen
                  checkEnabled="false">
               <with
                     variable="selection">
                  <iterate
                        ifEmpty="false"
                        operator="and">
                     <instanceof
                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfReportElement">
                     </instanceof>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
         <command
               commandId="org.eclipse.tracecompass.tmf.ui.command.report_delete"
               label="%command.report_delete"
               mnemonic="%command.report_delete.mnemonic"
               style="push"
               tooltip="%command.report_delete.description">
            <visibleWhen
                  checkEnabled="false">
               <with
                     variable="selection">
                  <iterate
                        ifEmpty="false">
                     <instanceof
                           value="org.eclipse.tracecompass.tmf.ui.project.model.TmfReportElement">
                     </instanceof>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.views">
      <view
            allowMultiple="true"
            category="org.eclipse.linuxtools.tmf.ui.views.category"
            class="org.eclipse.tracecompass.internal.provisional.analysis.lami.ui.views.LamiReportView"
            id="org.eclipse.tracecompass.analysis.lami.views.reportview"
            name="%analysis.report.view"
            restorable="false">
      </view>
   </extension>

</plugin>
