platform-core-home/documents/plan_adapters.html
Parent Directory
|
Revision Log
Revision 1.2 - (view) (download) (as text)
| 1 : | johna | 1.1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 : | <html> | ||
| 3 : | <head> | ||
| 4 : | <title>Eclipse 3.0 adapter issues</title> | ||
| 5 : | <link rel="stylesheet" href="http://dev.eclipse.org/default_style.css" type="text/css"> | ||
| 6 : | </head> | ||
| 7 : | <body text="#000000" bgcolor="#FFFFFF"> | ||
| 8 : | |||
| 9 : | <h1>Eclipse 3.0 adapter issues</h1> | ||
| 10 : | <font size="-1">Last modified: February 16, 2004</font> | ||
| 11 : | <p> | ||
| 12 : | This document outlines proposed changes in the 3.0 timeframe to the | ||
| 13 : | <tt>IAdapterManager</tt> infrastructure. Related bug reports contain | ||
| 14 : | much of the rationale and discussion: | ||
| 15 : | </p> | ||
| 16 : | <ul> | ||
| 17 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=32498">bug 32498 - Support to contribute adapter factory via XML</a></li> | ||
| 18 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=32436">bug 32436 - Using adapters to filter UI selections without loading plugins</a></li> | ||
| 19 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=30577">bug 30577 - Actions should check for IAdaptable#getAdapter(IJavaElement.class)</a></li> | ||
| 20 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=36968">bug 36968 - [Plan Item] Improve action contributions</a></li> | ||
| 21 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=37937">bug 37937 - [plan item] Support Java references outside Java code</a></li> | ||
| 22 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=29809">bug 29809 - Rename/Delete Action hooks [refactoring]</a></li> | ||
| 23 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=29809">bug 29809 - Rename/Delete Action hooks [refactoring]</a></li> | ||
| 24 : | <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=29809">bug 29809 - Rename/Delete Action hooks [refactoring]</a></li> | ||
| 25 : | </ul> | ||
| 26 : | <h3>Current limitations</h3> | ||
| 27 : | <ul> | ||
| 28 : | <li>Nothing is known about an adapter factory until the plugin that provides the | ||
| 29 : | adapter is loaded. This makes it difficult to calculate if an action contribution | ||
| 30 : | or refactoring participant may potentially be applicable for a given selection until | ||
| 31 : | it is executed.</li> | ||
| 32 : | <li>The current API only supports returning a single adapter for a given adaptable | ||
| 33 : | type. For example, only one factory is allowed to adapt IFile to IPropertySource. | ||
| 34 : | In some contexts, it is appropriate to obtain all possible adapters on a type. Several | ||
| 35 : | plug-ins may want to supply an IPropertySource or an IActionFilter for IFile. | ||
| 36 : | </li> | ||
| 37 : | </ul> | ||
| 38 : | <h3>Proposed solution</h3> | ||
| 39 : | <p> | ||
| 40 : | Add the following three new methods to IAdapterManager:<br> | ||
| 41 : | <pre> | ||
| 42 : | public boolean hasAdapter(Object adaptable, String adapterTypeName); | ||
| 43 : | public Object getAdapter(Object adaptable, String adapterTypeName); | ||
| 44 : | public Object[] getAdapters(Object adaptable, String adapterTypeName); | ||
| 45 : | </pre> | ||
| 46 : | </p> | ||
| 47 : | <p> | ||
| 48 : | <tt>getAdapter</tt> returns the first non-null adapter found as it does today (transitive | ||
| 49 : | search of superclasses and then super-interfaces). <tt>getAdapters</tt> returns all adapters | ||
| 50 : | for all superclasses and interfaces of the supplied object. Only factories belonging | ||
| 51 : | to loaded plug-ins will be consulted by the <tt>getAdapter*</tt> methods. <tt>hasAdapter</tt> consults | ||
| 52 : | both loaded and unloaded factories. | ||
| 53 : | </p> | ||
| 54 : | <p> | ||
| 55 : | johna | 1.2 | A new "adapters" extension in the runtime plug-in will specify the name of the factory |
| 56 : | class, removing the need for plug-ins to explicitly register their adapters on startup | ||
| 57 : | (they would be lazily registered on the first lookup on that factory after the plug-in is loaded): | ||
| 58 : | johna | 1.1 | <pre> |
| 59 : | <extension point="org.eclipse.core.runtime.adapters"> | ||
| 60 : | <factory | ||
| 61 : | class="org.eclipse.jdt.internal.ui.JavaElementAdapterFactory" | ||
| 62 : | adaptableType="org.eclipse.jdt.core.IJavaElement"> | ||
| 63 : | <adapter class="org.eclipse.core.resources.IFile"> | ||
| 64 : | <adapter class="org.eclipse.ui.views.IPropertySource"> | ||
| 65 : | <adapter class="org.eclipse.ui.model.IWorkbenchAdapter"> | ||
| 66 : | ... | ||
| 67 : | </factory> | ||
| 68 : | </extension> | ||
| 69 : | </pre> | ||
| 70 : | </p> | ||
| 71 : | <p> | ||
| 72 : | johna | 1.2 | This extension point specifies a factory that adapts IJavaElement to IFile, IPropertySource, etc. |
| 73 : | johna | 1.1 | Of course, for backwards compatibility we will continue to support adapters |
| 74 : | registered manually that do no have associated markup. | ||
| 75 : | </p> | ||
| 76 : | |||
| 77 : | |||
| 78 : | |||
| 79 : | |||
| 80 : | |||
| 81 : | |||
| 82 : | |||
| 83 : | </body> | ||
| 84 : | </html> |
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
