Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to readout value from PreferenceStore
How to readout value from PreferenceStore [message #459271] Wed, 29 November 2006 15:13 Go to next message
Eclipse UserFriend
Originally posted by: florianwendland.freenet.de

Hello all,

what's the common way to get the values of my workspace preference store?
I tried it like this:

IPreferenceStore store = Activator.getDefault().getPreferenceStore();
String string = store.getString("P_PATH");
System.out.println(string);

But this meant to be not correct, because I allways get an empty string.
May I dind't understand the way how to use the preference store?

Thx
Florian



------------------------------------------------------------ ----------------
----
Ich verwende die kostenlose Version von SPAMfighter,
die bei mir bis jetzt 3482 Spammails entfernt hat.
F
Re: How to readout value from PreferenceStore [message #459275 is a reply to message #459271] Wed, 29 November 2006 15:58 Go to previous messageGo to next message
Eclipse UserFriend
No problems with that code, that I can see, so it must be that you have never *set* a value for the
key "P_PATH" (btw, Eclipse convention seems to be to use fully-qualified keys, like this
"de.spamfighter.wendland.P_PATH").

To set a value, call like this:

<code>store.setDefault(key, def_value); </code>

and also probably (if you want a value that can be varied by the user) like this:

<code>store.setValue(key, new_value); </code>

HTH,
Paul
Re: How to readout value from PreferenceStore [message #459276 is a reply to message #459275] Wed, 29 November 2006 16:54 Go to previous message
Eclipse UserFriend
Originally posted by: florianwendland.freenet.de

I found the problem.
In fact, I tried to get like this

String string = store.getString("P_PATH");

but i had to do it like this.

String string = store.getString(PreferenceConstants.P_PATH);

Thanks :)

------------------------------------------------------------ ----------------
----
Ich verwende die kostenlose Version von SPAMfighter,
die bei mir bis jetzt 3482 Spammails entfernt hat.
F
Previous Topic:RCP + JWS can't find classes from external bundles
Next Topic:How to open Lotus Notes Links within the Eclipse API
Goto Forum:
  


Current Time: Wed Mar 19 16:45:18 EDT 2025

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

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

Back to the top