Element Types

Identifier:
org.eclipse.gmf.runtime.emf.type.core.elementTypes

Since:
7.0

Description:
The org.eclipse.gmf.runtime.emf.type.core.elementTypes extension point is used to define application specializations of metamodel types for the following purposes:
  1. extend (but not replace) the basic metamodel editing behaviour for elements that match such specializations, and
  2. contribute icons and display names for such specializations

The element type specializations may be used for menu or tool palette items for element creation.

Editing behaviour can be extended by associated an editHelperAdvice to a specialization, or by contributing an adviceBinding that binds an editHelperAdvice to an element type. Edit helper advice is applied 'before' and/or 'after' the behaviour that is provided by the default metamodel editing behaviour.

Custom element types may be created by declaring an IElementTypeFactory which is responsible for creating all element types declaring the same 'kind' as the factory. Custom parameters may be associated with element types created this way.

Configuration Markup:

<!ELEMENT extension (metamodel* , elementTypeFactory* , specializationType*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT metamodel (metamodelType* , specializationType* , adviceBinding*)>

<!ATTLIST metamodel

nsURI CDATA #REQUIRED>

This element is used to identify the metamodel for which a set of element types and advice bindings are defined. All eclass and eContainmentFeature values specified in the types must be found within this metamodel.



<!ELEMENT elementTypeFactory EMPTY>

<!ATTLIST elementTypeFactory

factory CDATA #REQUIRED

kind    CDATA #REQUIRED

params  CDATA #IMPLIED>

This element is used to contribute a factory that will create element types declaring the same 'kind' as the factory. Custom parameters may be associated with element types created this way.



<!ELEMENT metamodelType (param*)>

<!ATTLIST metamodelType

id         CDATA #REQUIRED

icon       CDATA #IMPLIED

name       CDATA #IMPLIED

eclass     CDATA #REQUIRED

edithelper CDATA #IMPLIED

kind       CDATA #IMPLIED>

This element is used to define a new metamodel element type.



<!ELEMENT specializationType (specializes+ , (matcher | enablement)? , param* , eContainer?)>

<!ATTLIST specializationType

id               CDATA #REQUIRED

icon             CDATA #IMPLIED

name             CDATA #IMPLIED

edithelperadvice CDATA #IMPLIED

kind             CDATA #IMPLIED>

This element is used to define a new specialization element type.



<!ELEMENT adviceBinding ((matcher | enablement)? , eContainer?)>

<!ATTLIST adviceBinding

typeId      CDATA #REQUIRED

class       CDATA #REQUIRED

inheritance (all|none) "none"

id          CDATA #REQUIRED>

This element is used to bind an IEditHelperAdvice with an element type.



<!ELEMENT specializes EMPTY>

<!ATTLIST specializes

id CDATA #REQUIRED>

This element is used to identify another element type (metamodel or specialization) that this type specializes.



<!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 type.



<!ELEMENT eContainer (eContainmentFeature* , (matcher | enablement)?)>

This element is used to describe the qualities of the container model element for which this edit helper advice is relevant.



<!ELEMENT eContainmentFeature EMPTY>

<!ATTLIST eContainmentFeature

qname CDATA #REQUIRED>

This element is used to specify the containment feature for model elements for which this edit helper advice is relevant.



<!ELEMENT param EMPTY>

<!ATTLIST param

name  CDATA #REQUIRED

value CDATA #REQUIRED>

A custom parameter name and value pair.



Examples:

<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
   
        <metamodel
                nsURI="http://www.eclipse.org/emf/2002/Ecore">
             <metamodelType
                     id="org.eclipse.gmf.runtime.emf.type.core.eobject"     
                     icon="icons/eobject.gif"
                     name="%EObject"
                     eclass="EObject"
                     edithelper ="org.eclipse.gmf.runtime.emf.type.core.EObjectEditHelper"> 
             </metamodelType>
 
             <specializationType
                     id="org.eclipse.gmf.runtime.emf.type.core.special"
                     icon="icons/special.gif"
                     name="%Special"
                     edithelperadvice="org.eclipse.gmf.runtime.emf.type.core.SpecialEditHelperAdvice"> 
                 <specializes id="org.eclipse.gmf.runtime.emf.type.core.eobject"/>
                 <matcher class="org.eclipse.gmf.runtime.emf.type.core.specialMatcher"/>
             </specializationType>
 
             <specializationType
                     id="org.eclipse.gmf.runtime.emf.type.core.special2"
                     icon="icons/special2.gif"
                     name="%Special2"
                     edithelperadvice="org.eclipse.gmf.runtime.emf.type.core.Special2EditHelperAdvice">
                 <specializes id="org.eclipse.gmf.runtime.emf.type.core.eobject"/>
                 <eContainer>
                     <enablement>
                         <test property="special2" value="special2Value"/>
                     </enablement>
                 </eContainer>
                 <enablement>
                    <test property="special2" value="special2Value"/>
                 </enablement>
             </specializationType>
 
             <specializationType
                     id="org.eclipse.gmf.runtime.emf.type.core.customType"
                     icon="icons/customType.gif"
                     name="%CustomType"
                     kind="org.eclipse.gmf.runtime.emf.type.core.CustomElementKind"
                     edithelperadvice="org.eclipse.gmf.runtime.emf.type.core.CustomEditHelperAdvice"> 
                 <specializes id="org.eclipse.gmf.runtime.emf.type.core.eobject"/>
                 <param 
                         name="customParameter1" 
                         value="value1">
                 </param>
                 <param 
                         name="customParameter2" 
                         value="value2">
                 </param>
             </specializationType>
             
             <adviceBinding
                  id="org.eclipse.gmf.runtime.emf.type.core.advisedType"
                  typeId="org.eclipse.gmf.runtime.emf.type.core.eobject"
                  class="org.eclipse.gmf.runtime.emf.type.core.advisedTypeEditHelperAdvice"
                  applyToSubtypes="false"> 
                  <eContainer>
                       <enablement>
                            <test property="advised" value="advisedValue"/>
                       </enablement>
                  </eContainer>
              </adviceBinding> 
        </metamodel>
        
         <elementTypeFactory
               factory="org.eclipse.gmf.runtime.emf.type.core.CustomElementTypeFactory"
               kind = "org.eclipse.gmf.runtime.emf.type.core.CustomElementKind"
               params = "customParameter1, customParameter2">
         </elementTypeFactory>
    </extension>


Copyright (c) 2005 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