Skip to main content


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 15:26 Go to next message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
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 16:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi

did you try to inject IPreferenceStoreAccess instead?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Accessing language preferences [message #1063028 is a reply to message #1062999] Tue, 11 June 2013 20:21 Go to previous messageGo to next message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
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 20:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
what was the symptoms with IPreferenceStoreAccess?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Accessing language preferences [message #1063036 is a reply to message #1063030] Tue, 11 June 2013 20:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
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

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Accessing language preferences [message #1064117 is a reply to message #1062984] Mon, 17 June 2013 17:36 Go to previous messageGo to next message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
Registered: December 2011
Member
I simply couldn't get the preference values from the IPreferenceStoreAccess.
Re: Accessing language preferences [message #1321693 is a reply to message #1064117] Tue, 29 April 2014 12:42 Go to previous messageGo to next message
Michael Bischoff is currently offline Michael BischoffFriend
Messages: 19
Registered: August 2012
Junior Member
Hello,
I have the same problem. I created an additional preferences page for an xtext DSL and I am able to configure values in the UI.
I want to access that configuration while running the xtext-maven-plugin. I tried the Platform approach and can confirm it's not available for Standalone setup (also not if adding the required dependencies).
The IPreferenceStoreAccess sits in the UI project, but I need the access from the generator project.

Is the proposed solution to add the UI project as a dependency?

Best regards,
Michael

Re: Accessing language preferences [message #1322044 is a reply to message #1321693] Tue, 29 April 2014 17:01 Go to previous message
Michael Bischoff is currently offline Michael BischoffFriend
Messages: 19
Registered: August 2012
Junior Member
Hi,
I'm no longer convinced that the question was a good one.
In standalone setups, the data shouldn't even be pulled from some Eclipse configuration storage, but rather depend on the environment.
For invocations via xtext-maven-plugin, for example, the <configuration> section of the pom.xml should provide the values. Not sure if such functionality is already supported.
For now, I'll go and do an easy fallback, and provide configuration from environment or system properties.

Best regards,
Michael
Previous Topic:how to enforce resource generation when having deep cross-reference over multiple resources
Next Topic:Reference of Making a language and eclipse plugin with Xtext
Goto Forum:
  


Current Time: Sat Apr 20 00:35:01 GMT 2024

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

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

Back to the top