|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2006 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 7-12
Link Here
|
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Martin Oberhuber (Wind River ) - [82973] add loadAdapter(Object,Class) API |
| 10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 11 |
package org.eclipse.core.runtime; |
12 |
package org.eclipse.core.runtime; |
| 12 |
|
13 |
|
|
Lines 198-203
Link Here
|
| 198 |
public int queryAdapter(Object adaptable, String adapterTypeName); |
199 |
public int queryAdapter(Object adaptable, String adapterTypeName); |
| 199 |
|
200 |
|
| 200 |
/** |
201 |
/** |
|
|
202 |
* Returns an object which is an instance of the given class associated |
| 203 |
* with the given object. Returns <code>null</code> if no such object can |
| 204 |
* be found. |
| 205 |
* <p> |
| 206 |
* Note that unlike the <code>getAdapter</code> methods, this method |
| 207 |
* will cause the plug-in that contributes the adapter factory to be loaded |
| 208 |
* if necessary. As such, this method should be used judiciously, in order |
| 209 |
* to avoid unnecessary plug-in activations. Most clients should avoid |
| 210 |
* activation by using <code>getAdapter</code> instead. |
| 211 |
* <p> |
| 212 |
* Unlike {link #loadAdapter(Object, String)}, this method first |
| 213 |
* queries the adaptable object for an adapter, in case it is an |
| 214 |
* instance of {link {@link IAdaptable}. Only if that query fails, |
| 215 |
* the adapter manager mechnism is used to potentially load an adapter |
| 216 |
* factory. Once the adapter factory is loaded, the object in question |
| 217 |
* is again first queried before querying the adapter factory. |
| 218 |
* |
| 219 |
* @param adaptable the adaptable object being queried (usually an instance |
| 220 |
* of <code>IAdaptable</code>) |
| 221 |
* @param adapterType the type of adapter to look up |
| 222 |
* @return an object castable to the given adapter type, or <code>null</code> |
| 223 |
* if the given adaptable object does not have an available adapter of the |
| 224 |
* given type |
| 225 |
* @since 3.4 |
| 226 |
*/ |
| 227 |
public Object loadAdapter(Object adaptable, Class adapterType); |
| 228 |
|
| 229 |
/** |
| 201 |
* Returns an object that is an instance of the given class name associated |
230 |
* Returns an object that is an instance of the given class name associated |
| 202 |
* with the given object. Returns <code>null</code> if no such object can |
231 |
* with the given object. Returns <code>null</code> if no such object can |
| 203 |
* be found. |
232 |
* be found. |