Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 187909 - Too narrow implementation of getAdapter(Object) method of WorkbenchContent/LabelProvider
Summary: Too narrow implementation of getAdapter(Object) method of WorkbenchContent/La...
Status: RESOLVED DUPLICATE of bug 156581
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-18 17:09 EDT by Keith McQueen CLA
Modified: 2007-05-22 11:06 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keith McQueen CLA 2007-05-18 17:09:06 EDT
Build ID: M20070212-1330

I don't see any reason why the object passed in has to implement IAdaptable.  I could understand that *if* it does, then we should call the Object's getAdapter(Class) method, but if it does not implement IAdaptable, we could then use the AdapterManager to try to get the adapter.  I was able to subclass and override this behavior for the WorkbenchContentProvider, and that is okay.  The problem lies with the WorkbenchLabelProvider, because its getAdapter() method is marked final, so no one can override.  

I think that there are two mistakes here: 1) not being a little more open/accomodating in the implementation of the getAdapter() method and 2) not allowing the method to be overridden.

There are many cases where we have domain objects that should not have to be tied directly to Eclipse interfaces (most particularly for portability).  The Eclipse Platform provides a great way of getting adapters without having to rely on a particular interface.  If it were up to me, I would completely deprecate the IAdaptable interface.

Please get this fixed, so that we don't have to continually jump through hoops to get some real work done.

Thank you.
Comment 1 Paul Webster CLA 2007-05-18 18:25:34 EDT
You're in luck, it's already fixed in 3.3
PW
Comment 2 Keith McQueen CLA 2007-05-18 18:27:36 EDT
Hooray!  You guys are awesome!!
Comment 3 Paul Webster CLA 2007-05-18 18:36:51 EDT
I think it was fixed as part of bug 156581 ... our standard implementation does an instanceof check for the type, the if the object implements IAdapatable asks that for the type, and then goes to the AdapterManager and asks for the type.

PW
Comment 4 Tod Creasey CLA 2007-05-22 11:06:16 EDT

*** This bug has been marked as a duplicate of bug 156581 ***