Home » Modeling » GMF (Graphical Modeling Framework) » How to add manually some model "elements" to a diagram (where "elements" are giv
How to add manually some model "elements" to a diagram (where "elements" are giv [message #119984] |
Tue, 17 April 2007 09:46  |
Eclipse User |
|
|
|
Originally posted by: renwart.lippmann.lu
Hi all,
My problem seems to be simple but I don't know how to solve it because
I'm new on GMF.
For example, I use the GMF BPMN editor. When I create a new Diagram (a
new File) or when I open an already existing one, my goal is to load "on
launch" a file saved on my local harddisk... This file contains pieces
of information which I want to use to "complete" my model while loading
it. For example, Imagine that I want to add a "Task" to my diagram
because this task is defined in the loaded file...
No problem to load my file, but... The problem is that I don't know how
(and where?) to add the code to manually add some elements to the model
when I start my GMF editor ?
Can you help me by giving an example of such a job ?
|
|
| |
Re: How to add manually some model "elements" to a diagram (where "elements" are [message #120194 is a reply to message #119997] |
Wed, 18 April 2007 08:26   |
Eclipse User |
|
|
|
Originally posted by: renwart.lippmann.lu
Hi Mohammed,
Thanks for your fast reply...
If I've understood correctly :
- The fact of adding a semantic element to my model will be
automatically "shown" on the diagram because of XXXCanonicalEditPolicy ?
- If it's true, I'd like to know how I have to do to add elements to my
semantic model ? I don't know where classes to use and methods to
execute to do that...
- If I don't understand, could you give me an alternative solution ?
Please note that in fact, the goal of my searches on that problem is to
load a file when I open a diagram and add some elements to my diagram
(without adding any of elements found in the common diagram file). In
other words, I just want to display elements founds in the loaded file
on launch and not the ones saved in the GMF diagram file. Finally, note
that I'm using GMF 1.0 (But I can update to 2.0 if necessary).
Thanks for your help,
Ben.
Mohammed Mostafa a écrit :
> I think this can be accomplished in many ways, one of them is using edit
> policies
>
> For example, in GMF every time you open a diagram we have code that
> synchronize the Diagram with semantic model.
>
> The nice thing about edit policies is that they will not just be invoked
> when you open your diagram but they are alive, by alive i mean that they
> will refresh when your edit part will refresh and they can listen to
> semantic or diagram elements of interest so for example if some one
> delete the task and while the diagram is open your edit policy might
> respond to that by doing some semantic changes
>
> you can take a look at the CanonicalEditPolicy as an example
>
> I hope this helps
>
> Ben Renwart wrote:
>
>> Hi all,
>>
>> My problem seems to be simple but I don't know how to solve it because
>> I'm new on GMF.
>>
>> For example, I use the GMF BPMN editor. When I create a new Diagram (a
>> new File) or when I open an already existing one, my goal is to load
>> "on launch" a file saved on my local harddisk... This file contains
>> pieces of information which I want to use to "complete" my model while
>> loading it. For example, Imagine that I want to add a "Task" to my
>> diagram because this task is defined in the loaded file...
>>
>> No problem to load my file, but... The problem is that I don't know
>> how (and where?) to add the code to manually add some elements to the
>> model when I start my GMF editor ?
>>
>> Can you help me by giving an example of such a job ?
>>
>>
|
|
| |
Re: How to add manually some model "elements" to a diagram (where "elements" are [message #120317 is a reply to message #120194] |
Wed, 18 April 2007 12:36  |
Eclipse User |
|
|
|
Ben Renwart wrote:
> Hi Mohammed,
>
> Thanks for your fast reply...
>
> If I've understood correctly :
> - The fact of adding a semantic element to my model will be
> automatically "shown" on the diagram because of XXXCanonicalEditPolicy ?
This is correct if you have a canonical edit policy taking care of that
element synchronization
> - If it's true, I'd like to know how I have to do to add elements to
> my semantic model ? I don't know where classes to use and methods to
> execute to do that...
if you want to create a semantic element take a look at
CreateElementCommand if you are trying to create views take a look at
CanonicalEditPolicy#createViews
> - If I don't understand, could you give me an alternative solution ?
>
>
> Please note that in fact, the goal of my searches on that problem is to
> load a file when I open a diagram and add some elements to my diagram
> (without adding any of elements found in the common diagram file). In
> other words, I just want to display elements founds in the loaded file
> on launch and not the ones saved in the GMF diagram file. Finally, note
> that I'm using GMF 1.0 (But I can update to 2.0 if necessary).
I'm not sure i got what do you mean here, The thing I'm trying to say if
you want to edit the diagram or the semantic model you can do that using
an EditPolicy, it does not need to be a conical edit policy since
canonical edit policy had a very specific job which is Synchronizing the
model and the view
>
> Thanks for your help,
>
> Ben.
>
>
>
>
> Mohammed Mostafa a écrit :
>> I think this can be accomplished in many ways, one of them is using
>> edit policies
>>
>> For example, in GMF every time you open a diagram we have code that
>> synchronize the Diagram with semantic model.
>>
>> The nice thing about edit policies is that they will not just be
>> invoked when you open your diagram but they are alive, by alive i mean
>> that they will refresh when your edit part will refresh and they can
>> listen to semantic or diagram elements of interest so for example if
>> some one delete the task and while the diagram is open your edit
>> policy might respond to that by doing some semantic changes
>>
>> you can take a look at the CanonicalEditPolicy as an example
>>
>> I hope this helps
>>
>> Ben Renwart wrote:
>>
>>> Hi all,
>>>
>>> My problem seems to be simple but I don't know how to solve it
>>> because I'm new on GMF.
>>>
>>> For example, I use the GMF BPMN editor. When I create a new Diagram
>>> (a new File) or when I open an already existing one, my goal is to
>>> load "on launch" a file saved on my local harddisk... This file
>>> contains pieces of information which I want to use to "complete" my
>>> model while loading it. For example, Imagine that I want to add a
>>> "Task" to my diagram because this task is defined in the loaded file...
>>>
>>> No problem to load my file, but... The problem is that I don't know
>>> how (and where?) to add the code to manually add some elements to the
>>> model when I start my GMF editor ?
>>>
>>> Can you help me by giving an example of such a job ?
>>>
>>>
|
|
|
Goto Forum:
Current Time: Fri Apr 25 23:46:12 EDT 2025
Powered by FUDForum. Page generated in 0.03005 seconds
|