Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Alternate base class for item providers
Alternate base class for item providers [message #494383] Fri, 30 October 2009 13:49 Go to next message
Dirk Hoffmann is currently offline Dirk HoffmannFriend
Messages: 163
Registered: July 2009
Senior Member
Hi,

while it is easy to customize the base class for model classes I
couldn't find how to do the same for edit classes. They extend
ItemProviderAdapter and I would like to introduce my own base class into
the class hierarchy. I feel there must be some easy way to do so. For
now I'm tweaking the respective code template.

Background:
I would like to override the getCreateChildImage method so it gets the
icons from the icons/full/obj16 directory with just the name of the
object to be created. Neither do I want to add a general base class to
the meta-model nor override this method in all the generated
ItemProvider classes.

Thanks and Regards,
Dirk
Re: Alternate base class for item providers [message #494466 is a reply to message #494383] Fri, 30 October 2009 18:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
Dirk,

Comments below.

Dirk Hoffmann wrote:
> Hi,
>
> while it is easy to customize the base class for model classes I
> couldn't find how to do the same for edit classes. They extend
> ItemProviderAdapter and I would like to introduce my own base class
> into the class hierarchy. I feel there must be some easy way to do so.
Like the Provider Root Extends Class.
> For now I'm tweaking the respective code template.
>
> Background:
> I would like to override the getCreateChildImage method so it gets the
> icons from the icons/full/obj16 directory with just the name of the
> object to be created. Neither do I want to add a general base class to
> the meta-model nor override this method in all the generated
> ItemProvider classes.
Maybe try turning Creation Icons off and see how you like that result.
>
> Thanks and Regards,
> Dirk


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Alternate base class for item providers [message #494689 is a reply to message #494466] Mon, 02 November 2009 08:32 Go to previous messageGo to next message
Dirk Hoffmann is currently offline Dirk HoffmannFriend
Messages: 163
Registered: July 2009
Senior Member
Thanks and sorry, I didn't mention that we're working with EMF version
2.2. I found the "Provider Root Extends Class" point in a more current
version. Unfortunately the software we're working on is to run in an
Eclipse 3.2 environment and as far as I know that restricts us to EMF
version 2.2 where I was not able to found that property.

Meanwhile more reasons to customize the root class of the item providers
came up: In order to provide a useful table view we want to add kind of
"ItemTableDescriptor" along the lines of the ItemPropertyDescriptor.

Looking at the ItemProvider.javajet template I found the following
snippet of template code:
----8< ------------------------------------------------------------ --
[...]
/**
* This is the item provider adapter for a {@link
<%=genClass.getQualifiedInterfaceName()%>} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class <%=genClass.getProviderClassName()%>
extends <%=genClass.getProviderBaseClassName() != null ?
genClass.getProviderBaseClassName() :
genModel.getImportedName("org.eclipse.emf.edit.provider.ItemProviderAdapter ")%>
[...]
----8< ------------------------------------------------------------ --
Apparently "genClass.getProviderBaseClassName()" could provide an
alternative for the root class of the providers. Still I have no idea
what needs to be configured to get my own class reference into the item
provider code. Is there an easy way with EMF 2.2?

Dirk



Ed Merks schrieb:
> Dirk,
>
> Comments below.
>
> Dirk Hoffmann wrote:
>> Hi,
>>
>> while it is easy to customize the base class for model classes I
>> couldn't find how to do the same for edit classes. They extend
>> ItemProviderAdapter and I would like to introduce my own base class
>> into the class hierarchy. I feel there must be some easy way to do so.
> Like the Provider Root Extends Class.
>> For now I'm tweaking the respective code template.
>>
>> Background:
>> I would like to override the getCreateChildImage method so it gets the
>> icons from the icons/full/obj16 directory with just the name of the
>> object to be created. Neither do I want to add a general base class to
>> the meta-model nor override this method in all the generated
>> ItemProvider classes.
> Maybe try turning Creation Icons off and see how you like that result.
>>
>> Thanks and Regards,
>> Dirk
Re: Alternate base class for item providers [message #494712 is a reply to message #494466] Mon, 02 November 2009 10:01 Go to previous message
Dirk Hoffmann is currently offline Dirk HoffmannFriend
Messages: 163
Registered: July 2009
Senior Member
Thanks and sorry, I didn't mention that we're working with EMF version
2.2. I found the "Provider Root Extends Class" point in a more current
version. Unfortunately the software we're working on is to run in an
Eclipse 3.2 environment and as far as I know that restricts us to EMF
version 2.2 where I was not able to find that property.

Meanwhile more reasons came up to customize the root class of the item
providers: In order to provide a useful table view we want to add kind
of a "ItemTableDescriptor" along the lines of the ItemPropertyDescriptor.

For now we changed the ItemProvider.javajet template and added an
annotation to the model specifying the alternate item provider root
class. I know it actually doesn't belong there but that seems to be the
only place where information can be placed that can be used inside the
templates. Would be great if the genmodel format provided some kind of
annotation for whatever special cases.

Dirk

Ed Merks schrieb:
> Dirk,
>
> Comments below.
>
> Dirk Hoffmann wrote:
>> Hi,
>>
>> while it is easy to customize the base class for model classes I
>> couldn't find how to do the same for edit classes. They extend
>> ItemProviderAdapter and I would like to introduce my own base class
>> into the class hierarchy. I feel there must be some easy way to do so.
> Like the Provider Root Extends Class.
>> For now I'm tweaking the respective code template.
>>
>> Background:
>> I would like to override the getCreateChildImage method so it gets the
>> icons from the icons/full/obj16 directory with just the name of the
>> object to be created. Neither do I want to add a general base class to
>> the meta-model nor override this method in all the generated
>> ItemProvider classes.
> Maybe try turning Creation Icons off and see how you like that result.
>>
>> Thanks and Regards,
>> Dirk
Previous Topic:The opposite of the opposite may not be a reference different from this one, but on which line?
Next Topic:Customizing EMF.Edit's ItemProviders
Goto Forum:
  


Current Time: Thu Sep 19 10:24:52 GMT 2024

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

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

Back to the top