Skip to main content



      Home
Home » Modeling » Papyrus » CSS Themes(Get current theme and listen to theme changes)
CSS Themes [message #1234974] Thu, 23 January 2014 04:07 Go to next message
Eclipse UserFriend
Hello Community,

the subtitle show it up:

My aim is it to find out (from source code), which CSS Theme is the current selected one (Very important is just: "No theme" or NOT "No theme"). Second aim is to add a listener to CSSTheme-Change, if it is possible.

I tried out accessing the specific information from preferences, but without success. Have you an idea or it is possible?

Thanks in advice Smile

Best regards, Erik
Re: CSS Themes [message #1236531 is a reply to message #1234974] Mon, 27 January 2014 07:47 Go to previous message
Eclipse UserFriend
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
Previous Topic:Parametric Diagram in Papyrus 0.10
Next Topic:Papyrus in SpringSource Tool Suite Not Working
Goto Forum:
  


Current Time: Wed Jul 23 09:48:15 EDT 2025

Powered by FUDForum. Page generated in 0.22262 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top