Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Multiple editpart objects with numbers in name
Multiple editpart objects with numbers in name [message #42109] Thu, 07 September 2006 11:51 Go to next message
Eclipse UserFriend
Originally posted by: jricker.progess.com

Why do I get multiple edit part objects with numbers in their names, as in
FooEditPart
Foo2EditPart
Foo3EditPart
Is there a place in the model to override this behavior?
Re: Multiple editpart objects with numbers in name [message #42171 is a reply to message #42109] Thu, 07 September 2006 12:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Each GenNode in gmfgen model has editable property attr String
editPartClassName; so you may change it.
Also please note that this value is not preserved on regeneration by
reconciler now (see #155332).
If you want to change it, it would be better to use some naming convention
other than default one, say, name it like "<meaningfull-prefix>EP" instead
of "<meaningfull-prefix>EditPart".

Regards,
Michael

"Ricker" <jricker@progess.com> wrote in message
news:edpf7b$rad$1@utils.eclipse.org...
> Why do I get multiple edit part objects with numbers in their names, as in
> FooEditPart
> Foo2EditPart
> Foo3EditPart
> Is there a place in the model to override this behavior?
>
Re: Multiple editpart objects with numbers in name [message #42200 is a reply to message #42171] Thu, 07 September 2006 12:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jricker.progess.com

Thanks Michael.

So it is okay to have multiple GenNodes pointing to the same editpart class?

Ricker


"Michael Golubev" <michael.golubev@borland.com> wrote in message
news:edpgo7$chr$1@utils.eclipse.org...
> Hi,
>
> Each GenNode in gmfgen model has editable property attr String
> editPartClassName; so you may change it.
> Also please note that this value is not preserved on regeneration by
> reconciler now (see #155332).
> If you want to change it, it would be better to use some naming convention
> other than default one, say, name it like "<meaningfull-prefix>EP" instead
> of "<meaningfull-prefix>EditPart".
>
> Regards,
> Michael
>
> "Ricker" <jricker@progess.com> wrote in message
> news:edpf7b$rad$1@utils.eclipse.org...
>> Why do I get multiple edit part objects with numbers in their names, as
>> in
>> FooEditPart
>> Foo2EditPart
>> Foo3EditPart
>> Is there a place in the model to override this behavior?
>>
>
>
Re: Multiple editpart objects with numbers in name [message #42320 is a reply to message #42200] Thu, 07 September 2006 16:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I doubt it is good idea.

I only meant something like changing OutputPinEditPart/OutputPin2EditPart ->
"OutputPin_OpaqueAction_EP/OutputPin_CallAction_EP". It allows to more
easily understand what class need to be modified with generated @not tag.

Regards.
Michael

"Ricker" <jricker@progess.com> wrote in message
news:edpitr$9gr$1@utils.eclipse.org...
> Thanks Michael.
>
> So it is okay to have multiple GenNodes pointing to the same editpart
> class?
>
> Ricker
>
>
> "Michael Golubev" <michael.golubev@borland.com> wrote in message
> news:edpgo7$chr$1@utils.eclipse.org...
>> Hi,
>>
>> Each GenNode in gmfgen model has editable property attr String
>> editPartClassName; so you may change it.
>> Also please note that this value is not preserved on regeneration by
>> reconciler now (see #155332).
>> If you want to change it, it would be better to use some naming
>> convention other than default one, say, name it like
>> "<meaningfull-prefix>EP" instead of "<meaningfull-prefix>EditPart".
>>
>> Regards,
>> Michael
>>
>> "Ricker" <jricker@progess.com> wrote in message
>> news:edpf7b$rad$1@utils.eclipse.org...
>>> Why do I get multiple edit part objects with numbers in their names, as
>>> in
>>> FooEditPart
>>> Foo2EditPart
>>> Foo3EditPart
>>> Is there a place in the model to override this behavior?
>>>
>>
>>
>
>
Re: Multiple editpart objects with numbers in name [message #42570 is a reply to message #42320] Fri, 08 September 2006 05:25 Go to previous messageGo to next message
Eclipse UserFriend
Hello Michael,

> I doubt it is good idea.
It is simply NOT possible. You can easily break functionality of the generated
code by doing it. BTW, why do you need to generate less classes?

-----------------
Alex Shatalin
Re: Multiple editpart objects with numbers in name [message #42840 is a reply to message #42570] Fri, 08 September 2006 08:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ricker.distributedinstruments.com

Alex and Michael,

Thank you very much. That answers my question precisely.

It is not that I want to generate less classes; I want to have good
object-oriented code. And I want to make sure I am using GMF as it was
intended.

If I have 12 objects named FooEditPart, Foo2EditPart, etc., it is
conceivable that I would want some uniform behavior from those objects.
I want to make a change one place, not 12. My approach is to have an
abstract class named FooEditPartBase and have the 12 inherit from that
class.

Unless someone corrects me, I will assume that that is good GMF practice.

- Ricker


Alex Shatalin wrote:
> Hello Michael,
>
>> I doubt it is good idea.
> It is simply NOT possible. You can easily break functionality of the
> generated code by doing it. BTW, why do you need to generate less classes?
>
> -----------------
> Alex Shatalin
>
>
Re: Multiple editpart objects with numbers in name [message #43316 is a reply to message #42840] Fri, 08 September 2006 14:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

I've wondered about this also.
It would be nice if all generated edit part (of the same extension type)
extends from a base generated EditPart for your model similar to
how XXXBaseItemSemanticEditPolicy is the base for all other
XXXItemSemanticEditPolicy.

It's no big deal really I was just wondering:-)

When I started with GMF I was seeing numbers as high as 7:-( but between
refinement of my metamodel and understanding GMF more the highest I have
now is 3 :-). My model supports recursive containment with just 3 so I
would be surprised if I would ever run into a 4:-)

-- Khai --


Jeffrey Ricker wrote:
> Alex and Michael,
>
> Thank you very much. That answers my question precisely.
>
> It is not that I want to generate less classes; I want to have good
> object-oriented code. And I want to make sure I am using GMF as it was
> intended.
>
> If I have 12 objects named FooEditPart, Foo2EditPart, etc., it is
> conceivable that I would want some uniform behavior from those objects.
> I want to make a change one place, not 12. My approach is to have an
> abstract class named FooEditPartBase and have the 12 inherit from that
> class.
>
> Unless someone corrects me, I will assume that that is good GMF practice.
>
> - Ricker
>
>
> Alex Shatalin wrote:
>> Hello Michael,
>>
>>> I doubt it is good idea.
>> It is simply NOT possible. You can easily break functionality of the
>> generated code by doing it. BTW, why do you need to generate less
>> classes?
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: Multiple editpart objects with numbers in name [message #43788 is a reply to message #42840] Sun, 10 September 2006 07:12 Go to previous messageGo to next message
Eclipse UserFriend
On Fri, 08 Sep 2006 08:57:19 -0400, Jeffrey Ricker
<ricker@distributedinstruments.com> wrote:

>It is not that I want to generate less classes; I want to have good
>object-oriented code. And I want to make sure I am using GMF as it was
>intended.
>
>If I have 12 objects named FooEditPart, Foo2EditPart, etc., it is
>conceivable that I would want some uniform behavior from those objects.
>I want to make a change one place, not 12. My approach is to have an
>abstract class named FooEditPartBase and have the 12 inherit from that
>class.
>
>Unless someone corrects me, I will assume that that is good GMF practice.

I ended up using this approach. Unfortunately, I have to change the
extends clause of each of the classes to refer to the common
superclass, whenever I regenerate. Since I guess this is a common
thing to do, It would be great to be able to specify the generation of
this (empty) class. Perhaps a feature request: Specify the name of a
class for common code for the EditParts generated for the same
concept, when used in different parts of the hierarchy. The logical
place to have this informaiton is in gmfgen and it must survive
regeneration (of gmfgen from gmfmap).

Hallvard
Re: Multiple editpart objects with numbers in name [message #43883 is a reply to message #43788] Sun, 10 September 2006 08:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Consider the using of the changed templates.
Dynamic templates allows you to use, say, custom version of
NodeEditPart.javajet (with changed extends clause) but default versions for
other templates.
This way, you will need to merge only single template file with ongoing gmf
changes. Also it is very probable that in future, GMF will provide
significant amount of "template extension points" using conditional
includes. Please feel free to submit one for this particular conditional
include statement that specifies extend clause for edit parts.

Regards,
Michael

"Hallvard Tr?tteberg" <hal@idi.ntnu.no> wrote in message
news:88s7g2puct9lhdnkoujeroi0f18shi6lci@4ax.com...
> On Fri, 08 Sep 2006 08:57:19 -0400, Jeffrey Ricker
> <ricker@distributedinstruments.com> wrote:
>
>>It is not that I want to generate less classes; I want to have good
>>object-oriented code. And I want to make sure I am using GMF as it was
>>intended.
>>
>>If I have 12 objects named FooEditPart, Foo2EditPart, etc., it is
>>conceivable that I would want some uniform behavior from those objects.
>>I want to make a change one place, not 12. My approach is to have an
>>abstract class named FooEditPartBase and have the 12 inherit from that
>>class.
>>
>>Unless someone corrects me, I will assume that that is good GMF practice.
>
> I ended up using this approach. Unfortunately, I have to change the
> extends clause of each of the classes to refer to the common
> superclass, whenever I regenerate. Since I guess this is a common
> thing to do, It would be great to be able to specify the generation of
> this (empty) class. Perhaps a feature request: Specify the name of a
> class for common code for the EditParts generated for the same
> concept, when used in different parts of the hierarchy. The logical
> place to have this informaiton is in gmfgen and it must survive
> regeneration (of gmfgen from gmfmap).
>
> Hallvard
Re: Multiple editpart objects with numbers in name [message #44509 is a reply to message #42840] Mon, 11 September 2006 06:11 Go to previous messageGo to next message
Eclipse UserFriend
Hello Jeffrey,

> It is not that I want to generate less classes; I want to have good
> object-oriented code. And I want to make sure I am using GMF as it was
> intended.
I see. I would say, this is a price generator has to pay for generating
the code for all the use-cases covered by GMF currently. We are trying to
focus on generating as much code as possible and having in mind that in one
day it will not be necessary to change any line in the generated code ;-)
For now I can only suggest you to extract your common functionality manually
into the super-class of all the generated EditParts and modify generated
code to use your methods in corresponding places.

-----------------
Alex Shatalin
Re: Multiple editpart objects with numbers in name [message #44570 is a reply to message #43788] Mon, 11 September 2006 06:21 Go to previous messageGo to next message
Eclipse UserFriend
Hello Hallvard Tr?tteberg,

> I ended up using this approach. Unfortunately, I have to change the
> extends clause of each of the classes to refer to the common
To my understanding if you specify "@generated NOT" java doc comment for
each of these classes then generator will not overwrite modified "extends"
clause by the default values anymore.

> this (empty) class. Perhaps a feature request: Specify the name of a
> class for common code for the EditParts generated for the same
This request could be covered by substituting existing template engine with
more powerful one. In this case I hope you’ll be able to even generate the
code of this super-class by modifying existing set of templates.

-----------------
Alex Shatalin
Re: Multiple editpart objects with numbers in name [message #45240 is a reply to message #44570] Mon, 11 September 2006 14:39 Go to previous messageGo to next message
Eclipse UserFriend
On Mon, 11 Sep 2006 10:21:01 +0000 (UTC), Alex Shatalin
<vano@borland.com> wrote:

>Hello Hallvard Tr?tteberg,
>
>> I ended up using this approach. Unfortunately, I have to change the
>> extends clause of each of the classes to refer to the common
>To my understanding if you specify "@generated NOT" java doc comment for
>each of these classes then generator will not overwrite modified "extends"
>clause by the default values anymore.

Yes, but won't this prevent the generator from regenerating the
content of the class, too?

Hallvard
Re: Multiple editpart objects with numbers in name [message #45271 is a reply to message #43883] Mon, 11 September 2006 14:45 Go to previous messageGo to next message
Eclipse UserFriend
On Sun, 10 Sep 2006 14:58:07 +0200, "Michael Golubev"
<michael.golubev@borland.com> wrote:

>Hi,
>
>Consider the using of the changed templates.
>Dynamic templates allows you to use, say, custom version of
>NodeEditPart.javajet (with changed extends clause) but default versions for
>other templates.
>This way, you will need to merge only single template file with ongoing gmf
>changes. Also it is very probable that in future, GMF will provide
>significant amount of "template extension points" using conditional
>includes. Please feel free to submit one for this particular conditional
>include statement that specifies extend clause for edit parts.

I've thought about replacing the template file. I believe I would
need to extend the generator model with another attribute for holding
the name of the superclass, and use this in the template. I would also
need to change the generator to also generate the superclass. There
may also need to be some logic for deciding what to generate into the
superclass, e.g. figure definition, and what to generate into the
subclasses, e.g. policy creation.

If there is general interest in this, and a chance to get this into
the official GMF, I'm tempted to try.

Hallvard

>
>Regards,
>Michael
>
>"Hallvard Tr?tteberg" <hal@idi.ntnu.no> wrote in message
>news:88s7g2puct9lhdnkoujeroi0f18shi6lci@4ax.com...
>> On Fri, 08 Sep 2006 08:57:19 -0400, Jeffrey Ricker
>> <ricker@distributedinstruments.com> wrote:
>>
>>>It is not that I want to generate less classes; I want to have good
>>>object-oriented code. And I want to make sure I am using GMF as it was
>>>intended.
>>>
>>>If I have 12 objects named FooEditPart, Foo2EditPart, etc., it is
>>>conceivable that I would want some uniform behavior from those objects.
>>>I want to make a change one place, not 12. My approach is to have an
>>>abstract class named FooEditPartBase and have the 12 inherit from that
>>>class.
>>>
>>>Unless someone corrects me, I will assume that that is good GMF practice.
>>
>> I ended up using this approach. Unfortunately, I have to change the
>> extends clause of each of the classes to refer to the common
>> superclass, whenever I regenerate. Since I guess this is a common
>> thing to do, It would be great to be able to specify the generation of
>> this (empty) class. Perhaps a feature request: Specify the name of a
>> class for common code for the EditParts generated for the same
>> concept, when used in different parts of the hierarchy. The logical
>> place to have this informaiton is in gmfgen and it must survive
>> regeneration (of gmfgen from gmfmap).
>>
>> Hallvard
>
Re: Multiple editpart objects with numbers in name [message #45430 is a reply to message #43883] Mon, 11 September 2006 17:04 Go to previous messageGo to next message
Eclipse UserFriend
On Sun, 10 Sep 2006 14:58:07 +0200, "Michael Golubev"
<michael.golubev@borland.com> wrote:

>Hi,
>
>Consider the using of the changed templates.
>Dynamic templates allows you to use, say, custom version of
>NodeEditPart.javajet (with changed extends clause) but default versions for
>other templates.

I've now changed the NodeEditPart.javajet template so it generates the
desired "extends AbstractXXXEditPart" clause for XXXnnEditPart
classes. I introduced a helper method in the inner helper class, that
generated the name for the abstract class from the edit part's, i.e.
prefixed it with "Abstract" and removed the nn part. I also added a
different package prefix, to separate the abstract edit parts classes,
that must be made manually, and the generated edit part classes.

I'm satisified with the new NodeEditPart.javajet template, as it
solves my immediate problem, but to make it generally interesting, I
believe the gmfgen model must be augmented with additional attributes
for the abstract edit part name and perhaps logic for generating this
class, too.

Hallvard

>
>Regards,
>Michael
>
>"Hallvard Tr?tteberg" <hal@idi.ntnu.no> wrote in message
>news:88s7g2puct9lhdnkoujeroi0f18shi6lci@4ax.com...
>> On Fri, 08 Sep 2006 08:57:19 -0400, Jeffrey Ricker
>> <ricker@distributedinstruments.com> wrote:
>>
>>>It is not that I want to generate less classes; I want to have good
>>>object-oriented code. And I want to make sure I am using GMF as it was
>>>intended.
>>>
>>>If I have 12 objects named FooEditPart, Foo2EditPart, etc., it is
>>>conceivable that I would want some uniform behavior from those objects.
>>>I want to make a change one place, not 12. My approach is to have an
>>>abstract class named FooEditPartBase and have the 12 inherit from that
>>>class.
>>>
>>>Unless someone corrects me, I will assume that that is good GMF practice.
>>
>> I ended up using this approach. Unfortunately, I have to change the
>> extends clause of each of the classes to refer to the common
>> superclass, whenever I regenerate. Since I guess this is a common
>> thing to do, It would be great to be able to specify the generation of
>> this (empty) class. Perhaps a feature request: Specify the name of a
>> class for common code for the EditParts generated for the same
>> concept, when used in different parts of the hierarchy. The logical
>> place to have this informaiton is in gmfgen and it must survive
>> regeneration (of gmfgen from gmfmap).
>>
>> Hallvard
>
Re: Multiple editpart objects with numbers in name [message #45826 is a reply to message #45240] Tue, 12 September 2006 05:30 Go to previous messageGo to next message
Eclipse UserFriend
Hello Hallvard Tr?tteberg,

> Yes, but won't this prevent the generator from regenerating the
> content of the class, too?
No. This comment should affect only class header. All the methods + attributes
have own comments and should be regenerated as before. You can specify "@generated
NOT" for the class, remove some of the generated methods inside this class,
regenerate code and check that corresponding methods were added again.

-----------------
Alex Shatalin
Re: Multiple editpart objects with numbers in name [message #46102 is a reply to message #45826] Tue, 12 September 2006 08:20 Go to previous messageGo to next message
Eclipse UserFriend
On Tue, 12 Sep 2006 09:30:32 +0000 (UTC), Alex Shatalin
<vano@borland.com> wrote:

>Hello Hallvard Tr?tteberg,
>
>> Yes, but won't this prevent the generator from regenerating the
>> content of the class, too?
>No. This comment should affect only class header. All the methods + attributes
>have own comments and should be regenerated as before. You can specify "@generated
>NOT" for the class, remove some of the generated methods inside this class,
>regenerate code and check that corresponding methods were added again.

I'm grateful for this clarification! I guess I should have known.

Hallvard
Re: Multiple editpart objects with numbers in name [message #46278 is a reply to message #45271] Tue, 12 September 2006 08:49 Go to previous message
Eclipse UserFriend
> If there is general interest in this, and a chance to get this into
> the official GMF, I'm tempted to try.

I doubt GMF could accomodate to each and every requirement, so I won't
strive to handle e.g. extends/implements clauses for particular edit parts
in .gmfgen. To me, it's reasonable compromise for toolsmith to use his own
set of templates, rather than keeping overwhelmingly complex (though
flexible) genmodel.

Having said that, still, contributions are more than welcome :).
Establishing discussion as a bugzilla report might be the best way to find
out whether some improvement is generic enough to get into common codebase.

Artem

"Hallvard Tr?tteberg" <hal@idi.ntnu.no> wrote in message
news:ibbbg2pmch4e8j2rc0log2ois4p8eihkih@4ax.com...
> On Sun, 10 Sep 2006 14:58:07 +0200, "Michael Golubev"
> <michael.golubev@borland.com> wrote:
>
>>Hi,
>>
>>Consider the using of the changed templates.
>>Dynamic templates allows you to use, say, custom version of
>>NodeEditPart.javajet (with changed extends clause) but default versions
>>for
>>other templates.
>>This way, you will need to merge only single template file with ongoing
>>gmf
>>changes. Also it is very probable that in future, GMF will provide
>>significant amount of "template extension points" using conditional
>>includes. Please feel free to submit one for this particular conditional
>>include statement that specifies extend clause for edit parts.
>
> I've thought about replacing the template file. I believe I would
> need to extend the generator model with another attribute for holding
> the name of the superclass, and use this in the template. I would also
> need to change the generator to also generate the superclass. There
> may also need to be some logic for deciding what to generate into the
> superclass, e.g. figure definition, and what to generate into the
> subclasses, e.g. policy creation.
>
> If there is general interest in this, and a chance to get this into
> the official GMF, I'm tempted to try.
>
> Hallvard
>
>>
>>Regards,
>>Michael
>>
>>"Hallvard Tr?tteberg" <hal@idi.ntnu.no> wrote in message
>>news:88s7g2puct9lhdnkoujeroi0f18shi6lci@4ax.com...
>>> On Fri, 08 Sep 2006 08:57:19 -0400, Jeffrey Ricker
>>> <ricker@distributedinstruments.com> wrote:
>>>
>>>>It is not that I want to generate less classes; I want to have good
>>>>object-oriented code. And I want to make sure I am using GMF as it was
>>>>intended.
>>>>
>>>>If I have 12 objects named FooEditPart, Foo2EditPart, etc., it is
>>>>conceivable that I would want some uniform behavior from those objects.
>>>>I want to make a change one place, not 12. My approach is to have an
>>>>abstract class named FooEditPartBase and have the 12 inherit from that
>>>>class.
>>>>
>>>>Unless someone corrects me, I will assume that that is good GMF
>>>>practice.
>>>
>>> I ended up using this approach. Unfortunately, I have to change the
>>> extends clause of each of the classes to refer to the common
>>> superclass, whenever I regenerate. Since I guess this is a common
>>> thing to do, It would be great to be able to specify the generation of
>>> this (empty) class. Perhaps a feature request: Specify the name of a
>>> class for common code for the EditParts generated for the same
>>> concept, when used in different parts of the hierarchy. The logical
>>> place to have this informaiton is in gmfgen and it must survive
>>> regeneration (of gmfgen from gmfmap).
>>>
>>> Hallvard
>>
>
Previous Topic:creation of children elements along with parent elements
Next Topic:Diagram preferences
Goto Forum:
  


Current Time: Tue Jul 22 02:01:06 EDT 2025

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

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

Back to the top