Programatically using a Label [message #163365] |
Thu, 29 November 2007 20:59 |
Stefan Kuhn Messages: 355 Registered: July 2009 |
Senior Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi modeling friends,
I got a use-case where I have to add an EditPart for a Draw2D-Label by
ExtensionPoints. I couldn't find an example :(. Neglecting my specific
situation, the problem can be reduced to add the label behavior to an
existing editor.
A) Comparison
Therefore I created a small example editor and compared the generated
result. The Model is basically:
Semantic.ecore
Wurzel <>---->* (contains)
Element
name
The label in ElementFigure should show Elements name attribute.
If I refer to the generated code changes are made in:
Edit.Parts:
SemanticEditPartFactory: new create Label-EP
ElementNameEditPart: the new EP for the label
ElementEditPart: in the 'addFixedChild'-method, the draw2d-label is set
Part:
SemanticVisualIDRegistry: in 'canCreateNode' VisualID of ElementNameEP added
Providers:
SemanticParserProvider: parser options for the LabelInput
SemanticViewProvider: added create-method for ElementNameEP for VisualID
View.Factories:
ElementNameViewFactory: nothing special here.
ElementViewFactory: Adds a Notation-View for ElementNameEP to ElementEP.
B) Thoughts:
1) There is no metamodel type needed for Element.Name.
2) I guess EditHelper(Advice) are just made for the SemanticModel, so
the NotationView can't be changed by them.
3a) As far as I debugged, the ElementEP returns the ElementNameEP in
'getChildren'. To make ElementNameEP a child, it is added in the
ElementViewFactory to the NotationModel of Element as a child. For
children the SemanticEditPartFactory is called and the Label is added.
3b) I'm not sure if the same behavior like 3a could be done by
installing an EditPolicy for ElementEP?
4) I'm confused weather or not I have to customize ElementEP,
SemanticEPFactory, SemanticVisualIDRegistry, SemanticViewProvider, and
the ElementViewFactory?
Can anybody give me some hints?
- -stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHTygjIYVWjMSpDwwRAvowAKCp7dhMVOHp9PyodVdtLI+xXOF9wQCe NHwW
f+x3KYgra/hLWy263GOFlgg=
=1PdY
-----END PGP SIGNATURE-----
|
|
|
Re: Programatically using a Label [message #163740 is a reply to message #163365] |
Mon, 03 December 2007 14:50 |
Stefan Kuhn Messages: 355 Registered: July 2009 |
Senior Member |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hi again,
was my question too simple or not understandable? Or should I split it
into several questions like how to change the view-factory for an EditPart?
I could really use some help here :)
- -stefan
SKuhn wrote:
> hi modeling friends,
>
> I got a use-case where I have to add an EditPart for a Draw2D-Label by
> ExtensionPoints. I couldn't find an example :(. Neglecting my specific
> situation, the problem can be reduced to add the label behavior to an
> existing editor.
>
> A) Comparison
> Therefore I created a small example editor and compared the generated
> result. The Model is basically:
> Semantic.ecore
> Wurzel <>---->* (contains)
> Element
> name
>
> The label in ElementFigure should show Elements name attribute.
>
> If I refer to the generated code changes are made in:
>
> Edit.Parts:
> SemanticEditPartFactory: new create Label-EP
> ElementNameEditPart: the new EP for the label
> ElementEditPart: in the 'addFixedChild'-method, the draw2d-label is set
>
> Part:
> SemanticVisualIDRegistry: in 'canCreateNode' VisualID of ElementNameEP added
>
> Providers:
> SemanticParserProvider: parser options for the LabelInput
> SemanticViewProvider: added create-method for ElementNameEP for VisualID
>
> View.Factories:
> ElementNameViewFactory: nothing special here.
> ElementViewFactory: Adds a Notation-View for ElementNameEP to ElementEP.
>
> B) Thoughts:
> 1) There is no metamodel type needed for Element.Name.
> 2) I guess EditHelper(Advice) are just made for the SemanticModel, so
> the NotationView can't be changed by them.
> 3a) As far as I debugged, the ElementEP returns the ElementNameEP in
> 'getChildren'. To make ElementNameEP a child, it is added in the
> ElementViewFactory to the NotationModel of Element as a child. For
> children the SemanticEditPartFactory is called and the Label is added.
> 3b) I'm not sure if the same behavior like 3a could be done by
> installing an EditPolicy for ElementEP?
> 4) I'm confused weather or not I have to customize ElementEP,
> SemanticEPFactory, SemanticVisualIDRegistry, SemanticViewProvider, and
> the ElementViewFactory?
>
>
> Can anybody give me some hints?
>
> -stefan
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHVBfJIYVWjMSpDwwRAkCjAJwOF1aDDZIhOmKIbWDOEcwePEvrVwCe LlSw
pXjo2A1QxKm9RAzSXMTvdcA=
=oR/y
-----END PGP SIGNATURE-----
|
|
|
|
Powered by
FUDForum. Page generated in 0.03410 seconds