aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2011-09-28 16:29:26 (EDT)
committerOleg Besedin2011-09-28 16:29:26 (EDT)
commitb9f758ea70fc19eb822897008912fb8ec7b9e707 (patch)
tree2de8595ecf3bdb186e8b718c4436022296a4a84c
parentca5404eb7ab1e116df0736da131764508e97e533 (diff)
downloadeclipse.platform.runtime-b9f758ea70fc19eb822897008912fb8ec7b9e707.zip
eclipse.platform.runtime-b9f758ea70fc19eb822897008912fb8ec7b9e707.tar.gz
eclipse.platform.runtime-b9f758ea70fc19eb822897008912fb8ec7b9e707.tar.bz2
Bug 357865 - Need IRequestor API for class being injectedv20110928-2029
-rw-r--r--bundles/org.eclipse.e4.core.di/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/di/suppliers/IRequestor.java10
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java8
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java9
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 4e51ffa..3200f8c 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 d2b94b9..e0bee3c 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 d36abb2..19bfa46 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 f5f8bce..e1d215e 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.
*/