aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSopot Cela2012-11-07 14:37:38 (EST)
committerPaul Webster2012-11-08 09:59:07 (EST)
commitb00b923467c7a1459dac5b1b99789966863b556a (patch)
tree32e2771b38388d3c06abe7acd9dc1cb5e297465c
parentc5c26e64793c6f678374943bc85f251bfeb2a46f (diff)
downloadeclipse.platform.ui-b00b923467c7a1459dac5b1b99789966863b556a.zip
eclipse.platform.ui-b00b923467c7a1459dac5b1b99789966863b556a.tar.gz
eclipse.platform.ui-b00b923467c7a1459dac5b1b99789966863b556a.tar.bz2
Bug 376254 - Manually adding to Workbench Modell / Callingv20121108-145907
E4Workbench.processHierarchy manually necessary Have a processing addon update all of the handlers, and add event listeners for handler add and context add
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java2
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java41
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java166
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java1
-rw-r--r--bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi1
-rw-r--r--examples/org.eclipse.e4.demo.contacts/Application.e4xmi1
-rw-r--r--examples/org.eclipse.e4.demo.e4photo/Application.e4xmi7
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java2
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java2
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java2
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java2
-rw-r--r--tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java4
12 files changed, 176 insertions, 55 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
index 293a68d..1dffa6c 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
@@ -615,8 +615,6 @@ public class PartRenderingEngine implements IPresentationEngine {
for (String key : props.keySet()) {
lclContext.set(key, props.get(key));
}
-
- E4Workbench.processHierarchy(element);
}
}
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
index fc78a1c..ae30b84 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
@@ -11,21 +11,14 @@
******************************************************************************/
package org.eclipse.e4.ui.internal.workbench;
-import java.util.Iterator;
import java.util.List;
-import org.eclipse.e4.core.commands.EHandlerService;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.MApplicationElement;
-import org.eclipse.e4.ui.model.application.commands.MCommand;
-import org.eclipse.e4.ui.model.application.commands.MHandler;
-import org.eclipse.e4.ui.model.application.commands.MHandlerContainer;
import org.eclipse.e4.ui.model.application.ui.MContext;
-import org.eclipse.e4.ui.model.application.ui.MElementContainer;
-import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
@@ -114,8 +107,6 @@ public class E4Workbench implements IWorkbench {
if (context != null) {
context.set(ExpressionContext.ALLOW_ACTIVATION, Boolean.TRUE);
}
- // Do a top level processHierarchy for the application?
- processHierarchy(appElement);
}
/**
@@ -151,38 +142,6 @@ public class E4Workbench implements IWorkbench {
return appModel;
}
- public static void processHierarchy(Object me) {
- if (me instanceof MHandlerContainer) {
- MContext contextModel = (MContext) me;
- MHandlerContainer container = (MHandlerContainer) contextModel;
- IEclipseContext context = contextModel.getContext();
- if (context != null) {
- IContributionFactory cf = (IContributionFactory) context
- .get(IContributionFactory.class.getName());
- EHandlerService hs = (EHandlerService) context.get(EHandlerService.class.getName());
- List<MHandler> handlers = container.getHandlers();
- for (MHandler handler : handlers) {
- MCommand command = handler.getCommand();
- if (command == null)
- continue;
- String commandId = command.getElementId();
- if (handler.getObject() == null) {
- handler.setObject(cf.create(handler.getContributionURI(), context));
- }
- hs.activateHandler(commandId, handler.getObject());
- }
- }
- }
- if (me instanceof MElementContainer<?>) {
- List<MUIElement> children = ((MElementContainer) me).getChildren();
- Iterator<MUIElement> i = children.iterator();
- while (i.hasNext()) {
- MUIElement e = i.next();
- processHierarchy(e);
- }
- }
- }
-
/**
* Create the context chain. It both creates the chain for the current model, and adds eAdapters
* so it can add new contexts when new model items are added.
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java
new file mode 100644
index 0000000..c2859c4
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Sopot Cela - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.e4.ui.internal.workbench.addons;
+
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import org.eclipse.e4.core.commands.EHandlerService;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.contributions.IContributionFactory;
+import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.commands.MCommand;
+import org.eclipse.e4.ui.model.application.commands.MHandler;
+import org.eclipse.e4.ui.model.application.commands.MHandlerContainer;
+import org.eclipse.e4.ui.model.application.ui.MContext;
+import org.eclipse.e4.ui.workbench.UIEvents;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * Process the additions and removals of handlers on the model
+ */
+public class HandlerProcessingAddon {
+
+ private EventHandler eventHandler;
+ private EventHandler contextHandler;
+
+ @Inject
+ private IEventBroker eventBroker;
+
+ /**
+ * Registers the listeners
+ *
+ * @param application
+ * @param modelService
+ */
+ @PostConstruct
+ public void postConstruct(MApplication application, EModelService modelService) {
+ List<MHandlerContainer> findElements = modelService.findElements(application, null,
+ MHandlerContainer.class, null);
+ for (MHandlerContainer mHandlerContainer : findElements) {
+ for (MHandler mHandler : mHandlerContainer.getHandlers()) {
+ MContext mContext = (MContext) mHandlerContainer;
+ IEclipseContext context = mContext.getContext();
+ if (context != null) {
+ processActiveHandler(mHandler, context);
+ }
+ }
+ }
+
+ registerModelListeners();
+ }
+
+ private void registerModelListeners() {
+ eventHandler = new EventHandler() {
+ public void handleEvent(Event event) {
+ if ((event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MHandlerContainer)) {
+ MHandlerContainer handlerContainer = (MHandlerContainer) event
+ .getProperty(UIEvents.EventTags.ELEMENT);
+ if (UIEvents.EventTypes.ADD.equals(event.getProperty(UIEvents.EventTags.TYPE))) {
+ if (event.getProperty(UIEvents.EventTags.NEW_VALUE) instanceof MHandler) {
+ MHandler handler = (MHandler) event
+ .getProperty(UIEvents.EventTags.NEW_VALUE);
+ MContext mContext = (MContext) handlerContainer;
+ IEclipseContext context = mContext.getContext();
+ if (context != null) {
+ processActiveHandler(handler, context);
+ }
+ }
+ } else if (UIEvents.EventTypes.REMOVE.equals(event
+ .getProperty(UIEvents.EventTags.TYPE))) {
+ if (event.getProperty(UIEvents.EventTags.OLD_VALUE) instanceof MHandler) {
+ MHandler handler = (MHandler) event
+ .getProperty(UIEvents.EventTags.OLD_VALUE);
+ MContext mContext = (MContext) handlerContainer;
+ IEclipseContext context = mContext.getContext();
+ if (context != null) {
+ MCommand command = handler.getCommand();
+ if (command != null) {
+ String commandId = command.getElementId();
+ EHandlerService handlerService = (EHandlerService) context
+ .get(EHandlerService.class.getName());
+ handlerService
+ .deactivateHandler(commandId, handler.getObject());
+ }
+ }
+ }
+
+ }
+
+ }
+
+ }
+ };
+
+ contextHandler = new EventHandler() {
+
+ public void handleEvent(Event event) {
+ Object origin = event.getProperty(UIEvents.EventTags.ELEMENT);
+ Object context = event.getProperty(UIEvents.EventTags.NEW_VALUE);
+ if ((origin instanceof MHandlerContainer)
+ && (UIEvents.EventTypes.SET.equals(event
+ .getProperty(UIEvents.EventTags.TYPE)) && context instanceof IEclipseContext)) {
+ MHandlerContainer handlerContainer = (MHandlerContainer) origin;
+ IEclipseContext castedContext = (IEclipseContext) context;
+ for (MHandler mHandler : handlerContainer.getHandlers()) {
+ processActiveHandler(mHandler, castedContext);
+ }
+
+ }
+
+ }
+ };
+ eventBroker.subscribe(UIEvents.HandlerContainer.TOPIC_HANDLERS, eventHandler);
+ eventBroker.subscribe(UIEvents.Context.TOPIC_CONTEXT, contextHandler);
+ }
+
+ /**
+ * Clean up
+ */
+ @PreDestroy
+ public void preDestroy() {
+ unregisterModelListeners();
+ }
+
+ /**
+ * Unregisters the listeners
+ */
+ private void unregisterModelListeners() {
+ eventBroker.unsubscribe(eventHandler);
+ eventBroker.unsubscribe(contextHandler);
+ }
+
+ /**
+ * @param handler
+ * @param context
+ */
+ private void processActiveHandler(MHandler handler, IEclipseContext context) {
+ MCommand command = handler.getCommand();
+ if (command != null) {
+ String commandId = command.getElementId();
+ if (handler.getObject() == null) {
+ IContributionFactory contributionFactory = (IContributionFactory) context
+ .get(IContributionFactory.class.getName());
+ handler.setObject(contributionFactory.create(handler.getContributionURI(), context));
+ }
+ EHandlerService handlerService = (EHandlerService) context.get(EHandlerService.class
+ .getName());
+ handlerService.activateHandler(commandId, handler.getObject());
+ }
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index 1a1a640..d1ff698 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
@@ -1232,7 +1232,6 @@ public final class Workbench extends EventManager implements IWorkbench {
if (windowContext == null) {
windowContext = E4Workbench.initializeContext(
e4Context, window);
- E4Workbench.processHierarchy(window);
}
WorkbenchWindow result = (WorkbenchWindow) windowContext.get(IWorkbenchWindow.class
.getName());
diff --git a/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi b/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
index 18621e3..5846851 100644
--- a/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
+++ b/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
@@ -31,4 +31,5 @@
<addons xmi:id="_XwQYkE2EEd-DfN2vYY4Lew" elementId="Cleanup Addon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.cleanupaddon.CleanupAddon"/>
<addons xmi:id="_bqcWME2EEd-DfN2vYY4Lew" elementId="DnD Addon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon"/>
<addons xmi:id="_7GC6sGp-Ed-QyNZjH9g15Q" elementId="MinMax Addon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon"/>
+ <addons xmi:id="_00yosOXqEeGugqEu_OWUGQ" elementId="org.eclipse.ui.workbench.addon.0" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
</application:Application>
diff --git a/examples/org.eclipse.e4.demo.contacts/Application.e4xmi b/examples/org.eclipse.e4.demo.contacts/Application.e4xmi
index 0f9bf9d..7f703f5 100644
--- a/examples/org.eclipse.e4.demo.contacts/Application.e4xmi
+++ b/examples/org.eclipse.e4.demo.contacts/Application.e4xmi
@@ -65,4 +65,5 @@
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXj" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXk" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXl" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
+ <addons xmi:id="_Cl0IkOXrEeGugqEu_OWUGQ" elementId="org.eclipse.e4.demo.contacts.addon.0" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
</application:Application>
diff --git a/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi b/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi
index 64c0070..5a21410 100644
--- a/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi
+++ b/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi
@@ -18,7 +18,7 @@
</children>
</children>
<children xsi:type="basic:PartSashContainer" xmi:id="_hKibQEleEd-TVO58rzJVgA" elementId="_hKibQEleEd-TVO58rzJVgA" containerData="70">
- <children xsi:type="basic:Part" xmi:id="_krbvIEleEd-TVO58rzJVgA" elementId="_krbvIEleEd-TVO58rzJVgA" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.Preview" containerData="70" label="Preview"/>
+ <children xsi:type="basic:Part" xmi:id="_krbvIEleEd-TVO58rzJVgA" elementId="_krbvIEleEd-TVO58rzJVgA" containerData="70" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.Preview" label="Preview"/>
<children xsi:type="basic:PartStack" xmi:id="_sRLYgEleEd-TVO58rzJVgA" elementId="_sRLYgEleEd-TVO58rzJVgA" containerData="30">
<children xsi:type="basic:Part" xmi:id="_tuj8gEleEd-TVO58rzJVgA" elementId="ThumbnailsView" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.Thumbnails" label="Thumbnails"/>
<children xsi:type="basic:Part" xmi:id="_xPeegEleEd-TVO58rzJVgA" elementId="ExifView" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.ExifTable" label="Exif"/>
@@ -51,8 +51,8 @@
<handlers xmi:id="_RrwmEEjPEd-XR9_8rlW1bQ" elementId="_RrwmEEjPEd-XR9_8rlW1bQ" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.ImageDialogHandler" command="_6B0q4EjPEd-XR9_8rlW1bQ"/>
<handlers xmi:id="_bH-CkUljEd-YPslvXqnLdg" elementId="_bH-CkUljEd-YPslvXqnLdg" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.AddNoteHandler" command="_9w2hYEjPEd-XR9_8rlW1bQ"/>
<bindingTables xmi:id="_ofif4EjPEd-XR9_8rlW1bQ" elementId="_ofif4EjPEd-XR9_8rlW1bQ" bindingContext="_Y_0CgEjPEd-XR9_8rlW1bQ">
- <bindings xmi:id="_rCRiYEjPEd-XR9_8rlW1bQ" keySequence="CTRL+Q" elementId="_rCRiYEjPEd-XR9_8rlW1bQ" command="_vBr-QEjPEd-XR9_8rlW1bQ"/>
- <bindings xmi:id="_tDFjkEjPEd-XR9_8rlW1bQ" keySequence="CTRL+N" elementId="_tDFjkEjPEd-XR9_8rlW1bQ" command="_zQSFoEjPEd-XR9_8rlW1bQ"/>
+ <bindings xmi:id="_rCRiYEjPEd-XR9_8rlW1bQ" elementId="_rCRiYEjPEd-XR9_8rlW1bQ" keySequence="CTRL+Q" command="_vBr-QEjPEd-XR9_8rlW1bQ"/>
+ <bindings xmi:id="_tDFjkEjPEd-XR9_8rlW1bQ" elementId="_tDFjkEjPEd-XR9_8rlW1bQ" keySequence="CTRL+N" command="_zQSFoEjPEd-XR9_8rlW1bQ"/>
</bindingTables>
<rootContext xmi:id="_Y_0CgEjPEd-XR9_8rlW1bQ" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows" description="">
<children xmi:id="_gCmv0EjPEd-XR9_8rlW1bQ" elementId="org.eclipse.ui.contexts.window" name="In Windows" description=""/>
@@ -71,4 +71,5 @@
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXj" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXk" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXl" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
+ <addons xmi:id="__YcNoOXqEeGugqEu_OWUGQ" elementId="org.eclipse.e4.demo.e4photo.addon.0" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
</application:Application>
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java
index 4ee42fb..2de83c8 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java
@@ -18,7 +18,6 @@ import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
-import org.eclipse.e4.ui.internal.workbench.E4Workbench;
import org.eclipse.e4.ui.internal.workbench.UIEventPublisher;
import org.eclipse.e4.ui.internal.workbench.swt.E4Application;
import org.eclipse.e4.ui.model.application.MApplication;
@@ -56,7 +55,6 @@ public class Bug320857Test extends TestCase {
MApplication application) {
applicationContext.set(MApplication.class.getName(), application);
application.setContext(applicationContext);
- E4Workbench.processHierarchy(application);
((Notifier) application).eAdapters().add(
new UIEventPublisher(applicationContext));
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
index 1089b7a..3ea6f3d 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
@@ -19,7 +19,6 @@ import java.util.List;
import org.eclipse.core.runtime.AssertionFailedException;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.di.Focus;
-import org.eclipse.e4.ui.internal.workbench.E4Workbench;
import org.eclipse.e4.ui.internal.workbench.UIEventPublisher;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
@@ -10155,7 +10154,6 @@ public class EPartServiceTest extends UITest {
}
private void initialize() {
- E4Workbench.processHierarchy(application);
((Notifier) application).eAdapters().add(
new UIEventPublisher(applicationContext));
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
index 5dfa8b3..19c5449 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
@@ -22,7 +22,6 @@ import org.eclipse.e4.core.contexts.RunAndTrack;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UISynchronize;
-import org.eclipse.e4.ui.internal.workbench.E4Workbench;
import org.eclipse.e4.ui.internal.workbench.UIEventPublisher;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
@@ -1073,7 +1072,6 @@ public class ESelectionServiceTest extends UITest {
}
});
application.setContext(applicationContext);
- E4Workbench.processHierarchy(application);
((Notifier) application).eAdapters().add(
new UIEventPublisher(applicationContext));
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
index 848d326..0a91222 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
@@ -298,8 +298,6 @@ public abstract class HeadlessApplicationTest extends
E4Workbench.initializeContext(appContext, window);
}
- E4Workbench.processHierarchy(application);
-
processPartContributions(application.getContext(), resource);
renderer = createPresentationEngine(getEngineURI());
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java
index b71e9d3..a2cb4ab 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java
@@ -19,6 +19,7 @@ import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.bindings.BindingServiceAddon;
import org.eclipse.e4.ui.internal.workbench.E4Workbench;
+import org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon;
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
import org.eclipse.e4.ui.internal.workbench.swt.E4Application;
import org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine;
@@ -736,6 +737,9 @@ public class MMenuItemTest extends TestCase {
application.getChildren().add(window);
application.setContext(appContext);
appContext.set(MApplication.class.getName(), application);
+ // The handler processing addon cannot run until the context
+ // contains the MApplication
+ ContextInjectionFactory.make(HandlerProcessingAddon.class, appContext);
wb = new E4Workbench(window, appContext);
wb.createAndRunUI(window);