aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2013-03-08 13:56:19 (EST)
committerBrian de Alwis2013-03-08 14:38:05 (EST)
commit489336e316b06d1c794c02e6107af7462f6c99f5 (patch)
tree2ab19214353d4277b8c8a84bc527be79fb5a5f60
parentc67a8b3f1829608ef41c90def5b72229fb9ac095 (diff)
downloadeclipse.platform.runtime-489336e316b06d1c794c02e6107af7462f6c99f5.zip
eclipse.platform.runtime-489336e316b06d1c794c02e6107af7462f6c99f5.tar.gz
eclipse.platform.runtime-489336e316b06d1c794c02e6107af7462f6c99f5.tar.bz2
Bug 401933 - [Contexts] IContextFunction should receive the lookup keyrefs/changes/92/10992/3
Add support for revised IContextFunction#compute(IEclipseContext,String). Change-Id: Ia3e957338fe2d5ec20204e4da33fab649db3b52f
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java12
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IContextFunction.java7
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IEclipseContext.java6
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java2
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ActivationTest.java2
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java3
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ContextDynamicTest.java2
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/DependenciesLeakTest.java4
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/EclipseContextTest.java4
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ReparentingTest.java6
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/RunAndTrackTest.java2
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ActivationInjectionTest.java2
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ComplexDisposalTest.java2
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ContextFunctionDynamicsTest.java12
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/InjectionUpdateTest.java15
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/performance/ContextPerformanceTest.java6
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ComputedValueLimitationTest.java6
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ContextExample.java4
18 files changed, 55 insertions, 42 deletions
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java
index a5df31b..06f27ea 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/ContextFunction.java
@@ -29,8 +29,18 @@ public abstract class ContextFunction implements IContextFunction {
}
/**
+ * @deprecated {@link IContextFunction}'s compute() was changed to take the context key
+ */
+ public Object compute(IEclipseContext context) {
+ return null;
+ }
+
+ /**
* {@inheritDoc}
*/
- public abstract Object compute(IEclipseContext context);
+ public Object compute(IEclipseContext context, String contextKey) {
+ // call into now-deprecated method to maintain backwards compatibility
+ return compute(context);
+ }
}
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IContextFunction.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IContextFunction.java
index 3e27bf7..3929c4b 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IContextFunction.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IContextFunction.java
@@ -63,8 +63,11 @@ public interface IContextFunction {
*
* @param context
* The context in which to perform the value computation.
+ * @param contextKey
+ * The context key used to find this function; may be {@code null} such
+ * as if invoked directly.
* @return The concrete value.
*/
- public Object compute(IEclipseContext context);
+ public Object compute(IEclipseContext context, String contextKey);
-} \ No newline at end of file
+}
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IEclipseContext.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IEclipseContext.java
index 31de170..920781e 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IEclipseContext.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/contexts/IEclipseContext.java
@@ -66,7 +66,7 @@ public interface IEclipseContext {
* <code>null</code>.
* <p>
* If the value associated with this name is an {@link ContextFunction}, this method will
- * evaluate {@link ContextFunction#compute(IEclipseContext)}.
+ * evaluate {@link ContextFunction#compute(IEclipseContext, String)}.
* </p>
* @param name the name of the value to return
* @return an object corresponding to the given name, or <code>null</code>
@@ -89,7 +89,7 @@ public interface IEclipseContext {
* </p>
* <p>
* If the value associated with this name is an {@link ContextFunction}, this method will
- * evaluate {@link ContextFunction#compute(IEclipseContext)}.
+ * evaluate {@link ContextFunction#compute(IEclipseContext, String)}.
* </p>
* @param name the name of the value to return
* @return an object corresponding to the given name, or <code>null</code>
@@ -161,7 +161,7 @@ public interface IEclipseContext {
* Sets a value to be associated with a given name in this context. The value may be an
* arbitrary object, or it may be an {@link ContextFunction}. In the case of a function,
* subsequent invocations of {@link #get(String)} with the same name will invoke
- * {@link ContextFunction#compute(IEclipseContext)} to obtain the value. The value
+ * {@link ContextFunction#compute(IEclipseContext, String)} to obtain the value. The value
* may be <code>null</code>.
* <p>
* Removal can never affect a parent context, so it is possible that a subsequent call to
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java
index 713eafa..2afdadf 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/ValueComputation.java
@@ -58,7 +58,7 @@ public class ValueComputation extends Computation {
originatingContext.pushComputation(this);
computing = true;
try {
- cachedValue = function.compute(originatingContext);
+ cachedValue = function.compute(originatingContext, name);
} finally {
computing = false;
originatingContext.popComputation(this);
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ActivationTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ActivationTest.java
index acced63..184aef7 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ActivationTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ActivationTest.java
@@ -24,7 +24,7 @@ import org.eclipse.e4.core.contexts.RunAndTrack;
public class ActivationTest extends TestCase {
static public class TestRAT extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
IEclipseContext activeContext = context.getActiveLeaf();
// returns name of the context
return activeContext.get("debugString");
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java
index d81555f..bbaacb0 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/AddContextFunction.java
@@ -12,7 +12,6 @@
package org.eclipse.e4.core.internal.tests.contexts;
import org.eclipse.e4.core.contexts.ContextFunction;
-
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -27,7 +26,7 @@ public class AddContextFunction extends ContextFunction {
* @see org.eclipse.e4.core.services.context.spi.ContextFunction#compute(org.
* eclipse.e4.core.services.context.IEclipseContext, java.lang.Object[])
*/
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
Integer xInt = (Integer) context.get("x");
Integer yInt = (Integer) context.get("y");
int sum = xInt == null ? 0 : xInt.intValue();
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ContextDynamicTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ContextDynamicTest.java
index f7de2c1..319397f 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ContextDynamicTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ContextDynamicTest.java
@@ -39,7 +39,7 @@ public class ContextDynamicTest extends TestCase {
assertNull(context.getLocal("bar"));
context.set("bar", "baz1");
context.set("bar", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return "baz1";
}
});
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/DependenciesLeakTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/DependenciesLeakTest.java
index 46632c8..f818763 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/DependenciesLeakTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/DependenciesLeakTest.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Stefan Mücke - initial API and implementation
+ * Stefan M�cke - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.core.internal.tests.contexts;
@@ -27,7 +27,7 @@ public class DependenciesLeakTest extends TestCase {
this.commandId = commandId;
}
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return context.get(LEGACY_H_ID + commandId);
}
@Override
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/EclipseContextTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/EclipseContextTest.java
index 44468f3..4b31e74 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/EclipseContextTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/EclipseContextTest.java
@@ -21,7 +21,7 @@ import org.eclipse.e4.core.internal.contexts.EclipseContext;
public class EclipseContextTest extends TestCase {
private static class ComputedValueBar extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return context.get("bar");
}
}
@@ -138,7 +138,7 @@ public class EclipseContextTest extends TestCase {
assertEquals(3, runCounter);
assertEquals(null, value[0]);
context.set("foo", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return context.get("bar");
}
});
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ReparentingTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ReparentingTest.java
index 302f9c1..e4a81b6 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ReparentingTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ReparentingTest.java
@@ -15,9 +15,9 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
-import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.contexts.RunAndTrack;
import org.eclipse.e4.core.internal.tests.contexts.inject.ObjectSuperClass;
@@ -259,8 +259,8 @@ public class ReparentingTest extends TestCase {
final int[] testServiceCount = new int[1];
testServiceCount[0] = 0;
IEclipseContext parentContext = EclipseContextFactory.create("parent");
- parentContext.set(TestService.class.getName(), new IContextFunction() {
- public Object compute(IEclipseContext context) {
+ parentContext.set(TestService.class.getName(), new ContextFunction() {
+ public Object compute(IEclipseContext context, String contextKey) {
testServiceCount[0]++;
return ContextInjectionFactory.make(TestService.class, context);
}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/RunAndTrackTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/RunAndTrackTest.java
index 2affc0f..a19376f 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/RunAndTrackTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/RunAndTrackTest.java
@@ -30,7 +30,7 @@ public class RunAndTrackTest extends TestCase {
private class ActivePartLookupFunction extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
IEclipseContext childContext = (IEclipseContext) context.getLocal(ACTIVE_CHILD);
if (childContext != null) {
return childContext.get(ACTIVE_PART);
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ActivationInjectionTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ActivationInjectionTest.java
index 0c3e769..d8506fc 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ActivationInjectionTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ActivationInjectionTest.java
@@ -26,7 +26,7 @@ import org.eclipse.e4.core.di.annotations.Optional;
public class ActivationInjectionTest extends TestCase {
static public class TestRAT extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
IEclipseContext activeContext = context.getActiveLeaf();
// returns name of the context
return "_" + activeContext.get("debugString") + "_";
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ComplexDisposalTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ComplexDisposalTest.java
index 4ec22c0..ed11749 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ComplexDisposalTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ComplexDisposalTest.java
@@ -45,7 +45,7 @@ public class ComplexDisposalTest extends TestCase {
public static class TestFunction extends ContextFunction {
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return ContextInjectionFactory.make(Test.class, context);
}
}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ContextFunctionDynamicsTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ContextFunctionDynamicsTest.java
index 683da42..1c0a071 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ContextFunctionDynamicsTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/ContextFunctionDynamicsTest.java
@@ -44,7 +44,7 @@ public class ContextFunctionDynamicsTest extends TestCase {
context1.set(SELECTION, new ContextFunction() {
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return "func1";
}
});
@@ -56,7 +56,7 @@ public class ContextFunctionDynamicsTest extends TestCase {
context1.set(SELECTION, new ContextFunction() {
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return "func2";
}
});
@@ -74,7 +74,7 @@ public class ContextFunctionDynamicsTest extends TestCase {
context1.set(SELECTION, new ContextFunction() {
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return "func1";
}
});
@@ -102,7 +102,7 @@ public class ContextFunctionDynamicsTest extends TestCase {
// ICF set on top context
context1.set(SELECTION, new ContextFunction() {
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return "func1";
}
});
@@ -115,7 +115,7 @@ public class ContextFunctionDynamicsTest extends TestCase {
// Override ICF set on the 2nd context
context2.set(SELECTION, new ContextFunction() {
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return "func2";
}
});
@@ -146,7 +146,7 @@ public class ContextFunctionDynamicsTest extends TestCase {
appContext.set(SELECTION, new ContextFunction() {
@Override
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
IEclipseContext parent = context.getParent();
while (parent != null) {
context = parent;
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/InjectionUpdateTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/InjectionUpdateTest.java
index a482187..c6f90c2 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/InjectionUpdateTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/inject/InjectionUpdateTest.java
@@ -20,7 +20,6 @@ import junit.framework.TestCase;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
-import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
@@ -69,19 +68,19 @@ public class InjectionUpdateTest extends TestCase {
c1.set("base", "abc");
c21.set("derived1", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
String baseString = (String) context.get("base");
return baseString.charAt(0) + "_";
}});
c22.set("derived2", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
String baseString = (String) context.get("base");
return "_" + baseString.charAt(baseString.length() - 1);
}});
c1.set("calculated", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
IEclipseContext context21 = (IEclipseContext) context.get("c21");
String derived1 = (String) context21.get("derived1");
@@ -122,8 +121,8 @@ public class InjectionUpdateTest extends TestCase {
public void testNestedUpdatesPostConstruct() throws Exception {
IEclipseContext appContext = EclipseContextFactory.create();
- appContext.set(InjectTarget.class.getName(), new IContextFunction() {
- public Object compute(IEclipseContext context) {
+ appContext.set(InjectTarget.class.getName(), new ContextFunction() {
+ public Object compute(IEclipseContext context, String contextKey) {
return ContextInjectionFactory
.make(InjectTarget.class, context);
}
@@ -157,8 +156,8 @@ public class InjectionUpdateTest extends TestCase {
public void testNestedUpdatesConstructor() throws Exception {
IEclipseContext appContext = EclipseContextFactory.create();
- appContext.set(InjectTarget2.class.getName(), new IContextFunction() {
- public Object compute(IEclipseContext context) {
+ appContext.set(InjectTarget2.class.getName(), new ContextFunction() {
+ public Object compute(IEclipseContext context, String contextKey) {
return ContextInjectionFactory.make(InjectTarget2.class,
context);
}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/performance/ContextPerformanceTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/performance/ContextPerformanceTest.java
index 93f5ce5..bddbeea 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/performance/ContextPerformanceTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/performance/ContextPerformanceTest.java
@@ -82,7 +82,7 @@ public class ContextPerformanceTest extends TestCase {
public void testLookupContextFunction() {
context.set("somefunction", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return "result";
}
});
@@ -95,7 +95,7 @@ public class ContextPerformanceTest extends TestCase {
public void testSetContextFunction() {
context.set("somefunction", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return context.get("something");
}
});
@@ -114,7 +114,7 @@ public class ContextPerformanceTest extends TestCase {
*/
public void testSetValueRunAndTrack() {
context.set("somefunction", new ContextFunction() {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
// make sure this function has a large number of dependencies
for (int i = 0; i < 1000; i++) {
context.get("NonExistentValue-" + i);
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ComputedValueLimitationTest.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ComputedValueLimitationTest.java
index 6ee4b78..bc47136 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ComputedValueLimitationTest.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ComputedValueLimitationTest.java
@@ -11,9 +11,11 @@
package org.eclipse.e4.core.internal.tests.manual;
import javax.inject.Inject;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
@@ -66,14 +68,14 @@ public class ComputedValueLimitationTest extends TestCase {
public class CalcColor extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
int useArg = ExtenralFactor.useChild();
return context.get("arg" + Integer.toString(useArg));
}
}
public class Time extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
context.get(String.valueOf(System.currentTimeMillis()));
return new Long(System.currentTimeMillis());
}
diff --git a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ContextExample.java b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ContextExample.java
index 7f2a148..6251c18 100644
--- a/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ContextExample.java
+++ b/tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/manual/ContextExample.java
@@ -61,7 +61,7 @@ public class ContextExample {
}
static class ComplementaryColor extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
switch ((Color) context.get("color")) {
case RED:
return Color.GREEN;
@@ -82,7 +82,7 @@ public class ContextExample {
}
static class ResourceSelection extends ContextFunction {
- public Object compute(IEclipseContext context) {
+ public Object compute(IEclipseContext context, String contextKey) {
return null;
}
}