# GMF Element Type Bindings

###### Identifier:

org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings

###### Description:

This extension point allows clients of the GMF extensible type registry to define "client contexts" that describe the objects that they are interested in editing, and to bind them to element types and advice that they wish to have applied to these objects.

###### Configuration Markup:

<!ELEMENT extension (clientContext* , binding*)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED

>

<!ELEMENT clientContext (enablement | matcher)>

<!ATTLIST clientContext

id CDATA #REQUIRED

>

Definition of a client context, representing a class of objects that a client wishes to edit using a set of element types and advice.

A client context can declare an `<enablement>` expression that matches model elements that are included in the context. Where that is not sufficient, an alternative is to define a matcher class using a `<matcher>` element.

- id - The unique ID of the client context.

<!ELEMENT matcher EMPTY>

<!ATTLIST matcher

class CDATA #REQUIRED

>

This element is used to specify the class that will determine whether or not an existing model element matches this client context.

- class - The fully qualified name of a class that implements `org.eclipse.gmf.runtime.emf.type.core.IElementMatcher`.

<!ELEMENT binding (elementType* , advice*)>

<!ATTLIST binding

context CDATA #REQUIRED

>

Declares a binding between a client context and one or more element types or advice. The context can, itself, be declared by the same plug-in or by a different plug-in.

The constraints to be bound may be specified by any number of nested `<elementType>` and/or `<advice>` elements to reference multiple element types and/or advice.

- context - References the ID of a context that is bound to one or more element types or advice.

<!ELEMENT elementType EMPTY>

<!ATTLIST elementType

ref CDATA #IMPLIED

pattern CDATA #IMPLIED

>

Includes an element type or a pattern of element type IDs in a client context `<binding>`.

- ref - References the ID of an element type to bind the client context to. This attribute may not be used in conjunection with the `pattern` attribute.
- pattern - The pattern of element type IDs to be bound. Patterns are regular expressions which match unique identifiers. Please see the Java documentation for java.util.regex.Pattern for further details. This attribute may not be used in conjunection with the `ref` attribute.

<!ELEMENT advice EMPTY>

<!ATTLIST advice

ref CDATA #IMPLIED

pattern CDATA #IMPLIED

>

Includes an advice or a pattern of advice IDs in a client context `<binding>`.

- ref - References the ID of an advice to bind the client context to. This attribute may not be used in conjunection with the `pattern` attribute.
- pattern - The pattern of advice IDs to be bound. Patterns are regular expressions which match unique identifiers. Please see the Java documentation for java.util.regex.Pattern for further details. This attribute may not be used in conjunection with the `ref` attribute.

###### Examples:

Example of a context which only includes `EObjects` from the logic example's editing domain:

       <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
          <clientContext id="org.eclipse.gmf.examples.runtime.diagram.logic">
             <enablement>
                <test
                   property="org.eclipse.gmf.runtime.emf.core.editingDomain"
                   value="org.eclipse.gmf.examples.runtime.diagram.logicEditingDomain"/>
             </enablement>
          </clientContext>
       </extension>

Example of a binding of a single advice to the logic context:

       <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
          <binding context="org.eclipse.gmf.examples.runtime.diagram.logic"/>
             <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
          </binding>
       </extension>

Example of binding multiple element types and advice to the logic context:

       <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
          <binding context="org.eclipse.gmf.examples.runtime.diagram.logic"/>
             <elementType pattern="logic.*"/>
             <advice pattern="logic.*"/>
          </binding>
       </extension>

Copyright (c) 2006 IBM Corporation and others.
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 http://www.eclipse.org/legal/epl-v10.html