Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Add/ modify preference page
Add/ modify preference page [message #1038998] Thu, 11 April 2013 11:50 Go to next message
Maximilian Girlich is currently offline Maximilian Girlich
Messages: 17
Registered: March 2013
Junior Member
Hey,

again probably a rather simple question... I want to add a preference page to my editor. What I did is

public class ExamplePreferencePage extends LanguageRootPreferencePage {
	@Override
	protected void createFieldEditors() {
		super.createFieldEditors();
		BooleanFieldEditor booleanFieldEditor = new BooleanFieldEditor("name", "label", getFieldEditorParent());
		booleanFieldEditor.setPreferenceStore(doGetPreferenceStore());
		addField(booleanFieldEditor);
	}
}


and I registered it in the EditorUiModule via

public Class<? extends org.eclipse.xtext.ui.editor.preferences.LanguageRootPreferencePage> bindLanguageRootPreferencePage() {
    return org.grammaticalframework.eclipse.ui.editor.preferences.GFLanguageRootPreferencePage.class;
}


But when I try to open that page I get the following error: "The currently displayed page contains invalid values."

What am I doing wrong? And how can I modify/ extend an existing preference page (e.g. "Compiler")?

Cheers,
Maximilian
Re: Add/ modify preference page [message #1039081 is a reply to message #1038998] Thu, 11 April 2013 14:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6126
Registered: July 2009
Senior Member
HI,

I could not reproduce that with your sample code and Xtext 2.4.0
Re: Add/ modify preference page [message #1039412 is a reply to message #1039081] Fri, 12 April 2013 02:17 Go to previous messageGo to next message
Maximilian Girlich is currently offline Maximilian Girlich
Messages: 17
Registered: March 2013
Junior Member
I found the mistake... When registering the page in Extensions I accidently deleted the extensionFactory in front of the class...
Re: Add/ modify preference page [message #1047446 is a reply to message #1039412] Tue, 23 April 2013 04:01 Go to previous message
Maximilian Girlich is currently offline Maximilian Girlich
Messages: 17
Registered: March 2013
Junior Member
Now I want to access my preferences. So I tried it via the preferenceService

String pref = Platform.getPreferencesService().getString(INIEditorActivator.getInstance().getBundle().getSymbolicName(), PREF, "", null);


and also via

String pref = preferenceStoreAccess.getPreferenceStore().getString(PREF);


The preference is properly saved in the same file as the other preferences of the editor. Why doesn't my approach work? And especially how can I get it working?

EDIT:
Of course I just solved it after posting... with the filename it makes things easy of course...

[Updated on: Tue, 23 April 2013 04:06]

Report message to a moderator

Previous Topic:Xtext 2.3.1 Debugging does not work after Project->Clean
Next Topic:How to refresh a model cache when an external resource changes?
Goto Forum:
  


Current Time: Thu Jul 24 00:37:52 EDT 2014

Powered by FUDForum. Page generated in 0.02053 seconds