Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » A tree outline in GMF
A tree outline in GMF [message #199742] Fri, 01 August 2008 05:32 Go to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member

I am trying to implement a GMF editor for a fairly simple heirarchical
model, e.g.

Component A
Component B
Children 1
Children 2
Component C
Component D

I've used diagram partitioning to split each Component view into separate
windows, and this works well. I would like to have an Outline view
displaying the entire model tree at the same time. (My ambition is to have
the facility to drag and drop elements from the model onto any
sub-Component diagram.)

However right now, the outline view (tree view) only displays the content
of the current view, e.g. when the editor for Component A is open, it only
shows components B and C; I would like it to display in a tree fashion 1,
2 and D.

I've been struggling to find out how this outline view is actually being
created. I think it is created with this code:

[from LogicEditor]
public Object getAdapter(Class type){
if (type == IContentOutlinePage.class) {
outlinePage = new OutlinePage(new TreeViewer());
return outlinePage;

But I can't work out how the actual content of the TreeViewer is supplied
(if this is even the outline view itself), so I can't work out how to add
new nodes to the tree.

Can somebody point me in the right direction in order to display a model
tree in the outline view?

(Is this possible to generate in .gmfgen? Is it an extension point?)


Re: A tree outline in GMF [message #199750 is a reply to message #199742] Fri, 01 August 2008 07:37 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jevon,

> (Is this possible to generate in .gmfgen? Is it an extension point?)
Currently you can override getAdapter() method to supply different content/appearance
of the outline view. BTW, a little bit different implementation present in (one of super-classes
of the generated editor):

if (type == IContentOutlinePage.class) {
TreeViewer viewer = new TreeViewer();
viewer.setRootEditPart(new DiagramRootTreeEditPart());
return new DiagramOutlinePage(viewer);

In addition there is a possibility to browse domain model/diagram file contents
in ProjectExplorerView + D&D elements from there onto the diagram (this functionality
can be generated by GMF).

Alex Shatalin
Previous Topic:GMF Diagram-EMF Model Sync problem
Next Topic:2 GMF Diagrams based on the same model at runtime
Goto Forum:

Current Time: Thu May 06 14:04:16 GMT 2021

Powered by FUDForum. Page generated in 0.01267 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top