<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.ui">
<annotation>
      <appInfo>
         <meta.schema plugin="org.eclipse.ui" id="handlers" name="Handlers"/>
      </appInfo>
      <documentation>
         &lt;p&gt;
The handlers extension point is an elaboration of the experimental &lt;code&gt;handlerSubmission&lt;/code&gt; element defined in Eclipse 3.0.  A handler is the behaviour of a command at a particular point in time.  A command can have zero or more handlers associated with it.  At any one point in time, however, a command will either have no active handler or one active handler.  The active handler is the one which is currently responsible for carrying out the behaviour of the command.  This is very similar to the concept of an action handler and a retargettable action.
&lt;/p&gt;
&lt;p&gt;
The handlers extension point allows a plug-in developer to specify a handler that should become active and/or enabled under certain conditions.  If a handler is inactive, then no command will delegate its behaviour to the handler.  If a handler is disabled, then the handler will not be asked to execute; execution of the handler is blocked.  The conditions are defined using the expression language facility added during 3.0.  They are expressed using &lt;code&gt;activeWhen&lt;/code&gt; and &lt;code&gt;enabledWhen&lt;/code&gt; clauses.
&lt;/p&gt;
&lt;p&gt;
The workbench provides some variables that these expressions can rely on.  The variables supported are: the active contexts, the active editor, the active part and the current selection.  While not supported in this initial design, it is easy to see how it would be possible to add other variables or even allow plug-in developers to contribute other variables.
&lt;/p&gt;
&lt;p&gt;
A handler that specifies no conditions is a default handler.  A default handler is only active if no other handler has all of its conditions satisfied.  If two handlers still have conditions that are satisfied, then the conditions are compared.  The idea is to select a handler whose condition is more specific or more local.  To do this, the variables referred to by the condition are looked at.  The condition that refers to the most specific variable &quot;wins&quot;.  The order of specificity (from least specific to most specific) is defined in &lt;code&gt;org.eclipse.ui.ISources&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
If this still doesn&apos;t resolve the conflict, then no handler is active.  If a particular tracing option is turned on, then this leads to a message in the log.  A conflict can also occur if there are two default handlers.  It is the responsibility of the plug-in developers and integration testers to ensure that this does not happen.
These conditions are used to avoid unnecessary plug-in loading.  These handler definitions are wrapped in a proxy.  For a proxy to load its underlying handler, two things must happen: the conditions for the proxy must be met so that it becomes active, and the command must be asked to do something which it must delegate (e.g., execute()).
&lt;/p&gt;
      </documentation>
   </annotation>

   <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>

   <element name="extension">
      <complexType>
         <sequence>
            <element ref="handler"/>
         </sequence>
         <attribute name="point" type="string" use="required">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="id" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="name" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
               <appInfo>
                  <meta.attribute translatable="true"/>
               </appInfo>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <element name="handler">
      <complexType>
         <choice>
            <element ref="activeWhen" minOccurs="0" maxOccurs="1"/>
            <element ref="class" minOccurs="0" maxOccurs="1"/>
            <element ref="enabledWhen" minOccurs="0" maxOccurs="1"/>
         </choice>
         <attribute name="commandId" type="string" use="required">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="class" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
               <appInfo>
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
               </appInfo>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <element name="activeWhen">
      <complexType>
         <choice>
            <element ref="not"/>
            <element ref="and"/>
            <element ref="or"/>
            <element ref="instanceof"/>
            <element ref="test"/>
            <element ref="systemTest"/>
            <element ref="equals"/>
            <element ref="count"/>
            <element ref="with"/>
            <element ref="resolve"/>
            <element ref="adapt"/>
            <element ref="iterate"/>
         </choice>
      </complexType>
   </element>

   <element name="enabledWhen">
      <complexType>
         <choice>
            <element ref="not"/>
            <element ref="and"/>
            <element ref="or"/>
            <element ref="instanceof"/>
            <element ref="test"/>
            <element ref="systemTest"/>
            <element ref="equals"/>
            <element ref="count"/>
            <element ref="with"/>
            <element ref="resolve"/>
            <element ref="adapt"/>
            <element ref="iterate"/>
         </choice>
      </complexType>
   </element>

   <element name="class">
      <complexType>
         <choice>
            <element ref="parameter"/>
         </choice>
         <attribute name="class" type="string">
            <annotation>
               <documentation>
                  
               </documentation>
               <appInfo>
                  <meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
               </appInfo>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <element name="parameter">
      <complexType>
         <attribute name="name" type="string" use="required">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
         <attribute name="value" type="string" use="required">
            <annotation>
               <documentation>
                  
               </documentation>
            </annotation>
         </attribute>
      </complexType>
   </element>

   <annotation>
      <appInfo>
         <meta.section type="since"/>
      </appInfo>
      <documentation>
         3.1
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="examples"/>
      </appInfo>
      <documentation>
         &lt;pre&gt;
&lt;extension
 point=&quot;org.eclipse.ui.handlers&quot;&gt;
 &lt;handler
  commandId=&quot;commandId&quot;
  class=&quot;org.eclipse.compare.Command&quot;&gt;
  &lt;activeWhen&gt;
   &lt;with variable=&quot;selection&quot;&gt;
    &lt;count value=&quot;1&quot; /&gt;
    &lt;iterate operator=&quot;and&quot;&gt;
     &lt;adapt type=&quot;IResource&quot; /&gt;
    &lt;/iterate&gt;
   &lt;/with&gt;
  &lt;/activeWhen&gt;
 &lt;/handler&gt;
&lt;/extension&gt;
&lt;/pre&gt;
&lt;p&gt;
To further avoid plug-in loading, it is possible to specify when the handler is enabled.  If the proxy has not yet loaded the handler, then only the expressions syntax is used to decide if the handler is enabled.  If the proxy has loaded the handler, then the expressions syntax is consulted first.  If the expressions syntax evaluates to true, then the handler is asked if it is enabled.  (This is a short-circuit Boolean &quot;and&quot; operation between the expressions syntax and the handler&apos;s enabled state.)
&lt;/p&gt;
&lt;pre&gt;
&lt;extension
 point=&quot;org.eclipse.ui.handlers&quot;&gt;
 &lt;handler
  commandId=&quot;commandId&quot;
  class=&quot;org.eclipse.Handler&quot;&gt;
  &lt;enabledWhen&gt;
   &lt;with variable=&quot;context&quot;&gt;
    &lt;property
     id=&quot;id&quot;
     value=&quot;debugging&quot; /&gt;
   &lt;/with&gt;
  &lt;/enabledWhen&gt;
 &lt;/handler&gt;
&lt;/extension&gt;
&lt;/pre&gt;
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="apiInfo"/>
      </appInfo>
      <documentation>
         &lt;p&gt;
All handlers implement &lt;code&gt;org.eclipse.core.commands.IHandler&lt;/code&gt;.  Within the workbench, it is possible to activate and deactivate handlers using the &lt;code&gt;org.eclipse.ui.handlers.IHandlerService&lt;/code&gt; interface.  This interface can be retrieved from supporting workbench objects, such as &lt;code&gt;IWorkbench&lt;/code&gt; itself.  To retrieve the service, you would make a call like &lt;code&gt;IWorkbench.getAdapter(IHandlerService.class)&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
It is also possible to activate and deactive handlers using legacy code in the workbench.  This can be done through the legacy mechanism shown below.  This mechanism is useful to clients who are using actions to contribute to menus or toolbars.
&lt;/p&gt;
&lt;pre&gt;
 IWorkbenchPartSite mySite;
 IAction myAction;
 
 myAction.setActionDefinitionId(commandId);
 IKeyBindingService service = mySite.getKeyBindingService();
 service.registerAction(myAction);
&lt;/pre&gt;
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="implementation"/>
      </appInfo>
      <documentation>
         
      </documentation>
   </annotation>

   <annotation>
      <appInfo>
         <meta.section type="copyright"/>
      </appInfo>
      <documentation>
         Copyright (c) 2005 IBM Corporation and others.&lt;br&gt;
All rights reserved. This program and the accompanying materials are made
available under the terms of the Eclipse Public License v1.0 which accompanies
this distribution, and is available at &lt;a 
href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
      </documentation>
   </annotation>

</schema>
