Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Processing a diagram
Processing a diagram [message #200537] Tue, 05 August 2008 14:05 Go to next message
Stephan Arenswald is currently offline Stephan ArenswaldFriend
Messages: 11
Registered: July 2009
Junior Member
Hello everybody,

I successfully created a model and generated the corresponding editor
using GMF.
I made some sort of extremely simple workflow editor. But now I don't
know how to go on.
After creating a diagram (a flow) I want to process this flow. How do I
start? I don't think I have to parse the created diagrams because one of
the first steps was to generate the model code. Thus every "rectangle"
in my diagram has a java object. So how can I convert a diagram to its
object model so that I can use Java code to process the diagram?
I'm not sure what to google for.

Greetings
Re: Processing a diagram [message #200676 is a reply to message #200537] Wed, 06 August 2008 07:59 Go to previous messageGo to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi Stephan,

You have lots of options for translating models into Java code. Try
searching for M2T, or OpenArchitectureWare. Some other options are JET
and QVT/ATL.

Hope this helps.

Jevon

Stephan Arenswald wrote:
> Hello everybody,
>
> I successfully created a model and generated the corresponding editor
> using GMF.
> I made some sort of extremely simple workflow editor. But now I don't
> know how to go on.
> After creating a diagram (a flow) I want to process this flow. How do I
> start? I don't think I have to parse the created diagrams because one of
> the first steps was to generate the model code. Thus every "rectangle"
> in my diagram has a java object. So how can I convert a diagram to its
> object model so that I can use Java code to process the diagram?
> I'm not sure what to google for.
>
> Greetings
Re: Processing a diagram [message #200691 is a reply to message #200676] Wed, 06 August 2008 09:01 Go to previous messageGo to next message
Stephan Arenswald is currently offline Stephan ArenswaldFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Jevon,

thanks for your answer. But I'm not quite sure if I understand you or
maybe you don't understand me :)
Just think of a simple BPEL-Editor (like it's shipped with IBM WebSphere
Integration Developer). With this you can drag and drop activities in an
editor which is obviously created with EMF and GEF or GMF. The result is
a xml-based file containing my new worklfow based on the BPEL model. Now
I can press a small button and the workflow is going to be processed by
a workflow engine.
What I want/thought: After creating the model using the EMF model
editor, I created the the model code using "Generate Model Code" in the
..genmodel file. Now I have a bunch of interfaces representing my model.
Some steps forward I used GMF to create a nice looking editor in which
I'm able to create an arbitrary diagram of my model. I thought I can now
"deserialize" this diagram or so. Just something I can work with.
I thought I have to implement these interfaces. For each object I place
into a diagram an instance of these classes would be created so the
workflow can now be processed.

I'm not really sure if JET or M2T helps me to do something like that.
Maybe I didn't understand those two.

Greetings



Jevon Wright wrote:
> Hi Stephan,
>
> You have lots of options for translating models into Java code. Try
> searching for M2T, or OpenArchitectureWare. Some other options are JET
> and QVT/ATL.
>
> Hope this helps.
>
> Jevon
>
> Stephan Arenswald wrote:
>> Hello everybody,
>>
>> I successfully created a model and generated the corresponding editor
>> using GMF.
>> I made some sort of extremely simple workflow editor. But now I don't
>> know how to go on.
>> After creating a diagram (a flow) I want to process this flow. How do
>> I start? I don't think I have to parse the created diagrams because
>> one of the first steps was to generate the model code. Thus every
>> "rectangle" in my diagram has a java object. So how can I convert a
>> diagram to its object model so that I can use Java code to process the
>> diagram?
>> I'm not sure what to google for.
>>
>> Greetings
Re: Processing a diagram [message #200698 is a reply to message #200537] Wed, 06 August 2008 09:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

I'm not sure if I understood your question. Are you asking how to
access the underlying Model, so you can operate on it (e.g. in case of a
Petri net editor fire a transition, do some calculations, or similar)?

First you will need to implement an action. Here the GMF-Tutorial will
be of great help (Part 3 IIRC, in the Eclipse Wiki), showing how to
create an action and hook it into a node's context menu. Second, you
have to access the model from the selected edit part (the node). For
that purpose you have to call
((View) nodeEditPart.getModel).getElement()
on the node's edit part. If you want to change something in the model,
you have to wrap those method calls in a transactional command (which
will automatically be undoable, too). Again, you should find everything
you need in the GMF Turorial. Finally, to refresh the diagram nodes
after the changes (e.g. display the new tokens in the Petri net), you
can use the edit part's notifyChanged method.

Hope I did not misunderstand you.
Regards,
Tobias


Stephan Arenswald schrieb:
> Hello everybody,
>
> I successfully created a model and generated the corresponding editor
> using GMF.
> I made some sort of extremely simple workflow editor. But now I don't
> know how to go on.
> After creating a diagram (a flow) I want to process this flow. How do I
> start? I don't think I have to parse the created diagrams because one of
> the first steps was to generate the model code. Thus every "rectangle"
> in my diagram has a java object. So how can I convert a diagram to its
> object model so that I can use Java code to process the diagram?
> I'm not sure what to google for.
>
> Greetings
Re: Processing a diagram [message #200740 is a reply to message #200691] Wed, 06 August 2008 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tobk42.gmx.de

The interfaces are implemented already (see the impl directory next to
the interfaces), and each diagram element has (well, should have, see
below) an underlying element from the model, which can be accessed in
the way I wrote in the other posting.

Of course things go wrong sometimes, so if you do not have an impl
directory you should try regenerating the code (although I think in this
case the editor should not be able to run at all). Further, it is
possible, to create a GMF editor with no underlying model, but if you
followed the GMF tutorial to some amount and associated the ecore model
elements with the diagram nodes in the gmfmap, everything should be fine.

Regards,
Tobias


Stephan Arenswald schrieb:
> Hi Jevon,
>
> thanks for your answer. But I'm not quite sure if I understand you or
> maybe you don't understand me :)
> Just think of a simple BPEL-Editor (like it's shipped with IBM WebSphere
> Integration Developer). With this you can drag and drop activities in an
> editor which is obviously created with EMF and GEF or GMF. The result is
> a xml-based file containing my new worklfow based on the BPEL model. Now
> I can press a small button and the workflow is going to be processed by
> a workflow engine.
> What I want/thought: After creating the model using the EMF model
> editor, I created the the model code using "Generate Model Code" in the
> .genmodel file. Now I have a bunch of interfaces representing my model.
> Some steps forward I used GMF to create a nice looking editor in which
> I'm able to create an arbitrary diagram of my model. I thought I can now
> "deserialize" this diagram or so. Just something I can work with.
> I thought I have to implement these interfaces. For each object I place
> into a diagram an instance of these classes would be created so the
> workflow can now be processed.
>
> I'm not really sure if JET or M2T helps me to do something like that.
> Maybe I didn't understand those two.
>
> Greetings
>
>
>
> Jevon Wright wrote:
>> Hi Stephan,
>>
>> You have lots of options for translating models into Java code. Try
>> searching for M2T, or OpenArchitectureWare. Some other options are JET
>> and QVT/ATL.
>>
>> Hope this helps.
>>
>> Jevon
>>
>> Stephan Arenswald wrote:
>>> Hello everybody,
>>>
>>> I successfully created a model and generated the corresponding editor
>>> using GMF.
>>> I made some sort of extremely simple workflow editor. But now I don't
>>> know how to go on.
>>> After creating a diagram (a flow) I want to process this flow. How do
>>> I start? I don't think I have to parse the created diagrams because
>>> one of the first steps was to generate the model code. Thus every
>>> "rectangle" in my diagram has a java object. So how can I convert a
>>> diagram to its object model so that I can use Java code to process
>>> the diagram?
>>> I'm not sure what to google for.
>>>
>>> Greetings
Re: Processing a diagram [message #201044 is a reply to message #200698] Thu, 07 August 2008 13:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gee123.walla.com

Hi,

I think that i have the same problem as Stephan. How can I use the diagram
that i have created in the GMF editor in another ecore model / java class.
I build a state machine editor. I create an ecore model that represent
states and transaction and then generate a gmf editor that allows me to
creare many kind of states machine. My problem is that i don't know how to
"take" / export / transform a state machine "instance" and to use it in
other places (especially in another ecore model) ?

What is the best way to do it ? Is there any example for that ?

I will appreciate any kind of help.
Re: Processing a diagram [message #201222 is a reply to message #201044] Fri, 08 August 2008 16:01 Go to previous message
Seweryn Niemiec is currently offline Seweryn NiemiecFriend
Messages: 80
Registered: July 2009
Member
Erst wrote:
> Hi,
>
> I think that i have the same problem as Stephan. How can I use the
> diagram that i have created in the GMF editor in another ecore model /
> java class. I build a state machine editor. I create an ecore model that
> represent states and transaction and then generate a gmf editor that
> allows me to creare many kind of states machine. My problem is that i
> don't know how to "take" / export / transform a state machine "instance"
> and to use it in other places (especially in another ecore model) ?
> What is the best way to do it ? Is there any example for that ?
>
> I will appreciate any kind of help.

I think that you should read this tutorial:
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.html

especially section "Using the Generated EMF Classes"/"Saving and loading
resources"

By default your state machine is saved in filesystem as a XMI file. You
have to load it using code described in the aforementioned section and
then do with it whatever you want, using the code generated for you by
EMF (your model plugin).

Greetings
Seweryn
Previous Topic:[Announce] GMF 2.2.0 I200808071700 is available
Next Topic:Auto Arrange and Link Mappings GMF 2.1
Goto Forum:
  


Current Time: Wed Apr 24 16:18:54 GMT 2024

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

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

Back to the top