From cebccc2848b5e2c57ef07ea452d4c902768cc1b5 Mon Sep 17 00:00:00 2001 From: Olivier Prouvost Date: Sun, 17 Dec 2017 23:15:11 +0100 Subject: Bug 528877 - NPE when using the windows Spies menu with version 0.18 Change-Id: I3c21eb9f4646186e4f6ff927e69beb31c83e7bdf Signed-off-by: Olivier Prouvost --- .../src/org/eclipse/e4/tools/spy/SpyProcessor.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) 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 d526d4f2..5cb402f5 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 - initial API and implementation * Olivier Prouvost - Bug 428903 - Having a common 'debug' window for all spies * Olivier Prouvost - Bug 482250 - Add a menu 'E4 Spies' to access to the spies + * Olivier Prouvost - Bug 528877 - NPE when using the windows Spies menu with version 0.18 * Marco Descher - 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 @@ public class SpyProcessor { 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 @@ public class SpyProcessor { // 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 @@ public class SpyProcessor { } /** - * 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 @@ public class SpyProcessor { application.getDescriptors().add(descriptor); } - @AboutToShow public void fillE4SpyMenu(List items) { -- cgit v1.2.3