diff options
4 files changed, 24 insertions, 5 deletions
diff --git a/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF index 4e51ffad9..3200f8cb3 100644 --- a/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.eclipse.e4.core.di -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IRequestor.java index d2b94b9ff..e0bee3cfe 100644 --- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IRequestor.java +++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IRequestor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -46,11 +46,17 @@ public interface IRequestor { /** * The injected object that initiated this request - * @return the object that initiated this request + * @return the object that initiated this request, may return <code>null</code> */ public Object getRequestingObject(); /** + * Class of the injected object + * @return class of the injected object, may return <code>null</code> + */ + public Class<?> getRequestingObjectClass(); + + /** * Determines if this requestor is still valid. Once requestor becomes invalid, it * stays invalid. Invalid requestors can be safely removed from computations. * @return <code>true</code> if this requestor is valid, <code>false</code> otherwise diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java index d36abb2b9..19bfa466a 100644 --- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java +++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -81,12 +81,18 @@ public class ConstructorRequestor extends Requestor { return descriptors; } + public Class<?> getRequestingObjectClass() { + return constructor.getDeclaringClass(); + } + @Override public String toString() { StringBuffer tmp = new StringBuffer(); Object object = getRequestingObject(); if (object != null) tmp.append(object.getClass().getSimpleName()); + else + tmp.append(constructor.getDeclaringClass().getSimpleName()); tmp.append('('); tmp.append(')'); return tmp.toString(); diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java index f5f8bcec1..e1d215eaa 100644 --- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java +++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -74,6 +74,13 @@ abstract public class Requestor implements IRequestor { return objectRef.get(); } + public Class<?> getRequestingObjectClass() { + Object object = getRequestingObject(); + if (object == null) + return null; + return object.getClass(); + } + /** * Determines if the requestor wants to be called whenever one of the dependent object changes. */ |