Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Distinct ItemProvider for different view
Distinct ItemProvider for different view [message #905158] Wed, 29 August 2012 20:19 Go to next message
Michael Spertus is currently offline Michael Spertus
Messages: 78
Registered: July 2009
Member
I have a modeled base class B that has many modeled subclasses D1, D2,... Dn. In one of my views, I need a different BItemProvider.getChildrenFeatures().

If B didn't have any subclasses, I would simply create a subclass of my adapter factory to return a subclass MyViewBItemProvider of BItemProvider with a different getChildrenFeatures method (as in the Extending ItemProviders By Extension section of this article).

However, this doesn't work with subclasses as D1ItemProvider, D2ItemProvider, etc. will not see MyViewBItemProvider. Is there any way to customize the base class ItemProvider for a specific view without having to provide customized item providers for each subclass (n is a large number in my application)?

Thanks,

Mike
Re: Distinct ItemProvider for different view [message #905277 is a reply to message #905158] Thu, 30 August 2012 04:06 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26050
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Mike,<br>
 <br>
Sorry for the other direct email reply, my new Thunderbird 15
version has two buttons for reply and follow-up and the reply button
is where there used to be just a follow-up button...<br>
<br>
More comments below. <br>
<br>
<br>
On 29/08/2012 10:19 PM, Michael Spertus wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a modeled base class B that has many modeled subclasses D1,
D2,... Dn. In one of my views, I need a different BItemProvider.getChildrenFeatu<wbr>res().<br>
<br>
If B didn't have any subclasses, I would simply create a subclass
of my adapter factory to return a subclass MyViewBItemProvider of
BItemProvider with a different getChildrenFeatures method (as in
the Extending ItemProviders By Extension section of <a
href="http://nirmalsasidharan.wordpress.com/2011/05/18/extending-emf-itemproviders-using-google-guice-i/"
target="_blank">http://nirmalsasidharan.wordpr<wbr>ess.com/2011/05/18/extending-<wbr>emf-itemproviders-using-<wbr>google-guice-i/</a>).
<br>
</blockquote>
It's really the only way.<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
However, this doesn't work with subclasses as D1ItemProvider,
D2ItemProvider, etc. will not see MyViewBItemProvider. Is there
any way to customize the base class ItemProvider for a specific
view without having to provide customized item providers for each
subclass (n is a large number in my application)?<br>
</blockquote>
I suppose you could specialize the original one but parameterize the
specialization in some way that it can be "configured".   I.e., have
it check its adapter factory for the "option" of which way it should
behave. Then you can have the normal default behavior and a
specialized adapter factory that makes it behave in the specialized
way, with that specialization affecting all subclasses.  Note that
the adapter factory is passed to the constructor and is available in
a protected field.<br>
<br>
Thanks,<br>
<br>
Mike
</body>
</html>
Previous Topic:[Teneo] Parent/Child/Child cascade merging error
Next Topic:Global AdapterFactory vs one per each EditingDomain
Goto Forum:
  


Current Time: Fri Sep 19 02:04:16 GMT 2014

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

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