Java Reference
In-Depth Information
icon="icons/obj16/MindmapDiagramFile.gif"
name="Map"
eclass="Map"
kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
<param name="semanticHint" value="Map"/>
</metamodelType>
<metamodelType
id="org.eclipse.mindmap.diagram.Topic"
icon="icons/obj16/MindmapDiagramFile.gif"
name="Topic"
eclass="Topic"
kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
<param name="semanticHint" value="Topic"/>
</metamodelType>
</metamodel>
</extension>
Note that both the
Map
and
Topic
classes from our domain model are reg-
istered as
metamodelType
elements with unique ID, name, eclass, and
IHintedType
kind attributes. The
semanticHint
parameter for each
metamodelType
supports the mapping of each type with its corresponding
View
and
EditPart
, as you will see in our
viewProviders
and
editpartProviders
extensions. Later, you'll see how these metamodel ele-
ments are mapped to palette tools and, therefore, diagram graphical elements.
First, we need to complement our
elementTypes
contribution with an enumer-
ator that returns an
IElementType
instance for each of our declared
metamodelType
IDs, as shown here in our
MindmapElementTypes
class.
IElementType
is an interface that the GMF runtime uses to define types that
are displayed, created, edited, and destroyed. Each type has an associated icon,
display name,
EClass
, and
EditHelper
, and they all return an edit command
when provided an edit request.
public class
MindmapElementTypes
extends
AbstractElementTypeEnumerator
{
public static final
IElementType MAP =
getElementType("org.eclipse.mindmap.diagram.Map");
public static final
IElementType TOPIC =
getElementType("org.eclipse.mindmap.diagram.Topic");
}
We need to add extension parser support for the diagram's notation model.
The runtime provides one, so we simply declare a contribution using the
GMFResourceFactory
class for our editor extension
mmd
type.
Search WWH ::
Custom Search