Skip to main content
Jump to: navigation, search

Graphical Modeling Framework/Tutorial/Part 3

< Graphical Modeling Framework‎ | Tutorial
Revision as of 13:33, 6 April 2006 by Rgronback (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In this third part of the GMF Tutorial, we will explore some more advanced capabilities related to the tooling components, while also extending what's generated with customizations to the runtime. Specifically we will add a composite figure using the graphical definition, show how to leverage external figures, and how to use an extension plug-in to add a custom action to our diagram. A project containing the full solution set of projects for this segment is found here. Viewlets will be available after appropriate sections below to focus their content and keep them short.


Composite Figures

Resource.png

What we'd like to do is have an actor-style representation for our resources added to our diagram. These will be linked to their respective Topic elements, much like our relationship links between Topic elements.

Graphical Definition

Resource figure.png

Open up your graphical definition again and add a new...

Tip : It's a bit tedious to add multiple template points in the manner above, so feel free to open the gmfgraph file in a text editor to make life easier. Furthermore, to get it looking right more quickly, open the generated figure class and simply modify the GEF code directly and run the editor to see how it looks. Then, move this information back into your gmfgraph model. Of course, when the WYSIWYG features of GMF become available and mature, none of this should be necessary.


Tooling Definition

Resource tool.png

We'll need a tool to add Resource nodes, so as you've done many times before, open the mindmap.gmftool model and add a new node creation tool for the Resource. Next, we'll need to add our mappings, so reopen your mindmap.gmfmap file.

Mapping Definition

Resource map.png

First, we'll need to add...

Using External Figures

Creating a Customization Plug-in

Although making modifications to the generated code and specifying '@generated NOT' to allow JMerge to preserve our changes works well for some customizations, it's also possible to separate other customizations (extensions) to our generated plug-in using a new plug-in...

Custom Actions

The standard means to create a new subtopic is a bit painful at the moment: click on Topic creation tool, then diagram, name with in-place editor, click Subtopic link creation tool, draw link from parent to subtopic. Ideally, we'd like to simply use a right-click menu option on a selected Topic and choose "Create Subtopic" or better yet, press the Insert key (or equivalent) and have the new Topic created, including the link, and with the in-place editor active on the new Topic. In this section, we will explore how to accomplish just this.


Summary

In this section of the tutorial, we saw how to add a composite figure, utilize external images and figures, and create a custom action contained within a new extension plug-in.

Back to the top