On startup of eclipse product, I just want to get the eclipse UI preference value of Theme.
I tried with the below snippet, but it is returning an empty string value
Platform.getPreferencesService().getString("org.eclipse.ui.preferencePages.Views", "Theme", "",
null);
It would be great, If I am get this answer. Thanks in Advance
CodePudding user response:
You get this from the IThemeEngine
:
IThemeEngine engine = PlatformUI.getWorkbench().getService(IThemeEngine.class);
if (engine != null) {
ITheme activeTheme = engine.getActiveTheme();
if (activeTheme != null) {
// The theme id
String themeId = activeTheme.getId();
// The display label
String label = activeTheme.getLabel();
...
}
}
IThemeEngine
can also be injected in an e4 part or obtained from the IEclipseContext