<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
	
	<extension point="org.eclipse.help.contexts">
		<contexts
			file="help/context.xml"
			plugin="de.rcenvironment.core.gui.integration.workflowintegration">
		</contexts>
	</extension>

	<extension point="org.eclipse.help.toc">
   		<toc file="help/toc.xml"/>
	</extension>

	<extension
         point="org.eclipse.ui.handlers">
               <handler
            class="de.rcenvironment.core.gui.integration.workflowintegration.handlers.WorkflowFileIntegrationEditorHandler"
            commandId="de.rcenvironment.rce.gui.integration.workflowintegration.integrate.command">
            <enabledWhen>
               <and>
	               <with variable="activePartId">
	               		<equals value="org.eclipse.ui.navigator.ProjectExplorer" />
	               </with>
	               <with variable="selection">
	                  <iterate ifEmpty="false">
	                     <test property="org.eclipse.core.resources.name" value="*.wf" />
	                  </iterate>
	               </with>
               </and>
            </enabledWhen>
      </handler>
               <handler
            class="de.rcenvironment.core.gui.integration.workflowintegration.handlers.EditWorkflowIntegrationDialogHandler"
            commandId="de.rcenvironment.rce.gui.integration.workflowintegration.edit.command">
      </handler>
      <handler
            class="de.rcenvironment.core.gui.integration.workflowintegration.handlers.WIWorkflowNodeDisEnableHandler"
            commandId="de.rcenvironment.core.gui.integration.workflowintegration.node.disable">
         <enabledWhen>
            <reference
                  definitionId="WIworkflowNodesSelected">
            </reference>
         </enabledWhen>
         <visibleWhen>
            <reference
                  definitionId="workflowIntegrationEditorContext">
            </reference>
         </visibleWhen>
      </handler>
            <handler
            class="de.rcenvironment.core.gui.integration.workflowintegration.handlers.SelectedNodesIntegrationHandler"
            commandId="de.rcenvironment.core.gui.integration.workflowintegration.nodes.integrate">
            <enabledWhen>
            	<reference definitionId="workflowNodesSelected"/>
            </enabledWhen>
      </handler>
    </extension>
            
	<extension
         point="org.eclipse.ui.commands">
      <category
            description="Workflow integration commands."
            id="de.rcenvironment.rce.gui.integration.workflowintegration.category"
            name="Workflow Integration">
      </category>
      <command
            categoryId="de.rcenvironment.rce.gui.integration.workflowintegration.category"
            description="Integrate workflow as component."
            id="de.rcenvironment.rce.gui.integration.workflowintegration.integrate.command"
            name="Integrate Workflow">
      </command>
      <command
            categoryId="de.rcenvironment.rce.gui.integration.workflowintegration.category"
            description="Edit integrated workflow component."
            id="de.rcenvironment.rce.gui.integration.workflowintegration.edit.command"
            name="Edit Workflow Integration">
      </command>
      <command
      		categoryId="de.rcenvironment.rce.gui.integration.workflowintegration.category"
            id="de.rcenvironment.core.gui.integration.workflowintegration.node.disable"
            name="Disable">
      </command>
      <command
      		categoryId="de.rcenvironment.rce.gui.integration.workflowintegration.category"
            id="de.rcenvironment.core.gui.integration.workflowintegration.nodes.integrate"
            name="Integrate as Component">
      </command>
	</extension>     

	<extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="menu:de.rcenvironment.integration.menu?after=de.rcenvironment.rce.gui.workflow.integration.edit.command">
            <separator name="separator_workflow_integration" visible="true" />
            <command
                  commandId="de.rcenvironment.rce.gui.integration.workflowintegration.integrate.command"
                  icon="platform:/plugin/de.rcenvironment.core.gui.resources/resources/images/wf_integration_new.png"
                  label="Integrate Workflow File..."
                  style="push"
                  tooltip="Integrate a workflow file selected in the project explorer..." 
                  categoryId="de.rcenvironment.rce.gui.workflowintegration.category">
            </command>
            <command
                  commandId="de.rcenvironment.rce.gui.integration.workflowintegration.edit.command"
                  icon="platform:/plugin/de.rcenvironment.core.gui.resources/resources/images/wf_integration_edit.png"
                  label="Edit Workflow Integration..."
                  style="push"
                  tooltip="Select an integrated workflow to edit the configuration or to re-integrate an inactive configuration..." 
                  categoryId="de.rcenvironment.rce.gui.workflowintegration.category">
            </command>
            <separator name="separator_workflow_integration_end" visible="true" />
      </menuContribution>
      
      <menuContribution
            allPopups="false"
            locationURI="popup:de.rcenvironment.rce.gui.workflowintegration.Editor?before=additions">
             <command
               commandId="de.rcenvironment.core.gui.integration.workflowintegration.node.disable"
               icon="resources/icons/disable.gif"
               label="Enable/Disable Component"
               style="push">
               <visibleWhen>
		       		<reference definitionId="WIworkflowNodesSelected" />
			   </visibleWhen>
        	 </command>
      </menuContribution>
      
      <menuContribution
            allPopups="false"
            locationURI="popup:de.rcenvironment.rce.gui.workflow.editor.WorkflowEditor?before=additions">
        	 <command
               commandId="de.rcenvironment.core.gui.integration.workflowintegration.nodes.integrate"
               label="Integrate selected Components as Component"
               icon="platform:/plugin/de.rcenvironment.core.gui.resources/resources/images/wf_integration_new.png"
               style="push">
               <visibleWhen>
		       		<reference definitionId="workflowNodesSelected"/>
			   </visibleWhen>
        	 </command>
      </menuContribution>
      
      <menuContribution
            allPopups="false"
            locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu">
         <command
               commandId="de.rcenvironment.rce.gui.integration.workflowintegration.integrate.command"
               label="Integrate Workflow as Component"
               icon="platform:/plugin/de.rcenvironment.core.gui.resources/resources/images/wf_integration_new.png"
               style="push"
               tooltip="Integrate this workflow as a single workflow component.">
               <visibleWhen>
               <with
                     variable="selection">
                  <iterate
                        ifEmpty="false">
                     <test
                           property="org.eclipse.core.resources.name"
                           value="*.wf">
                     </test>
                  </iterate>
               </with>
            </visibleWhen>
         </command>
      </menuContribution>
	</extension>
	
	<extension
         id="de.rcenvironment.core.gui.workflow.keybinding.workflow.node.edit"
         point="org.eclipse.ui.bindings">
      <key
            commandId="de.rcenvironment.core.gui.integration.workflowintegration.node.disable"
            contextId="de.rcenvironment.rce.gui.integration.workflowintegration.editor.scope"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="M1+D">
      </key>
    </extension>
	
	<extension point="org.eclipse.ui.editors">
		<editor class="de.rcenvironment.core.gui.integration.workflowintegration.editor.WorkflowIntegrationEditor"
			contributorClass="de.rcenvironment.core.gui.workflow.WorkflowActionBarContributor"
			default="false" 
			icon="platform:/plugin/de.rcenvironment.core.gui.resources/resources/images/wf_integration_edit.png"
			id="de.rcenvironment.rce.gui.workflowintegration.Editor" 
			name="Workflow Integration Editor">
		</editor>
	</extension>
	
   <extension point="org.eclipse.core.expressions.definitions">
       <definition id="workflowIntegrationEditorContext">
         <with variable="activePartId">
             <equals value="de.rcenvironment.rce.gui.workflowintegration.Editor">
            </equals>
         </with>
      </definition>
      <definition id="WIworkflowNodesSelected">
        <and>
			<with variable="selection"> 
	        <iterate operator="or">
	            <instanceof value="de.rcenvironment.core.gui.workflow.parts.WorkflowNodePart" />
			</iterate>
			</with>
			<with variable="selection">
	            <count value="*" />
			</with>
			<with variable="activeEditorId">
               <equals value="de.rcenvironment.rce.gui.workflowintegration.Editor" />
            </with>
        </and>
      </definition>
      
      <definition id="WIconnectionSelected">
        <and>
			<with variable="selection"> 
		        <iterate operator="or">
		             <instanceof value="de.rcenvironment.core.gui.workflow.parts.ConnectionPart" />
				</iterate>
			</with>
			<with
              	variable="activeEditorId">
               <equals value="de.rcenvironment.rce.gui.workflowintegration.Editor" />
            </with>
        </and>
      </definition>
   </extension>
   
	<extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
      <propertyContributor 
      		contributorId="de.rcenvironment.rce.gui.integration.workflowintegration.WorkflowEditorPage"
            labelProvider="de.rcenvironment.core.gui.workflow.editor.properties.WorkflowLabelProvider">
      </propertyContributor>
    </extension>
   
   <extension
   		point="org.eclipse.ui.contexts">
   		<context
   			id="de.rcenvironment.rce.gui.integration.workflowintegration.editor.scope"
   			name="Workflow Integration Editor Context"
   			parentId="org.eclipse.ui.contexts.window">
   		</context>
   </extension>
	
</plugin>
