diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowsDefenderConfigurator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowsDefenderConfigurator.java index 10d87544798..135aac4a201 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowsDefenderConfigurator.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowsDefenderConfigurator.java @@ -240,7 +240,11 @@ public static IEclipsePreferences getPreference(IScopeContext instance) { public static void savePreference(IScopeContext scope, String key, String value) throws CoreException { IEclipsePreferences preferences = getPreference(scope); - preferences.put(key, value); + if (value != null) { + preferences.put(key, value); + } else { + preferences.remove(key); + } try { preferences.flush(); } catch (BackingStoreException e) { diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java index 58a290a16b2..aa856feccb7 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java @@ -237,7 +237,8 @@ public boolean performOk() { windowsDefenderIgnore.forEach((scope, button) -> { try { - String skip = Boolean.toString(button.getSelection()); + // If disabled remove the node to allow higher-level scopes to be considered + String skip = button.getSelection() ? Boolean.TRUE.toString() : null; WindowsDefenderConfigurator.savePreference(scope, PREFERENCE_STARTUP_CHECK_SKIP, skip); } catch (CoreException e) { WorkbenchPlugin.log("Failed to save Windows Defender exclusion check preferences", e); //$NON-NLS-1$