Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to store global preferences at project level(How to store global preferences at project level)
icon5.gif  How to store global preferences at project level [message #1728140] Thu, 31 March 2016 10:50 Go to next message
Umesh Thakare is currently offline Umesh ThakareFriend
Messages: 12
Registered: February 2016
Junior Member
Hi

I am doing POC on how global level preferences can be store at Project level as well.

I have created the sample application in which I have created the MyPreferencePage page and used the "org.eclipse.ui.preferencePages" extension to add this page in eclipse preferences.
I am also able to save the page data and retrieve it using the code "setPreferenceStore(Activator.getDefault().getPreferenceStore());".
Now I want to create new page under projects properties level and should able to store page values at project level.
Below is the code for MyPreferencePage and preferencePages extension.


<extension
point="org.eclipse.ui.preferencePages">
<page
class="com.vogella.preference.MyPreferencePage"
id="com.vogella.preference.page1"
name="MyPreferencePage">
</page>
</extension>




public class MyPreferencePage extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {

public MyPreferencePage() {
super(GRID);

}

@Override
public void createFieldEditors() {
addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
"&Directory preference:", getFieldEditorParent()));

addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN,
"&An example of a boolean preference", getFieldEditorParent()));

addField(new RadioGroupFieldEditor(PreferenceConstants.P_CHOICE,
"An example of a multiple-choice preference", 1,
new String[][] { { "&Choice 1", "choice1" },
{ "C&hoice 2", "choice2" } }, getFieldEditorParent()));

addField(new StringFieldEditor(PreferenceConstants.P_STRING,
"A &text preference:", getFieldEditorParent()));

addField(new StringFieldEditor(PreferenceConstants.P_STRING,
"A &text preference:", getFieldEditorParent()));

}

@Override
public void init(IWorkbench workbench) {
setPreferenceStore(Activator.getDefault().getPreferenceStore());
setDescription("A demonstration of a preference page implementation");
}
Re: How to store global preferences at project level [message #1728546 is a reply to message #1728140] Tue, 05 April 2016 11:07 Go to previous messageGo to next message
Umesh Thakare is currently offline Umesh ThakareFriend
Messages: 12
Registered: February 2016
Junior Member
Is any one has done project level preferences store. Please reply it's urgent for my project
Re: How to store global preferences at project level [message #1729695 is a reply to message #1728546] Mon, 18 April 2016 08:02 Go to previous message
Umesh Thakare is currently offline Umesh ThakareFriend
Messages: 12
Registered: February 2016
Junior Member
Please reply if anyone has implemented the project level preferences store.
Previous Topic:help me!
Next Topic:ClassNotFoundException: org.jdom2.JDOMException
Goto Forum:
  


Current Time: Fri Sep 21 03:39:30 GMT 2018

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

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

Back to the top