Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Accessing language preferences
Accessing language preferences [message #1062984] Tue, 11 June 2013 11:26 Go to next message
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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 messageGo to next message
Eclipse UserFriend
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 08:42 Go to previous messageGo to next message
Eclipse UserFriend
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 13:01 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 23:09:38 EDT 2025

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

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

Back to the top