Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » gmfgen adding a view
gmfgen adding a view [message #167064] Mon, 07 January 2008 09:40 Go to next message
Eclipse UserFriend
Originally posted by: sammoros.gmail.com

Howdy,

I am new to GMF but have followed the tutorial and got a simple diagram up
and running. I have been examining the gmfgen to figure out how it works.
I notice I have a Gen Editor **** test.diagram
-> Gen Diagram ***EditPart
-> Gen Plugin Test Plugin
-> Gen Editor View test.diagram.part
-> Gen Diagram Updater TestDiagramUpdater
-> Property Sheet test.diagram.sheet
-> Gen Application TestApplication

I want to remove the view that displays a small outline of the main window
and replace it with my own custom view. Before writing my custom view I
want to be sure this can be done in GMF, how do I change the gmfgen to let
me replace existing views?

Hope you can help!

Sam.
Re: gmfgen adding a view [message #167125 is a reply to message #167064] Mon, 07 January 2008 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Hello Samuel,

You should change generated code instead. Eclipse Outline view calls getAdapter(IContentOutlinePage.class)
of the generated DiagramEditor, so i sugegst you to modify generated getAdapter()
method appropriately and return your implementation of IContentOutlinePage
from there (see DiagramEditor.getAdapter() for the default implementation).

-----------------
Alex Shatalin
Re: gmfgen adding a view [message #167204 is a reply to message #167125] Mon, 07 January 2008 13:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sammoros.gmail.com

Hello Alex,

Sorry if I do not understand all of the references you make. I have found
a number of references in the generated diagram code referring to
getAdapter(), 2 of which were in the diagram.edit.commands and one of
which in the diagram.edit.parts none of which refer to an
IContentOutlinePage.class

I did manage to break the views by changing the code in diagram.providers
TestViewProvider

private IElementType getSemanticElementType(IAdaptable semanticAdapter) {
if (semanticAdapter == null) {
return null;
}
//return (IElementType) semanticAdapter.getAdapter(IElementType.class);
//Removed this part!!!
return null;
}

Which is the only visible result I could manage so far. Am I on the right
track?

Thank you,

Sam.
Re: gmfgen adding a view [message #167633 is a reply to message #167204] Thu, 10 January 2008 11:33 Go to previous message
Eclipse UserFriend
Hello Samuel,

No.. ;-)
- Open generated XXXDiagramEditor.getAdapter() method
- modify "@generated" -> "@generated NOT" javadoc comment
- add
if (type == IContentOutlinePage.class) {
// return your IContentOutlinePage implementation from here
}

Default GMF implementation of IContentOutlinePage is:

TreeViewer viewer = new TreeViewer();
viewer.setRootEditPart(new DiagramRootTreeEditPart());
return new DiagramOutlinePage(viewer);

So you can use it as a prototype for your outlinepage..

-----------------
Alex Shatalin
Previous Topic:How to achieve basetype selection in the gmfeditors properties view?
Next Topic:displaying children referenced but not contained by parent
Goto Forum:
  


Current Time: Sun Jul 20 12:06:00 EDT 2025

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

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

Back to the top