A tree outline in GMF [message #199742] |
Fri, 01 August 2008 01:32  |
Eclipse User |
|
|
|
Hello,
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?)
Thanks
Jevon
|
|
|
Re: A tree outline in GMF [message #199750 is a reply to message #199742] |
Fri, 01 August 2008 03:37  |
Eclipse User |
|
|
|
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
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor (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
|
|
|
Powered by
FUDForum. Page generated in 0.09347 seconds