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 }