Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Accessing language preferences
Accessing language preferences [message #1062984] Tue, 11 June 2013 11:26 Go to next message
Erick Fonseca is currently offline Erick Fonseca
Messages: 63
Registered: December 2011
Member
I set up my language preferences page in my UI project, and can access them inside the UI packages like this:

    IPreferenceStore store = DSLActivator.getInstance().getPreferenceStore();
    String data = store.getString("whatever");


Now, I want to access it from the main Xtext project (i.e., the one with the grammar, validator, etc.). However, my DSLActivator is inside an internal UI package. I could export it, but it seems it was not supposed to be. How else can I access preferences?
Re: Accessing language preferences [message #1062999 is a reply to message #1062984] Tue, 11 June 2013 12:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5840
Registered: July 2009
Senior Member
Hi

did you try to inject IPreferenceStoreAccess instead?
Re: Accessing language preferences [message #1063028 is a reply to message #1062999] Tue, 11 June 2013 16:21 Go to previous messageGo to next message
Erick Fonseca is currently offline Erick Fonseca
Messages: 63
Registered: December 2011
Member
I couldn't get it to work with IPreferenceStoreAccess, but I found a way with IPreferencesService:

    IPreferencesService prefs = Platform.getPreferencesService();
    String data = prefs.getString("my.dsl.ui", "whatever", "unknown", null);
Re: Accessing language preferences [message #1063030 is a reply to message #1063028] Tue, 11 June 2013 16:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5840
Registered: July 2009
Senior Member
what was the symptoms with IPreferenceStoreAccess?
Re: Accessing language preferences [message #1063036 is a reply to message #1063030] Tue, 11 June 2013 16:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 5840
Registered: July 2009
Senior Member
Btw i am dont know if it is a good idea to do it this way since standalone there is not platform pref service available
Re: Accessing language preferences [message #1064117 is a reply to message #1062984] Mon, 17 June 2013 13:36 Go to previous message
Erick Fonseca is currently offline Erick Fonseca
Messages: 63
Registered: December 2011
Member
I simply couldn't get the preference values from the IPreferenceStoreAccess.
Previous Topic:Refactoring with importedNamespace and qualified name
Next Topic:Call Java class(pure java code) in the Xtend Code
Goto Forum:
  


Current Time: Wed Apr 16 06:56:25 EDT 2014

Powered by FUDForum. Page generated in 0.01771 seconds