Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » AbstractEditPart and IAdaptable
AbstractEditPart and IAdaptable [message #197204] Fri, 30 September 2005 08:12 Go to next message
Krzysztof Ogrodnik is currently offline Krzysztof OgrodnikFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,
Can you tell me why the method getAdapter in AbstractEditPart returns null
instead of delegating to to the standard eclipse adapter manager
Platform.getAdapterManager().getAdapter()? Because of this null, extending
the edit parts using dynamically registered adapters is rather difficult.

public Object getAdapter(Class key)
{
if (IPropertySource.class == key) {
if (getModel() instanceof IPropertySource)
return getModel();
if (getModel() instanceof IAdaptable)
return ((IAdaptable)getModel()).getAdapter(key);
}
if (AccessibleEditPart.class == key)
return getAccessibleEditPart();
return null;
}

Kind regards,

Krzysztof
Re: AbstractEditPart and IAdaptable [message #197231 is a reply to message #197204] Fri, 30 September 2005 12:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Krzysztof Ogrodnik" <ogrodnikk@axxia.com> wrote in message
news:dhis17$et0$1@news.eclipse.org...
> Hi,
> Can you tell me why the method getAdapter in AbstractEditPart returns null
> instead of delegating to to the standard eclipse adapter manager
> Platform.getAdapterManager().getAdapter()? Because of this null, extending
> the edit parts using dynamically registered adapters is rather difficult.
>
Why is it difficult?

public Object getAdapter(Class key)
{
Object adapter = super.getAdapter(key);
if(adapter == null) {
adapter = Platform.getAdapterManager().getAdapter(key);
}
return adapter;
}

---
Sunil
Re: AbstractEditPart and IAdaptable [message #197266 is a reply to message #197231] Fri, 30 September 2005 15:27 Go to previous messageGo to next message
Krzysztof Ogrodnik is currently offline Krzysztof OgrodnikFriend
Messages: 3
Registered: July 2009
Junior Member
It is not difficult but it is not nice neither! Apart from that, I am not
implementing edit parts in my project. I am adding new functionality on top
of existing GEF based project (JBPM workflow designer). In my case dynamic
adapter registration exactly suit my needs. Unfortunately because of this
null I had to change code in the project I am depending on and add this fix.
Of course I can do it but I think that this behavior should be a default
behavior and should rather go to GEF base class. I believe that at some
point other people may have similar problem.

Kind regards,

Krzysztof



"Sunil Kamath" <sunil_kamath@nohotspammail.com> wrote in message
news:dhjcoc$765$1@news.eclipse.org...
>
> "Krzysztof Ogrodnik" <ogrodnikk@axxia.com> wrote in message
> news:dhis17$et0$1@news.eclipse.org...
>> Hi,
>> Can you tell me why the method getAdapter in AbstractEditPart returns
>> null instead of delegating to to the standard eclipse adapter manager
>> Platform.getAdapterManager().getAdapter()? Because of this null,
>> extending the edit parts using dynamically registered adapters is rather
>> difficult.
>>
> Why is it difficult?
>
> public Object getAdapter(Class key)
> {
> Object adapter = super.getAdapter(key);
> if(adapter == null) {
> adapter = Platform.getAdapterManager().getAdapter(key);
> }
> return adapter;
> }
>
> ---
> Sunil
>
Re: AbstractEditPart and IAdaptable [message #197396 is a reply to message #197204] Mon, 03 October 2005 15:30 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Please open a feature request.

"Krzysztof Ogrodnik" <ogrodnikk@axxia.com> wrote in message
news:dhis17$et0$1@news.eclipse.org...
> Hi,
> Can you tell me why the method getAdapter in AbstractEditPart returns null
> instead of delegating to to the standard eclipse adapter manager
> Platform.getAdapterManager().getAdapter()? Because of this null, extending
> the edit parts using dynamically registered adapters is rather difficult.
>
> public Object getAdapter(Class key)
> {
> if (IPropertySource.class == key) {
> if (getModel() instanceof IPropertySource)
> return getModel();
> if (getModel() instanceof IAdaptable)
> return ((IAdaptable)getModel()).getAdapter(key);
> }
> if (AccessibleEditPart.class == key)
> return getAccessibleEditPart();
> return null;
> }
>
> Kind regards,
>
> Krzysztof
>
>
>
Previous Topic:Draw2d FigureCanvas scrollbar visibility issue
Next Topic:Label and TextFlow - combine functionality
Goto Forum:
  


Current Time: Fri Jan 17 09:21:48 GMT 2025

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

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

Back to the top