Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 127623 - Need API to distinguish between adapter not loaded and can't adapt
Summary: Need API to distinguish between adapter not loaded and can't adapt
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M2   Edit
Assignee: equinox.compendium-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 152147 (view as bug list)
Depends on:
Blocks: 119948
  Show dependency tree
 
Reported: 2006-02-14 03:40 EST by Dirk Baeumer CLA
Modified: 2006-08-29 09:55 EDT (History)
2 users (show)

See Also:


Attachments
Patch (4.58 KB, patch)
2006-08-28 10:53 EDT, Oleg Besedin CLA
no flags Details | Diff
Patch (4.58 KB, patch)
2006-08-28 13:18 EDT, Oleg Besedin CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2006-02-14 03:40:33 EST
The API is needed since when hasAdapter returns true but getAdapter returns false, there are two possible reasons which the expression language has to distnguish:

 - The factory is not yet loaded
 - The factory is loaded but cannot adapt that particular object.

(see also bug 119948 for a detailed discussion)
Comment 1 John Arthorne CLA 2006-07-28 16:28:38 EDT
*** Bug 152147 has been marked as a duplicate of this bug. ***
Comment 2 John Arthorne CLA 2006-07-28 16:29:43 EDT
From Boris in bug 152147:

I am proposing a new method along the following lines:
/** Returns true if all applicable adapter factories for the given adaptable
 * object and the given adapter type name are loaded. */
boolean IAdapterManager.allAdapterFactoriesLoaded(Object adaptable, String
adapterTypeName)

This would allow more accurate results whenever an adapt expression is used for
enablement or other purposes.
Comment 3 Dirk Baeumer CLA 2006-08-24 10:16:17 EDT
Any progress on this one. I got another complain about core expressions not behaving correctly.
Comment 4 Oleg Besedin CLA 2006-08-28 10:53:47 EDT
Created attachment 48880 [details]
Patch

The patch adds queryAdapter() method as suggested. 

Boris: I think that at most one adapter factory per the pair of the {originating type; resulting type} is stored in the current AdapterManager implementation. On the other hand, super types and implemented interfaces are considered and that might add some complexity.

Please let me know if this fits your needs; if so, I'll release it into the CVS head.
Comment 5 Boris Bokowski CLA 2006-08-28 11:37:23 EDT
+			if (factory != null)
+				return LOADED;
+		}
+		return NOT_LOADED;

should this not be:

+			if (factory == null)
+				return NOT_LOADED;
+		}
+		return LOADED;
Comment 6 Oleg Besedin CLA 2006-08-28 13:18:55 EDT
Created attachment 48897 [details]
Patch 

Yes, that's right! Updated patch is attached.
Comment 7 Oleg Besedin CLA 2006-08-29 09:55:30 EDT
Patch released into CVS head.