Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 22:59 Go to next message
Eclipse UserFriend
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 23:22 Go to previous messageGo to next message
Eclipse UserFriend
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 14:11 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
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 20:07 Go to previous messageGo to next message
Eclipse UserFriend
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 14:42 Go to previous messageGo to next message
Eclipse UserFriend
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 17:58 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:MergingIdentifierDispenser not found during genmodel generation
Next Topic:using org.eclipse.gmf.runtime.emf.type.core.null with canononical polices
Goto Forum:
  


Current Time: Fri Nov 08 23:22:37 GMT 2024

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

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

Back to the top