From 23bc36b24ddb70adeea5f796b78e3b5d7128dfbe Mon Sep 17 00:00:00 2001 From: Jordan Miller Date: Mon, 29 Jun 2026 11:41:41 -0400 Subject: [PATCH 1/2] fix - Highlighted filenames and links are hard to read in dark mode. (#294) --- .../META-INF/MANIFEST.MF | 3 ++- .../copilot/eclipse/ui/utils/UiUtils.java | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/com.microsoft.copilot.eclipse.ui/META-INF/MANIFEST.MF b/com.microsoft.copilot.eclipse.ui/META-INF/MANIFEST.MF index ca0e9872..52396980 100644 --- a/com.microsoft.copilot.eclipse.ui/META-INF/MANIFEST.MF +++ b/com.microsoft.copilot.eclipse.ui/META-INF/MANIFEST.MF @@ -24,7 +24,8 @@ Bundle-Activator: com.microsoft.copilot.eclipse.ui.CopilotUi Bundle-RequiredExecutionEnvironment: JavaSE-17 Automatic-Module-Name: com.microsoft.copilot.eclipse.ui Bundle-ActivationPolicy: lazy -Import-Package: org.osgi.framework;version="[1.10.0,2.0.0)" +Import-Package: org.eclipse.e4.ui.css.swt.theme, + org.osgi.framework;version="[1.10.0,2.0.0)" Require-Bundle: com.microsoft.copilot.eclipse.core;bundle-version="0.19.0", com.microsoft.copilot.eclipse.terminal.api;bundle-version="0.19.0", org.eclipse.ui.ide;bundle-version="3.22.0", diff --git a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java index 5d1ab2a9..242a9599 100644 --- a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java +++ b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java @@ -35,7 +35,7 @@ import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.services.IStylingEngine; import org.eclipse.e4.ui.workbench.modeling.EPartService; @@ -88,7 +88,6 @@ import org.eclipse.ui.part.IShowInTarget; import org.eclipse.ui.part.ShowInContext; import org.eclipse.ui.texteditor.ITextEditor; -import org.osgi.service.prefs.Preferences; import com.microsoft.copilot.eclipse.core.CopilotCore; import com.microsoft.copilot.eclipse.core.utils.PlatformUtils; @@ -505,10 +504,14 @@ public static void applyChatFont(Control control) { * @return true if dark theme is active, false otherwise */ public static boolean isDarkTheme() { - Preferences preferences = InstanceScope.INSTANCE.getNode("org.eclipse.e4.ui.css.swt.theme"); - String themeCssUri = preferences.get("themeid", ""); - if (themeCssUri.toLowerCase().contains("dark")) { - return true; + IThemeEngine engine = PlatformUI.getWorkbench().getService(IThemeEngine.class); + if (engine != null) { + String themeCssUri = engine.getActiveTheme().getId(); + if (themeCssUri.toLowerCase().contains("dark")) { + return true; + } + } else { + CopilotCore.LOGGER.info("Theme engine not available. Defaulting to light theme."); } return false; } From dc996956e14a4c07fc2b537e1d928f6ed42b5702 Mon Sep 17 00:00:00 2001 From: jomillerOpen Date: Fri, 3 Jul 2026 16:54:53 -0400 Subject: [PATCH 2/2] Fix null checks --- .../microsoft/copilot/eclipse/ui/utils/UiUtils.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java index 242a9599..70544de1 100644 --- a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java +++ b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/UiUtils.java @@ -35,6 +35,7 @@ import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; +import org.eclipse.e4.ui.css.swt.theme.ITheme; import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.services.IStylingEngine; @@ -506,12 +507,13 @@ public static void applyChatFont(Control control) { public static boolean isDarkTheme() { IThemeEngine engine = PlatformUI.getWorkbench().getService(IThemeEngine.class); if (engine != null) { - String themeCssUri = engine.getActiveTheme().getId(); - if (themeCssUri.toLowerCase().contains("dark")) { - return true; + ITheme activeTheme = engine.getActiveTheme(); + if (activeTheme != null) { + String themeCssUri = activeTheme.getId(); + if (themeCssUri != null && themeCssUri.toLowerCase().contains("dark")) { + return true; + } } - } else { - CopilotCore.LOGGER.info("Theme engine not available. Defaulting to light theme."); } return false; }