Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2015-09-30 21:55:40 +0000
committerStefan Xenos2015-10-13 15:24:10 +0000
commit560a0b61a9a7c74b59177f8dda7d89af812a844f (patch)
tree5842b1ab636571974bd45484de597eb455234d87 /bundles
parent91df8028994f2a13f609073217720268ce35e393 (diff)
downloadrt.equinox.bundles-560a0b61a9a7c74b59177f8dda7d89af812a844f.tar.gz
rt.equinox.bundles-560a0b61a9a7c74b59177f8dda7d89af812a844f.tar.xz
rt.equinox.bundles-560a0b61a9a7c74b59177f8dda7d89af812a844f.zip
Bug 478685 - Provide convenient method for getAdapter(Object
sourceObject, Class<T> adapter, true) Change-Id: I9b6253f301a271a4630eb1d1f78491ee76bca997 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java
index 324ce4f9..d0e8a25b 100644
--- a/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java
+++ b/bundles/org.eclipse.equinox.common/src/org/eclipse/core/runtime/Adapters.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Lars Vogel <Lars.Vogel@vogella.com> - Bug 478685
*******************************************************************************/
package org.eclipse.core.runtime;
@@ -80,6 +81,19 @@ public class Adapters {
return null;
}
+ /**
+ * If it is possible to adapt the given object to the given type, this
+ * returns the adapter.
+ * <p>
+ * Convenient method for calling <code>getAdapter(Object, Class, true)</code>.
+ * <p>
+ * See {@link #getAdapter(Object, Class, boolean)}.
+ *
+ */
+ public static <T> T adapt(Object sourceObject, Class<T> adapter) {
+ return getAdapter(sourceObject, adapter, true);
+ }
+
private static Object queryAdapterManager(Object sourceObject, String adapterId, boolean allowActivation) {
Object result;
if (allowActivation) {

Back to the top