Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse, plugin preference loading issue
Eclipse, plugin preference loading issue [message #767299] Sat, 17 December 2011 15:45 Go to next message
Eclipse UserFriend
Hi,

I have trouble getting preference loaded on to eclipse. I am not able to
load the value for the preference without going to the preference page
first.
I start eclipse, use my plugin, i see that the feature is not enabled.
I start eclipse, go to preference page and the use my plugin, all works
fine.

I am trying to access the value for enable from preference store using
the below code

final IPreferenceStore preferences = new ScopedPreferenceStore(new
InstanceScope(), <my plugin id>);
this.enabled = preferences.getBoolean(<templateName>_ENABLE_TEMPLATE"));

this call goes to method
public boolean getBoolean(String name) {
String value = internalGet(name);
return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value)
.booleanValue();
}
internalGet(name) -- returns null..as a result this.enabled is set to false.

in my code i check this variable and if it is false i display an error
message and don't proceed further.

I want to know how we can make sure that the preferences are
enabled/loaded as soon as they are invoked.

Thanks in advance!!
Re: Eclipse, plugin preference loading issue [message #768764 is a reply to message #767299] Tue, 20 December 2011 18:34 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2342
Registered: July 2009
Senior Member
On 12/17/2011 10:45 AM, Krishnaveni wrote:
> Hi,
>
> I have trouble getting preference loaded on to eclipse. I am not able to
> load the value for the preference without going to the preference page
> first.

This is what the org.eclipse.core.runtime.preferences extension point
and its "initializer" element are for.

http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_core_runtime_preferences.html#e.initializer

---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:plugin downloads timeout
Next Topic:Windows 7 Eclipse dev environment for Linux targets
Goto Forum:
  


Current Time: Tue Dec 23 03:11:53 GMT 2014

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

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