From 76f9f43adfe0c50d071189ddd8df2782fa6f6ed8 Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Thu, 15 Feb 2024 09:07:41 +0100 Subject: [PATCH] Suppress Windows Defender Autofix startup check in test-runtimes part 2 Consider also applications specified on the CLI via the '-application' argument when determining the actually running application. Otherwise always the application defined in the product definition is assumed. Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/1683 --- .../ui/internal/WindowsDefenderConfigurator.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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 03d59740284..c62ea70bbef 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 @@ -108,14 +108,21 @@ public void handleEvent(Event event) { private static boolean runStartupCheck() { if (Platform.isRunning() && Platform.OS.isWindows() && !Platform.inDevelopmentMode()) { - IProduct product = Platform.getProduct(); - if (product != null) { - return "org.eclipse.ui.ide.workbench".equals(product.getApplication()); //$NON-NLS-1$ - } + return "org.eclipse.ui.ide.workbench".equals(getRunningApplicationId()); //$NON-NLS-1$ } return false; } + private static String getRunningApplicationId() { + @SuppressWarnings("restriction") + String appId = System.getProperty(org.eclipse.core.internal.runtime.InternalPlatform.PROP_APPLICATION); + if (appId != null) { + return appId; + } + IProduct product = Platform.getProduct(); + return product != null ? product.getApplication() : null; + } + /** * Opens the dialog to run the exclusion, regardless of any preference. *