Home » Modeling » GMF (Graphical Modeling Framework) » Creating/Updating EditParts via EMF model elements 
| Creating/Updating EditParts via EMF model elements [message #61067] | 
Wed, 11 October 2006 18:59   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: a0309169.unet.univie.ac.at 
 
Hello, 
 
I would whether there exists some "clever" method of adding new EMF  
elements into the diagram model, and simultaneously creating/updating  
the corresponding EditParts. 
 
The solution I found so far (from the tutorial), which consists of  
crafting Requests, has several problems IMHO: 
1. It gives little flexibility in controlling undo/redo sequences. 
2. It does not enable adding existing model elements, only creating new  
ones. 
3. It's quite complicated, but that may be just my intuition... 
 
Any help would be much appreciated. 
 
Regards, 
Mikolaj Koziarkiewicz
 |  
 |  
  |  
| Re: Creating/Updating EditParts via EMF model elements [message #61091 is a reply to message #61067] | 
Wed, 11 October 2006 19:22    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: vcciubot.uwaterloo.ca 
 
Canonical policies do - I guess - exactly what you need. 
 
Here's how it works: 
 
You have an EMF model that gets mirrored into a notational model that uses 
views (nodes and edges). The synchronization between the two models is 
performed by canonical policies that listen to the model elements for 
updates. When these occur, they create/remove views from the notational 
side. 
 
EditParts listen to the notational model for updates. When these changes 
occur they create/remove children edit parts as necessary. 
 
Note however, that certain edit policies in gmf create both the view and 
the model element: CreationEditPolicy, GraphicalNodeEditPolicies do this. 
To accommodate this, when an edit part returns a command for certain types 
of requests, it wraps it into two other commands that turn off/on the 
canonical edit policies sensitive to the given context so that views don't 
get created twice. 
 
Maybe somebody else can explain why not all containers should be canonical. 
 
vlad 
 
 
On Thu, 12 Oct 2006 00:59:36 +0200, Mikolaj Koziarkiewicz wrote: 
 
> Hello, 
>  
> I would whether there exists some "clever" method of adding new EMF  
> elements into the diagram model, and simultaneously creating/updating  
> the corresponding EditParts. 
>  
> The solution I found so far (from the tutorial), which consists of  
> crafting Requests, has several problems IMHO: 
> 1. It gives little flexibility in controlling undo/redo sequences. 
> 2. It does not enable adding existing model elements, only creating new  
> ones. 
> 3. It's quite complicated, but that may be just my intuition... 
>  
> Any help would be much appreciated. 
>  
> Regards, 
> Mikolaj Koziarkiewicz
 |  
 |  
  |  
| Re: Creating/Updating EditParts via EMF model elements [message #61702 is a reply to message #61091] | 
Thu, 12 October 2006 10:11    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Mikolaj: 
 
Take a look at the "Canonical Containers" Tutorial for more info. 
 
Vlad: 
 
This tutorial answers your question why shouldn't all containers be  
canonical... 
"This behavior is also optionally installable since sometimes it may be  
desirable to see a partial view of the semantic model.  If we consider a  
UML class diagram, the user will typically only be interested in a  
subsection of a system rather then the whole system (or even the whole  
contents of a package).  In this case, the user will want to selectively  
create views to construct their diagram and probably wouldn't want views  
being automatically created on the diagram when added semantically." 
 
- Cherie 
 
Vlad Ciubotariu wrote: 
> Canonical policies do - I guess - exactly what you need. 
>  
> Here's how it works: 
>  
> You have an EMF model that gets mirrored into a notational model that uses 
> views (nodes and edges). The synchronization between the two models is 
> performed by canonical policies that listen to the model elements for 
> updates. When these occur, they create/remove views from the notational 
> side. 
>  
> EditParts listen to the notational model for updates. When these changes 
> occur they create/remove children edit parts as necessary. 
>  
> Note however, that certain edit policies in gmf create both the view and 
> the model element: CreationEditPolicy, GraphicalNodeEditPolicies do this. 
> To accommodate this, when an edit part returns a command for certain types 
> of requests, it wraps it into two other commands that turn off/on the 
> canonical edit policies sensitive to the given context so that views don't 
> get created twice. 
>  
> Maybe somebody else can explain why not all containers should be canonical. 
>  
> vlad 
>  
>  
> On Thu, 12 Oct 2006 00:59:36 +0200, Mikolaj Koziarkiewicz wrote: 
>  
>> Hello, 
>> 
>> I would whether there exists some "clever" method of adding new EMF  
>> elements into the diagram model, and simultaneously creating/updating  
>> the corresponding EditParts. 
>> 
>> The solution I found so far (from the tutorial), which consists of  
>> crafting Requests, has several problems IMHO: 
>> 1. It gives little flexibility in controlling undo/redo sequences. 
>> 2. It does not enable adding existing model elements, only creating new  
>> ones. 
>> 3. It's quite complicated, but that may be just my intuition... 
>> 
>> Any help would be much appreciated. 
>> 
>> Regards, 
>> Mikolaj Koziarkiewicz 
>
 |  
 |  
  |  
| Re: Creating/Updating EditParts via EMF model elements [message #67402 is a reply to message #61702] | 
Sun, 22 October 2006 16:07    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: a0309169.unet.univie.ac.at 
 
Vlad, Cherie: thank you for the very informative replies! 
 
I have a new question 'though: what is the difference between a  
SemanticEditPolicy and a CanonicalEditPolicy? They both seem to be  
suited for similar roles... 
 
Regards, 
Mikolaj 
 
 
> Mikolaj: 
>  
> Take a look at the "Canonical Containers" Tutorial for more info. 
>  
> Vlad: 
>  
> This tutorial answers your question why shouldn't all containers be  
> canonical... 
> "This behavior is also optionally installable since sometimes it may be  
> desirable to see a partial view of the semantic model.  If we consider a  
> UML class diagram, the user will typically only be interested in a  
> subsection of a system rather then the whole system (or even the whole  
> contents of a package).  In this case, the user will want to selectively  
> create views to construct their diagram and probably wouldn't want views  
> being automatically created on the diagram when added semantically." 
>  
> - Cherie 
>  
> Vlad Ciubotariu wrote: 
>> Canonical policies do - I guess - exactly what you need. 
>> 
>> Here's how it works: 
>> 
>> You have an EMF model that gets mirrored into a notational model that  
>> uses 
>> views (nodes and edges). The synchronization between the two models is 
>> performed by canonical policies that listen to the model elements for 
>> updates. When these occur, they create/remove views from the notational 
>> side. 
>> 
>> EditParts listen to the notational model for updates. When these changes 
>> occur they create/remove children edit parts as necessary. 
>> 
>> Note however, that certain edit policies in gmf create both the view and 
>> the model element: CreationEditPolicy, GraphicalNodeEditPolicies do this. 
>> To accommodate this, when an edit part returns a command for certain  
>> types 
>> of requests, it wraps it into two other commands that turn off/on the 
>> canonical edit policies sensitive to the given context so that views  
>> don't 
>> get created twice. 
>> 
>> Maybe somebody else can explain why not all containers should be  
>> canonical. 
>> 
>> vlad 
>> 
>> 
>> On Thu, 12 Oct 2006 00:59:36 +0200, Mikolaj Koziarkiewicz wrote: 
>> 
>>> Hello, 
>>> 
>>> I would whether there exists some "clever" method of adding new EMF  
>>> elements into the diagram model, and simultaneously creating/updating  
>>> the corresponding EditParts. 
>>> 
>>> The solution I found so far (from the tutorial), which consists of  
>>> crafting Requests, has several problems IMHO: 
>>> 1. It gives little flexibility in controlling undo/redo sequences. 
>>> 2. It does not enable adding existing model elements, only creating  
>>> new ones. 
>>> 3. It's quite complicated, but that may be just my intuition... 
>>> 
>>> Any help would be much appreciated. 
>>> 
>>> Regards, 
>>> Mikolaj Koziarkiewicz 
>>
 |  
 |  
  |  
| Re: Creating/Updating EditParts via EMF model elements [message #67928 is a reply to message #67402] | 
Mon, 23 October 2006 10:42    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: vcciubot.uwaterloo.ca 
 
Canonical policies synchronize the view with the model. So they listen to 
the model and create/remove view elements model changes occur. 
 
The semantic policy is asked for commands that act on the model when the 
user interacts with the diagram using a tool or the keyboard such as 
adding/removing nodes, creating connections etc.  
 
vlad 
 
 
On Sun, 22 Oct 2006 22:07:02 +0200, Mikolaj Koziarkiewicz wrote: 
 
> Vlad, Cherie: thank you for the very informative replies! 
>  
> I have a new question 'though: what is the difference between a  
> SemanticEditPolicy and a CanonicalEditPolicy? They both seem to be  
> suited for similar roles... 
>  
> Regards, 
> Mikolaj 
>  
>  
>> Mikolaj: 
>>  
>> Take a look at the "Canonical Containers" Tutorial for more info. 
>>  
>> Vlad: 
>>  
>> This tutorial answers your question why shouldn't all containers be  
>> canonical... 
>> "This behavior is also optionally installable since sometimes it may be  
>> desirable to see a partial view of the semantic model.  If we consider a  
>> UML class diagram, the user will typically only be interested in a  
>> subsection of a system rather then the whole system (or even the whole  
>> contents of a package).  In this case, the user will want to selectively  
>> create views to construct their diagram and probably wouldn't want views  
>> being automatically created on the diagram when added semantically." 
>>  
>> - Cherie 
>>  
>> Vlad Ciubotariu wrote: 
>>> Canonical policies do - I guess - exactly what you need. 
>>> 
>>> Here's how it works: 
>>> 
>>> You have an EMF model that gets mirrored into a notational model that  
>>> uses 
>>> views (nodes and edges). The synchronization between the two models is 
>>> performed by canonical policies that listen to the model elements for 
>>> updates. When these occur, they create/remove views from the notational 
>>> side. 
>>> 
>>> EditParts listen to the notational model for updates. When these changes 
>>> occur they create/remove children edit parts as necessary. 
>>> 
>>> Note however, that certain edit policies in gmf create both the view and 
>>> the model element: CreationEditPolicy, GraphicalNodeEditPolicies do this. 
>>> To accommodate this, when an edit part returns a command for certain  
>>> types 
>>> of requests, it wraps it into two other commands that turn off/on the 
>>> canonical edit policies sensitive to the given context so that views  
>>> don't 
>>> get created twice. 
>>> 
>>> Maybe somebody else can explain why not all containers should be  
>>> canonical. 
>>> 
>>> vlad 
>>> 
>>> 
>>> On Thu, 12 Oct 2006 00:59:36 +0200, Mikolaj Koziarkiewicz wrote: 
>>> 
>>>> Hello, 
>>>> 
>>>> I would whether there exists some "clever" method of adding new EMF  
>>>> elements into the diagram model, and simultaneously creating/updating  
>>>> the corresponding EditParts. 
>>>> 
>>>> The solution I found so far (from the tutorial), which consists of  
>>>> crafting Requests, has several problems IMHO: 
>>>> 1. It gives little flexibility in controlling undo/redo sequences. 
>>>> 2. It does not enable adding existing model elements, only creating  
>>>> new ones. 
>>>> 3. It's quite complicated, but that may be just my intuition... 
>>>> 
>>>> Any help would be much appreciated. 
>>>> 
>>>> Regards, 
>>>> Mikolaj Koziarkiewicz 
>>>
 |  
 |  
  |  
| Re: Creating/Updating EditParts via EMF model elements [message #68117 is a reply to message #67928] | 
Mon, 23 October 2006 13:58   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: a0309169.unet.univie.ac.at 
 
Vlad, 
 
OK, I understand the difference now. Thank you for the info! 
 
Mikolaj 
 
 
> Canonical policies synchronize the view with the model. So they listen to 
> the model and create/remove view elements model changes occur. 
>  
> The semantic policy is asked for commands that act on the model when the 
> user interacts with the diagram using a tool or the keyboard such as 
> adding/removing nodes, creating connections etc.  
>  
> vlad 
>  
>  
> On Sun, 22 Oct 2006 22:07:02 +0200, Mikolaj Koziarkiewicz wrote: 
>  
>> Vlad, Cherie: thank you for the very informative replies! 
>> 
>> I have a new question 'though: what is the difference between a  
>> SemanticEditPolicy and a CanonicalEditPolicy? They both seem to be  
>> suited for similar roles... 
>> 
>> Regards, 
>> Mikolaj 
>> 
>> 
>>> Mikolaj: 
>>> 
>>> Take a look at the "Canonical Containers" Tutorial for more info. 
>>> 
>>> Vlad: 
>>> 
>>> This tutorial answers your question why shouldn't all containers be  
>>> canonical... 
>>> "This behavior is also optionally installable since sometimes it may be  
>>> desirable to see a partial view of the semantic model.  If we consider a  
>>> UML class diagram, the user will typically only be interested in a  
>>> subsection of a system rather then the whole system (or even the whole  
>>> contents of a package).  In this case, the user will want to selectively  
>>> create views to construct their diagram and probably wouldn't want views  
>>> being automatically created on the diagram when added semantically." 
>>> 
>>> - Cherie 
>>> 
>>> Vlad Ciubotariu wrote: 
>>>> Canonical policies do - I guess - exactly what you need. 
>>>> 
>>>> Here's how it works: 
>>>> 
>>>> You have an EMF model that gets mirrored into a notational model that  
>>>> uses 
>>>> views (nodes and edges). The synchronization between the two models is 
>>>> performed by canonical policies that listen to the model elements for 
>>>> updates. When these occur, they create/remove views from the notational 
>>>> side. 
>>>> 
>>>> EditParts listen to the notational model for updates. When these changes 
>>>> occur they create/remove children edit parts as necessary. 
>>>> 
>>>> Note however, that certain edit policies in gmf create both the view and 
>>>> the model element: CreationEditPolicy, GraphicalNodeEditPolicies do this. 
>>>> To accommodate this, when an edit part returns a command for certain  
>>>> types 
>>>> of requests, it wraps it into two other commands that turn off/on the 
>>>> canonical edit policies sensitive to the given context so that views  
>>>> don't 
>>>> get created twice. 
>>>> 
>>>> Maybe somebody else can explain why not all containers should be  
>>>> canonical. 
>>>> 
>>>> vlad 
>>>> 
>>>> 
>>>> On Thu, 12 Oct 2006 00:59:36 +0200, Mikolaj Koziarkiewicz wrote: 
>>>> 
>>>>> Hello, 
>>>>> 
>>>>> I would whether there exists some "clever" method of adding new EMF  
>>>>> elements into the diagram model, and simultaneously creating/updating  
>>>>> the corresponding EditParts. 
>>>>> 
>>>>> The solution I found so far (from the tutorial), which consists of  
>>>>> crafting Requests, has several problems IMHO: 
>>>>> 1. It gives little flexibility in controlling undo/redo sequences. 
>>>>> 2. It does not enable adding existing model elements, only creating  
>>>>> new ones. 
>>>>> 3. It's quite complicated, but that may be just my intuition... 
>>>>> 
>>>>> Any help would be much appreciated. 
>>>>> 
>>>>> Regards, 
>>>>> Mikolaj Koziarkiewicz 
>
 |  
 |  
  |   
Goto Forum:
 
 Current Time: Tue Nov 04 10:32:05 EST 2025 
 Powered by  FUDForum. Page generated in 0.04557 seconds  
 |