[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Help - Multipage editor with different model elements and GMF

Hello Tiago,

Hello dear friends,

My name is Tiago, a brasilian student, and I'm working in the
development of an open source platform for describe graphically models
of environmental systems, and started to use the Eclipse platform to
do this job.

I initiated the implementation using the EMF and generate the
multi-page editor. And then i started to study the GMF to create the
graphical editor. But i have great difficulties to do this job and i
like some help.

In simple words, the problem i found is: i have a model with the
following simplified strutcture:

UserModel
|-> map1
|-> map2
(...)
|-> automaton1
|-> automaton2
(...)
|-> function1
|-> function2
(...)
The user will create elements like maps, automatons, and functions. I
build the .ecore and create the editor using the code generation of
EMF.


But I need to display a different view (editor) as different elements
are created and selected. For example, for the map element is wanted
to display an image, for the automaton element a graphical state
machine editor with states and transition rules, for function element
display a text editor.
You can open separate editor for each sub-element of your model (map/automation/function) another option will be (AFAIU this is a way you choose) to open another tab in the same editor representing/editing contents of the corresponding sub-element of your model. AFAIU, you need GMF-generated diagram editor only for editing âautomationsâ then below Iâll try to explain a way to integrate this editor with a mutli=page one generated by EMF.

the EMF code generation. And I created in a separated project (to
learn) a simplified state machine graphical editor using the GMF
This editor, I suppose, is able to edit âautomationâ element and will create this element (root automation) just in the root of EMF resource then you create new automation diagram using GMF-generated wizard. Now you can try using âInitialize ... diagram fileâ on an actual instance of your model (having UserModel root element instead of automation). With corresponding wizard you should be able to create diagram file pointing to the automation element located in arbitrary place of input model hierarchy tree. Then you have to handle selection in an EMF editor in a way: if automation element was selected then you are creating new diagram wile associated with this automation element (code can be copied from âInitialize ... diagram fileâ action) or just locating appropriate diagram file on a disk and then opening new editor tab (GMF-generated editor) using this diagram file as an input. At least this is a way to start with this task.

In addition in future if you want to store all the diagrams in the same (model) file then you can try using âURIEditorInputâ as an input for GMF-generated diagram editor.

-----------------
Alex Shatalin