What's the new story for Plug-In Preferences? [message #249663] |
Fri, 04 June 2004 13:22  |
Eclipse User |
|
|
|
Originally posted by: glongman.intelligentworks.nospam.com
Been following the javadoc around in RC1 and we're supposed to use the new
extension point "org.eclipse.core.runtime.preferences" now? but I don't
understand the scope element of that point.
Are there some docs on this? Searching the porting guide turned up nothing.
--
Geoff
Intelligent Works Inc.
|
|
|
|
|
|
|
Re: What's the new story for Plug-In Preferences? [message #249742 is a reply to message #249690] |
Fri, 04 June 2004 16:15   |
Eclipse User |
|
|
|
Originally posted by: dj_houghton.nospam.ca.ibm.com
There is some documentation on the new prefs found on the Core team web
site here:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-core-home/documents/user_settings/index.html
The Runtime Adoption guide that you refer to is a little out of date
(obviously). It was the first attempt at describing what you need to do
to get your plug-in off the compatibility layer. The good news is
although the doc is out of date, the javadoc for the compatibility layer
methods contains the migration information.
I would recommend checking the javadoc of the methods that you are
interested in.
To answer your specific questions, #getPluginPreferences and
#savePluginPreferences are NOT deprecated (it was initially thought that
they might be so that's why they were referenced in that doc).
If you are initializing your default plug-in pref values via the old
method, it will still work. If you don't register an extension to the
new preferences extension point (see javadoc below and in the code),
then we will load your plug-in and call the old method on your plug-in
class.
Here is the javadoc for Plugin#initializeDefaultPluginPreferences():
This method has been refactored in the new preference mechanism to
handle the case where the runtime compatibility layer does not exist.
The contents of this method should be moved to the method named
#initializeDefaultPreferences() in a separate subclass of
org.eclipse.core.runtime.preferences.AbstractPreferenceIniti alizer. This
class should be contributed via the org.eclipse.core.runtime.preferences
extension point.
<extension point="org.eclipse.core.runtime.preferences">
<initializer class="com.example.MyPreferenceInitializer"/>
</extension>
....
package com.example;
public class MyPreferenceInitializer extends AbstractPreferenceInitializer {
public MyPreferenceInitializer() {
super();
}
public void initializeDefaultPreferences() {
MyPlugin.getPlugin().getPluginPreferences().setDefault(key, value);
}
}
Tom Johnson wrote:
> DJ Houghton wrote:
>
>> The preferences extension point in 3.0 represents the story going
>> forward, and the plug-in preference code that you may have had before
>> will still work.
>>
>> Initial docs are available from the Platform/Core team web site.
>
>
> I am also keenly interested in this; one document I have found which
> addresses this is the "Eclipse 3.0 Runtime Adoption Guide". If there
> is another more appropriate document, I would appreciate a URL pointer.
>
> The version of the "Runtime Adoption Guide" that I have retrieved from
> CVS is dated February 24, 2004, and the sections on preferences contain
> text which state "<xxx the preference mechanism is still in play>".
>
> The JavaDoc for org.eclipse.core.runtime.Plugin gives some hints on
> how to replace some of the legacy code, but what would help is a good
> example of a new Plugin's lifecycle which included calls to the
> appropriate preference-related methods.
>
> The 3.0RC1 example plugin wizard still emits code which uses the
> legacy form of preference management.
>
> I'm pretty sure I can figure out how to use the new extension point
> mechanics, and I'm sure they're better, but I'm not sure that what I
> will come up with is the recommended way to use the API.
>
> Thanks for all of the great work, though!
>
> Tom Johnson
>
>
|
|
|
Re: What's the new story for Plug-In Preferences? [message #249814 is a reply to message #249742] |
Fri, 04 June 2004 19:49  |
Eclipse User |
|
|
|
DJ Houghton wrote:
> There is some documentation on the new prefs found on the Core team web
> site here:
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-core-home/documents/user_settings/index.html
Thanks!
> The Runtime Adoption guide that you refer to is a little out of date
> (obviously). It was the first attempt at describing what you need to do
> to get your plug-in off the compatibility layer. The good news is
> although the doc is out of date, the javadoc for the compatibility layer
> methods contains the migration information.
>
> I would recommend checking the javadoc of the methods that you are
> interested in.
Thanks, see below.
>
> To answer your specific questions, #getPluginPreferences and
> #savePluginPreferences are NOT deprecated (it was initially thought that
> they might be so that's why they were referenced in that doc).
Even if the methods aren't deprecated, I'd rather get away from them
now.
> If you are initializing your default plug-in pref values via the old
> method, it will still work. If you don't register an extension to the
> new preferences extension point (see javadoc below and in the code),
> then we will load your plug-in and call the old method on your plug-in
> class.
>
> Here is the javadoc for Plugin#initializeDefaultPluginPreferences():
Thanks, that's what I meant when I said I thought I could figure it out;
I had already found the JavaDoc and the other hints.
Tom Johnson
|
|
|
Powered by
FUDForum. Page generated in 0.04508 seconds