Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » RCP Application deployment problem - PreferenceStore
RCP Application deployment problem - PreferenceStore [message #436439] Thu, 08 September 2005 09:11 Go to next message
Eclipse UserFriend
I'm developing an RCP based application. Saving and restoring to the preference store work fine when the product is started from within Eclipse 3.1.

After deployment (and standalone execution) I can set the same preferences, they are saved to the .prefs file with the correct value, but on the next startup these values are not used. Everthing is blank (or probably back to the default value).

Why isn't the preference store read from disk?

Any ideas on how to debug these deployment problems? Are there any traces that might e helpful?

Help appreciated.
Re: RCP Application deployment problem - PreferenceStore [message #436471 is a reply to message #436439] Thu, 08 September 2005 21:09 Go to previous messageGo to next message
Eclipse UserFriend
This is kind of weird.
How are you deploying your RCP app?
In which folder is your .prefs file stored?

Are you setting your configuration folder?


Oliver Wahl wrote:
> I'm developing an RCP based application. Saving and restoring to the preference store work fine when the product is started from within Eclipse 3.1.
>
> After deployment (and standalone execution) I can set the same preferences, they are saved to the .prefs file with the correct value, but on the next startup these values are not used. Everthing is blank (or probably back to the default value).
>
> Why isn't the preference store read from disk?
>
> Any ideas on how to debug these deployment problems? Are there any traces that might e helpful?
>
> Help appreciated.
Re: RCP Application deployment problem - PreferenceStore [message #436475 is a reply to message #436471] Fri, 09 September 2005 03:12 Go to previous messageGo to next message
Eclipse UserFriend
> This is kind of weird.
You're right on that one :-)

> How are you deploying your RCP app?
Using the new 'Export as product' eclipse feature.

> In which folder is your .prefs file stored?
$INSTALLDIR$\workspace\.metadata\.plugins\org.eclipse.core.r untime\.settings\factOrFiction.prefs

And yes, I can see the values in there:
<i> lastUsedOraclePreference=D\:\\Oracle\\OracleStandard_050906. txt
openDeckPathPreference=D\:\\Decks
scansPathPreference=D\:\\Scans</i>
are values I changed in a preferencepage.

> Are you setting your configuration folder?
No. I'm using the 'automatic' value. That is the installation directory.


Any help (maybe how to debug it) would be appreciated.

Oliver
Re: RCP Application deployment problem - PreferenceStore [message #436478 is a reply to message #436471] Fri, 09 September 2005 04:27 Go to previous messageGo to next message
Eclipse UserFriend
I'm trying to access the PreferenceStore on startup within the ApplicationWorkbenchAdvisor.initialize call.

The trace from the exported product shows that the read value is empty although it exists within the .prefs file (it was saved from the previous execution).

Here's the method. In the Eclipse runtime environment everything works just fine?!?

<i>public void initialize(IWorkbenchConfigurer configurer) {
super.initialize(configurer);
configurer.setSaveAndRestore(true);

IPreferenceStore prefs = factOrFiction.FactOrFictionPlugin.getDefault().getPreference Store();
String path = prefs.getString( PreferenceConstants.P_ORACLE);

System.out.println("Oracle:" + path);

CardPool.instance().load( path );
}</i>
Re: RCP Application deployment problem - PreferenceStore [message #436490 is a reply to message #436478] Fri, 09 September 2005 09:22 Go to previous messageGo to next message
Eclipse UserFriend
Try making a call to getStateLocation() in your pluin start() method. This
seems to do something to help the prefs be loaded. (Dont ask me why, I jut
know it works : ) ).

--Bill
Re: RCP Application deployment problem - PreferenceStore [message #436509 is a reply to message #436490] Fri, 09 September 2005 18:18 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Bill,

how on earth did you figure that out? Now the deployed application works like a charm. Preferences are read as expected.

Shouldn't this be a bug with Eclipse?

Oliver
Re: RCP Application deployment problem - PreferenceStore [message #436510 is a reply to message #436509] Fri, 09 September 2005 19:08 Go to previous messageGo to next message
Eclipse UserFriend
I think if you try Platform.getInstanceLocation() it should do it as
well. In any case it would be great if you could capture your problem
(and possibly attach a little sample reproducing the pb) to the platform
/ runtime component. Thank you.

Oliver Wahl wrote:
> Thanks Bill,
>
> how on earth did you figure that out? Now the deployed application works like a charm. Preferences are read as expected.
>
> Shouldn't this be a bug with Eclipse?
>
> Oliver
Re: RCP Application deployment problem - PreferenceStore [message #436512 is a reply to message #436510] Sat, 10 September 2005 11:58 Go to previous messageGo to next message
Eclipse UserFriend
OK, no problem. I can post a problem. But I havn't done something like that before. Where would I report/capture this?

Oliver
Re: RCP Application deployment problem - PreferenceStore [message #436515 is a reply to message #436512] Sat, 10 September 2005 13:40 Go to previous messageGo to next message
Eclipse UserFriend
Bugs are tracked with Bugzilla at http://bugs.eclipse.org -- you'll need to register an account iwth them to post a bug/feature request.
Re: RCP Application deployment problem - PreferenceStore [message #436525 is a reply to message #436515] Sun, 11 September 2005 11:24 Go to previous messageGo to next message
Eclipse UserFriend
Hi guys,

just checked the Eclipse bug database and found:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=86750

This is exactly my problem and they are already discussing possible patches to the core runtime.

Poblem seems to be be that RCP applications don't really set their workspace location and the default is not automatically picked up on startup. The corresponding code fails silently, so no feed back to this a available at runtime.

But the suggested workaround works fine. So I'll retest after a new Eclipse release.
Re: RCP Application deployment problem - PreferenceStore [message #439136 is a reply to message #436439] Wed, 02 November 2005 16:30 Go to previous messageGo to next message
Eclipse UserFriend
FWIW, I am developing an RCP app, and do not have a Plugin class, but do have a preference-page
(i.e., my RCP app extends org.eclipse.ui.preferencePages).

When I went to set up my pref-page, I had carefully read this thread (and several others), plus the
bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=86750, but just had to guess that the
following might work (in my subclass of FieldEditorPreferencePage):

public void init(final IWorkbench workbench) {
setPreferenceStore(PlatformUI.getPreferenceStore());
}

It works fine, ONLY in the workbench; after using the "Eclipse product export wizard" link on the
"Overview" page of the "MY_APP.product" file-editor, the app runs, I can set the preference on my
pref-page, the IPropertyChangeListener works, etc. -- but, as you experienced, the preferences are
not saved, in the sense that upon restart they have reverted to their initial default values.

I do find a "workspace" directory under the installed app-directory, and there is an
"org.eclipse.ui.prefs" file there, in the directory
workspace\.metadata\.plugins\org.eclipse.core.runtime\.setti ngs ... and it contains the value I set,
and the value gets changed.

So the problem boils down to "what is the code to call to cause the stored prefs, as above, to be
read in at app startup, given that there is no Plugin class in my RCP app?"

This is not so well documented ...

HTH,
Paul

Oliver Wahl wrote:
> I'm developing an RCP based application. Saving and restoring to the preference store work fine when the product is started from within Eclipse 3.1.
>
> After deployment (and standalone execution) I can set the same preferences, they are saved to the .prefs file with the correct value, but on the next startup these values are not used. Everthing is blank (or probably back to the default value).
>
> Why isn't the preference store read from disk?
>
> Any ideas on how to debug these deployment problems? Are there any traces that might e helpful?
>
> Help appreciated.
Re: RCP Application deployment problem - PreferenceStore, PS [message #439275 is a reply to message #439136] Thu, 03 November 2005 12:56 Go to previous messageGo to next message
Eclipse UserFriend
Just confirmed that upgarding to Eclipse 3.1.1 does not fix the issue.

The workaround that seems to work for me is to define a static method of my pref-page,
setDefaults(), that sets the defaults as defined by that page, using the
PlatformUI.getPreferenceStore(); and the instance-method of my pref-page, init(IWorkbench), calls
that static method, setDefaults(). THEN, to make sure that my prefs are initialised before calling
upon them, each View or Editor that accesses my prefs now makes a call to that same new static
method, setDefaults() ... since there is no way to guarantee that the user has opened my pref-page
before they open any view or editor ...

I'm sure I'm misunderstanding something, but this really does seem an awkward misfeature ... I
wonder what the intended behavior is?

Paul
Re: RCP Application deployment problem - PreferenceStore, PS [message #439412 is a reply to message #439275] Mon, 07 November 2005 14:38 Go to previous messageGo to next message
Eclipse UserFriend
Paul,

I have tried the "RCP app with an intro" example, and I don't have any
problems with the preferences, with or without having an Activator class
(the replacement concept for Plugin class).

Please file a bug against Platform/UI if you still have problems with this.
Reproducible steps (e.g. using one of the wizard-generated RCP example apps)
would be very much appreciated.

Boris

"Paul Keyser" <rolarenfan@earthlink.net> wrote in message
news:dkdj0k$u4d$1@news.eclipse.org...
> Just confirmed that upgarding to Eclipse 3.1.1 does not fix the issue.
>
> The workaround that seems to work for me is to define a static method of
my pref-page,
> setDefaults(), that sets the defaults as defined by that page, using the
> PlatformUI.getPreferenceStore(); and the instance-method of my pref-page,
init(IWorkbench), calls
> that static method, setDefaults(). THEN, to make sure that my prefs are
initialised before calling
> upon them, each View or Editor that accesses my prefs now makes a call to
that same new static
> method, setDefaults() ... since there is no way to guarantee that the user
has opened my pref-page
> before they open any view or editor ...
>
> I'm sure I'm misunderstanding something, but this really does seem an
awkward misfeature ... I
> wonder what the intended behavior is?
>
> Paul
Re: RCP Application deployment problem - PreferenceStore, PS [message #439420 is a reply to message #439412] Mon, 07 November 2005 17:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

What is an activator class and where can I read about this new concept?


CL


Boris Bokowski wrote:
> Paul,
>
> I have tried the "RCP app with an intro" example, and I don't have any
> problems with the preferences, with or without having an Activator class
> (the replacement concept for Plugin class).
>
> Please file a bug against Platform/UI if you still have problems with this.
> Reproducible steps (e.g. using one of the wizard-generated RCP example apps)
> would be very much appreciated.
>
> Boris
>
> "Paul Keyser" <rolarenfan@earthlink.net> wrote in message
> news:dkdj0k$u4d$1@news.eclipse.org...
>
>>Just confirmed that upgarding to Eclipse 3.1.1 does not fix the issue.
>>
>>The workaround that seems to work for me is to define a static method of
>
> my pref-page,
>
>>setDefaults(), that sets the defaults as defined by that page, using the
>>PlatformUI.getPreferenceStore(); and the instance-method of my pref-page,
>
> init(IWorkbench), calls
>
>>that static method, setDefaults(). THEN, to make sure that my prefs are
>
> initialised before calling
>
>>upon them, each View or Editor that accesses my prefs now makes a call to
>
> that same new static
>
>>method, setDefaults() ... since there is no way to guarantee that the user
>
> has opened my pref-page
>
>>before they open any view or editor ...
>>
>>I'm sure I'm misunderstanding something, but this really does seem an
>
> awkward misfeature ... I
>
>>wonder what the intended behavior is?
>>
>>Paul
>
>
>
Re: RCP Application deployment problem - PreferenceStore, PS [message #439446 is a reply to message #439420] Tue, 08 November 2005 07:33 Go to previous message
Eclipse UserFriend
CL [dnoyeb] Gilbert wrote:
> What is an activator class and where can I read about this new concept?

It looks like they changed plugin to activator, probably to align with
the OSGi 4 spec (although I'm guessing). I'd try
http://www.eclipse.org/equinox/ for more information.

Later,
PW
Previous Topic:trouble with hibernate classloading using multiple plugins
Next Topic:"workspace" versus "instance area", and how to specify
Goto Forum:
  


Current Time: Tue Sep 16 10:48:46 EDT 2025

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

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

Back to the top