aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobesedin2011-11-21 14:15:17 (EST)
committerobesedin2011-11-21 14:15:17 (EST)
commit0e5242977d5dd079aa45de99c7d85d1e41f5b60a (patch)
treed1e3ea0f1bc0c20c261d858a51e39f449b076f6b
parent559afd83d83b96138e03ff969292171715b228b5 (diff)
downloadeclipse.platform.ui-0e5242977d5dd079aa45de99c7d85d1e41f5b60a.zip
eclipse.platform.ui-0e5242977d5dd079aa45de99c7d85d1e41f5b60a.tar.gz
eclipse.platform.ui-0e5242977d5dd079aa45de99c7d85d1e41f5b60a.tar.bz2
Bug 363856 - [DI] Erroneous field injectionv20111121-1915I20111123-0610
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java12
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ResourceHandlerTest.java4
2 files changed, 8 insertions, 8 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java
index cd3bae2..e4ac3ac 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelAssembler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 BestSolution.at and others.
+ * Copyright (c) 2010, 2011 BestSolution.at 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
@@ -27,6 +27,7 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.RegistryFactory;
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.di.annotations.Execute;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
@@ -192,8 +193,8 @@ public class ModelAssembler {
}
private void runProcessor(IConfigurationElement ce) {
- IEclipseContext localContext = context.createChild();
- IContributionFactory factory = localContext.get(IContributionFactory.class);
+ IEclipseContext localContext = EclipseContextFactory.create();
+ IContributionFactory factory = context.get(IContributionFactory.class);
for (IConfigurationElement ceEl : ce.getChildren("element")) { //$NON-NLS-1$
String id = ceEl.getAttribute("id"); //$NON-NLS-1$
@@ -218,9 +219,8 @@ public class ModelAssembler {
try {
Object o = factory
.create("platform:/plugin/" + ce.getContributor().getName() + "/" + ce.getAttribute("class"), //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- localContext);
- ContextInjectionFactory.invoke(o, Execute.class, localContext);
- localContext.dispose();
+ context, localContext);
+ ContextInjectionFactory.invoke(o, Execute.class, context, localContext);
} catch (Exception e) {
logger.warn(e, "Could not run processor"); //$NON-NLS-1$
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ResourceHandlerTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ResourceHandlerTest.java
index be77839..79b8314 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ResourceHandlerTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ResourceHandlerTest.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
@@ -145,7 +145,7 @@ public class ResourceHandlerTest extends HeadlessStartupTest {
}
}
- assertEquals(1, application.getHandlers().size());
+ assertTrue(application.getHandlers().size() > 0);
assertSame(application.getCommands().get(0), application.getHandlers()
.get(0).getCommand());
assertEquals(2, application.getCommands().get(0).getParameters().size());