PropertySourceAdapterFactory bug? [message #221483] |
Mon, 14 August 2006 21:31 |
Dan Phifer Messages: 72 Registered: July 2009 |
Member |
|
|
In PropertySourceAdapterFactory.java, the getAdapter method checks to see
if the model is an actual IPropertySource or if it is an IAdaptable. If
neither of these is the case, it returns null. Is there a reason why it
does not attempt to adapt the model to the requested type with a call to:
Platform.getAdapterManager().getAdapter(model, adapterType)?
The way it is now, I see two issues.
1: It becomes more difficult to use existing models with GEF, since they
have to implement Eclipse interfaces to integrate properly.
2: The transparency with which the selection process works when directly
implementing IPropertySource on model object is lost when attempting to do
the same thing in a different, but equivalent way. That is, in most cases
adapting to IPropertySource should give the same results as implementing
IPropertySource (I think), especially when IAdaptable is checked for.
The simple solution for now is to add an adapter for my EditPart.
However, if my model objects are selected elsewhere, I will have to have
another adapter for IPropertySource. Not a big deal, but the
inconsistency is confusing.
|
|
|
Re: PropertySourceAdapterFactory bug? [message #221515 is a reply to message #221483] |
Tue, 15 August 2006 14:33 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Is this class part of GEF?
"Dan Phifer" <dan.phifer@gmail.com> wrote in message
news:e213870560b66dca69608694587bc1ab$1@www.eclipse.org...
> In PropertySourceAdapterFactory.java, the getAdapter method checks to see
> if the model is an actual IPropertySource or if it is an IAdaptable. If
> neither of these is the case, it returns null. Is there a reason why it
> does not attempt to adapt the model to the requested type with a call to:
>
> Platform.getAdapterManager().getAdapter(model, adapterType)?
>
> The way it is now, I see two issues.
>
> 1: It becomes more difficult to use existing models with GEF, since they
> have to implement Eclipse interfaces to integrate properly.
>
> 2: The transparency with which the selection process works when directly
> implementing IPropertySource on model object is lost when attempting to do
> the same thing in a different, but equivalent way. That is, in most cases
> adapting to IPropertySource should give the same results as implementing
> IPropertySource (I think), especially when IAdaptable is checked for.
>
> The simple solution for now is to add an adapter for my EditPart.
> However, if my model objects are selected elsewhere, I will have to have
> another adapter for IPropertySource. Not a big deal, but the
> inconsistency is confusing.
>
|
|
|
|
Re: PropertySourceAdapterFactory bug? [message #221611 is a reply to message #221575] |
Wed, 16 August 2006 13:38 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Ok, I remember this change now. Actually, that class is invoked by
Platform's adapter manager. It wouldn't make sense for it to then invoke the
platform's adapter manager again. So, just register another factory if you
need one.
See AbstractEditPart.getAdapter().
"Dan Phifer" <dan.phifer@gmail.com> wrote in message
news:e0696a12af58500a8ddf21123eb9e14b$1@www.eclipse.org...
> The package is declared as:
>
> package org.eclipse.gef.internal
>
|
|
|
Re: PropertySourceAdapterFactory bug? [message #221635 is a reply to message #221611] |
Wed, 16 August 2006 15:07 |
Dan Phifer Messages: 72 Registered: July 2009 |
Member |
|
|
>Actually, that class is invoked by
> Platform's adapter manager. It wouldn't make sense for it to then invoke the
> platform's adapter manager again.
Well, PropertySourceAdapterFactory does invoke
((IAdaptable)model).getAdapter(adapterType) if the model is adaptable,
which will likely (or could potentially/reasonably) call the adapter
manager again. So, if there's a potential problem there, it hasn't really
been avoided. However, the model should not have a reference to the edit
part, so cicularity shouldn't be a problem.
Anyway, I won't harp on this anymore, I just thought it might be an
improvement.
Thanks
|
|
|
Powered by
FUDForum. Page generated in 0.02682 seconds