Processing a diagram [message #200537] |
Tue, 05 August 2008 10:05  |
Eclipse User |
|
|
|
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 05:03   |
Eclipse User |
|
|
|
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 06:29   |
Eclipse User |
|
|
|
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 #201222 is a reply to message #201044] |
Fri, 08 August 2008 12:01  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.06919 seconds