Bug 568035 - AdapterManager.getFactories(Class<? extends Object>) should return a list of adapters
Summary: AdapterManager.getFactories(Class<? extends Object>) should return a list of ...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 4.14   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-20 06:40 EDT by Christoph Laeubrich CLA
Modified: 2020-10-20 06:40 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 Christoph Laeubrich CLA 2020-10-20 06:40:43 EDT
AdapterManager.getFactories(Class<? extends Object>) currently return a map from adapter type to exactly one Adapter factory.

This works quite well for simple cases but has two major drawbacks:
- if there is more than one Adapter capable of adapting a given type then it is a matter of start order which one is chosen
- if the chosen adapter can't adapt, the other is not queried anymore

currently this is "solved" in most cases to have special classes extending the desired one but this is not always possible, especially if the decision if a class can be adapted is done on the properties of the object itself!

Think about this simple use case:
- There is a tree of (java.io) file objects
- each file can have a different label/icon depending on its file type and additional metadata available
- each file might be converted and then opened by a special editor

Currently providing such functionality in a generic way requires a lot of effort and different techniques because it is not possible to use adapters for more than one type.

== What is proposed ==
AdapterManager is capable to iterate over all adapters providing a given adaptable

== What is not proposed ==
There is no guarantee on the order adapters are queried if they can adapt the same type, the first non-null result is chosen