# Expression Definitions

###### Identifier:

org.eclipse.core.expressions.definitions

###### Since:

3.3

###### Description:

This extension point allows you to create reusable extensions. They can then be used in other core expression constructs.

The reference element in a core expression will evaluated the expression definition with the evaluation context that is active for the reference element.

###### Configuration Markup:

<!ELEMENT extension (definition*)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

- point - a fully qualified identifier of the target extension point
- id - an optional identifier of the extension instance
- name - an optional name of the extension instance

<!ELEMENT definition (not | and | or | instanceof | test | systemTest | equals | count | with | resolve | adapt | iterate)>

<!ATTLIST definition

id CDATA #REQUIRED>

Provides a global definition of an expression to be used with the <reference/> expression element. This helps to reuse common expressions.

- id - A globally unique identifier for the expression definition.

###### Examples:

You can define and the use core expressions:

    <extension point="org.eclipse.core.expressions.definitions">
       <definition id="com.example.parts.activeProblemsView">
           <with variable="activePartId">
              <equals value="org.eclipse.ui.views.ProblemsView"/>
           </with>
       </definition>
       <definition id="com.example.markers.markerSelection">
           <iterate>
              <instanceof value="org.eclipse.core.resources.IMarker"/>
           </with>
       </definition>
    </extension>

Then this expression definition can be used when composing other expressions.

    <enabledWhen>
       <reference definitionId="com.example.parts.activeProblemsView">
    </enabledWhen>

    <visibleWhen>
       <and>
          <reference definitionId="com.example.parts.activeProblemsView"/>
          <reference definitionId="com.example.markers.markerSelection"/>
       </and>
    </visibleWhen>

Copyright (c) 2007, 2008 IBM Corporation and others.
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-v20.html/ SPDX-License-Identifier: EPL-2.0