Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » CSS Themes(Get current theme and listen to theme changes)
CSS Themes [message #1234974] Thu, 23 January 2014 09:07 Go to next message
Erik Schondorff is currently offline Erik SchondorffFriend
Messages: 25
Registered: October 2013
Junior Member
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 12:47 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 932
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
Previous Topic:Parametric Diagram in Papyrus 0.10
Next Topic:Papyrus in SpringSource Tool Suite Not Working
Goto Forum:
  


Current Time: Thu Nov 26 10:36:20 GMT 2020

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

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

Back to the top