From 7be24be5b3156b9a1f479d7e3d974987273ca0db Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Wed, 16 Oct 2024 23:03:33 +0200 Subject: [PATCH] Handle not set workspace target in TargetDefinitionActivationCodeMining --- .../TargetDefinitionActivationCodeMining.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/codemining/TargetDefinitionActivationCodeMining.java b/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/codemining/TargetDefinitionActivationCodeMining.java index b3330d7af5..f5b08b7f6d 100644 --- a/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/codemining/TargetDefinitionActivationCodeMining.java +++ b/ui/org.eclipse.pde.genericeditor.extension/src/org/eclipse/pde/internal/genericeditor/target/extension/codemining/TargetDefinitionActivationCodeMining.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2018, 2019 vogella GmbH and others + * Copyright (c) 2018, 2024 vogella GmbH and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -67,11 +67,10 @@ protected CompletableFuture doResolve(ITextViewer viewer, IProgressMonitor } boolean isCurrent = false; try { - ITargetPlatformService service = acquireTargetPlatformService(); - String memento = service.getWorkspaceTargetHandle().getMemento(); - ITargetHandle targetHandle = getTargetHandle(); - String targetMemento = targetHandle.getMemento(); - isCurrent = Objects.equals(memento, targetMemento); + ITargetHandle workspaceTarget = acquireTargetPlatformService().getWorkspaceTargetHandle(); + if (workspaceTarget != null) { + isCurrent = Objects.equals(workspaceTarget.getMemento(), getTargetHandle().getMemento()); + } } catch (CoreException e) { // Caught with default message shown }