|
Re: CSS Themes [message #1236531 is a reply to message #1234974] |
Mon, 27 January 2014 12:47 |
Camille Letavernier Messages: 952 Registered: February 2011 |
Senior Member |
|
|
Hi Erik,
We have an example in the CSS properties view ({oep}.infra.gmfdiag.css.properties). We use the following "PreferenceObservableValue", which implements the JFace IObservableValue for an IPreferenceStore:
org.eclipse.papyrus.views.properties.observable.PreferencesObservableValue (From {oep}.views.properties)
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, storeName);
IObservableValue preferenceObservable = new PreferencesObservableValue(propertyPath, store);
preferenceObservable.addChangeListener(listener);
Object currentValue = preferenceObservable.getValue()
The Observable returns a String value (Which is the ID of the CSS Theme). You can retrieve the Theme object with the following code:
String themeID = (String)preferenceObservable.getValue();
Theme theme = ThemeManager.instance.getTheme(themeID);
if (theme == ThemeManager.EmptyTheme.instance){
//Do something
}
Regards,
Camille
Camille Letavernier
|
|
|
Powered by
FUDForum. Page generated in 0.03443 seconds