Eclipse RCP 2022-06
After exporting the product, I found that if the current theme of win10 is dark, RCP also uses the dark theme
In other words, eclipse will now decide which theme to choose at startup based on the theme of the operating system
How do disable this feature?? I don't want to use it until the dark theme is complete
Updated as recommended by greg-449
Possibly set system property org.eclipse.swt.internal.win32.useDarkModeExplorerTheme to false. Look at the source of Display to see all the properties that can be set on Windows
This is my exported product profile
-startup
plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.500.v20220509-0833
-clearPersistedState
--launcher.appendVmargs
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=17
-Dorg.eclipse.swt.internal.win32.useDarkModeExplorerTheme=false
-Xms1024m
-Xmx2048m
-XX:+UseG1GC
--add-modules=ALL-SYSTEM
Still unsolvable
Reply to howlger
The exported product is the most basic product
This is a particularly simple test for the new version of RCP export products
Other settings are based on platform feature
plugin.xml
<plugin>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="org.eclipse.ui.ide.workbench"
name="BitFan">
<property
name="appName"
value="BitFan">
</property>
<property
name="windowImages"
value="logo16.png,logo32.png,logo48.png,logo64.png,logo128.png,logo256.png">
</property>
<property
name="startupForegroundColor"
value="FFFFFF">
</property>
<property
name="startupMessageRect"
value="30,272,445,20">
</property>
<property
name="startupProgressRect"
value="28,295,445,15">
</property>
<property
name="applicationCSSResources"
value="platform:/plugin/org.eclipse.ui.themes/images/">
</property>
<property
name="applicationXMI"
value="org.eclipse.platform/LegacyIDE.e4xmi">
</property>
<property
name="cssTheme"
value="org.eclipse.e4.ui.css.theme.e4_default">
</property>
<property
name="buildIdLocation"
value="0,220">
</property>
<property
name="buildIdSize"
value="293,40">
</property>
<property
name="preferenceCustomization"
value="plugin_customization.ini">
</property>
</product>
</extension>
</plugin>
Reply to howlger again
boolean hasDarkTheme = getThemes().stream().anyMatch(t -> t.getId().startsWith(E4_DARK_THEME_ID));
String themeToRestore = Display.isSystemDarkTheme() && hasDarkTheme ? E4_DARK_THEME_ID : alternateTheme;
if (themeToRestore != null && flag) {
setTheme(themeToRestore, false);
}
I tracked that "Display.isSystemDarkTheme()" is true, so the dark theme is set
Then I set -Dorg.eclipse.swt.internal.win32.useDarkModeExplorerTheme=false in the Run Configurations VM Arguments
clear run, still the dark theme
This parameter has no effect
It judges by reading the registry
public static boolean isSystemDarkTheme () {
boolean isDarkTheme = false;
/*
* The registry settings, and Dark Theme itself, is present since Win10 1809
*/
if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
int[] result = OS.readRegistryDwords(OS.HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme");
if (result!=null) {
isDarkTheme = (result[0] == 0);
}
}
return isDarkTheme;
}
I think this problem can only be solved by deleting the dark theme , But how to delete it? It seems that the "org.eclipse.ui.activities" extension point cannot disable themes
Maybe I can remove it through removeExtension, but this needs to be done before the workbench starts. At present, I only know that the splashHandlers extension point can be implemented. Should I do this?