aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2012-08-28 13:04:04 (EDT)
committerPaul Webster2012-08-28 13:04:04 (EDT)
commit510a215757121d7e63c83aaa3d565761b3d32fcb (patch)
tree22d273a63a9b300bb61969240b57b2dee5e7beeb
parent674c31cbc68d5fa3b8d10b6f7a824fd7143796fd (diff)
downloadeclipse.platform.runtime-510a215757121d7e63c83aaa3d565761b3d32fcb.zip
eclipse.platform.runtime-510a215757121d7e63c83aaa3d565761b3d32fcb.tar.gz
eclipse.platform.runtime-510a215757121d7e63c83aaa3d565761b3d32fcb.tar.bz2
the ancestor only validate the object is not set locally
-rw-r--r--bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java4
-rw-r--r--tests/org.eclipse.e4.core.tests/src/org/eclipse/e4/core/internal/tests/contexts/ActivationTest.java22
2 files changed, 23 insertions, 3 deletions
diff --git a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
index 253d9c1..e2c07ef 100644
--- a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
+++ b/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java
@@ -737,9 +737,9 @@ public class EclipseContext implements IEclipseContext {
public Object getActive(final String name) {
final String internalName = ACTIVE_VARIABLE + name;
- if (containsKey(internalName, false)) {
+ if (containsKey(internalName, true)) {
trackAccess(internalName);
- return internalGet(this, internalName, false);
+ return internalGet(this, internalName, true);
}
final EclipseContext originatingContext = 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 ca14f5f..acced63 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
@@ -17,7 +17,6 @@ import javax.inject.Named;
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.IEclipseContext;
import org.eclipse.e4.core.contexts.RunAndTrack;
@@ -140,6 +139,27 @@ public class ActivationTest extends TestCase {
assertEquals("5", child2.getActive("var"));
}
+ public void testGetActiveBug384425() {
+ IEclipseContext root = EclipseContextFactory.create("root");
+
+ IEclipseContext child1 = root.createChild("child1");
+ IEclipseContext child11 = child1.createChild("child11");
+
+ IEclipseContext child2 = root.createChild("child2");
+
+ // nothing is active - we get value from the node
+ assertNull(root.getActive("var"));
+ assertNull(child1.getActive("var"));
+ assertNull(child2.getActive("var"));
+
+ child11.activateBranch();
+ child11.set("var", "1");
+
+ assertEquals("1", root.getActive("var"));
+ assertEquals("1", child1.getActive("var"));
+ assertNull(child2.getActive("var"));
+ }
+
public void testGetActiveRAT() {
IEclipseContext root = EclipseContextFactory.create("root");