Bug 528877 - NPE when using the windows Spies menu with version 0.18

Change-Id: I3c21eb9f4646186e4f6ff927e69beb31c83e7bdf
Signed-off-by: Olivier Prouvost <olivier.prouvost@opcoach.com>
diff --git a/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java b/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java
index d526d4f..5cb402f 100644
--- a/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java
+++ b/bundles/org.eclipse.e4.tools.spy/src/org/eclipse/e4/tools/spy/SpyProcessor.java
@@ -9,12 +9,15 @@
  *     Olivier Prouvost <olivier.prouvost@opcoach.com> - initial API and implementation
  *     Olivier Prouvost <olivier.prouvost@opcoach.com> - Bug 428903 - Having a common 'debug' window for all spies
  *     Olivier Prouvost <olivier.prouvost@opcoach.com> - Bug 482250 - Add a menu 'E4 Spies' to access to the spies
+ *     Olivier Prouvost <olivier.prouvost@opcoach.com> - Bug 528877 - NPE when using the windows Spies menu with version 0.18
  *     Marco Descher <marco@descher.at> - Bug 519136
  *******************************************************************************/
 package org.eclipse.e4.tools.spy;
 
 import java.util.List;
 
+import javax.inject.Inject;
+
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionRegistry;
 import org.eclipse.core.runtime.InvalidRegistryObjectException;
@@ -51,9 +54,15 @@
 	EModelService modelService;
 	Logger log;
 
+	@Inject
+	public SpyProcessor(MApplication application, EModelService modelService, Logger log) {
+		this.application = application;
+		this.modelService = modelService;
+		this.log = log;
+	}
+
 	@Execute
-	public void process(IExtensionRegistry extRegistry, MApplication application, EModelService modelService,
-			Logger log) {
+	public void process(IExtensionRegistry extRegistry) {
 		// This processor will read all spy extensions and automatically create
 		// the command, handler and binding
 		// to open this spy in the dedicated spy window.
@@ -61,9 +70,7 @@
 		// First of all, it creates the spyCommand having one parameter (Id of
 		// the part to display) and default handler for this command.
 
-		this.application = application;
-		this.modelService = modelService;
-		this.log = log;
+
 
 		MCommand command = getOrCreateSpyCommand();
 
@@ -147,13 +154,13 @@
 	}
 
 	/**
-	 * Helper method to get or create the binding table for all spies (where
-	 * spies will add their key binding). Bind this table with the
+	 * Helper method to get or create the binding table for all spies (where spies
+	 * will add their key binding). Bind this table with the
 	 * org.eclipse.ui.contexts.dialogAndWindow binding context which should be
 	 * present (create it if not)
 	 *
-	 * This method will probably move to the common spy plugin providing common
-	 * spy stuff (see bug #428903)
+	 * This method will probably move to the common spy plugin providing common spy
+	 * stuff (see bug #428903)
 	 *
 	 * @param keySequence
 	 * @param cmd
@@ -264,7 +271,6 @@
 		application.getDescriptors().add(descriptor);
 	}
 
-
 	@AboutToShow
 	public void fillE4SpyMenu(List<MMenuElement> items) {