Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » API question for AbstractPreferenceStore
API question for AbstractPreferenceStore [message #1849463] Thu, 20 January 2022 15:23 Go to next message
Javier Martin is currently offline Javier MartinFriend
Messages: 2
Registered: January 2022
Junior Member
I have an RCP-based application that wants to store some of its preferences in a custom format/location. Looking into the Eclipse docs (see refs below) I think that the correct way of going about this is adding a custom preference scope with a storage class extending AbstractPreferenceStore.

My question is related to the fact that the system is calling my class in very specific ways that are not really described in the Javadoc. In particular, it seems like:

  • The childrenNames method is only called for the root node of the custom scope (e.g. "/foo" if my custom scope is "foo") .
  • The load and save methods are only called for the direct children of the same root node (e.g. "/foo/bar" and siblings). In particular, they are not called for "/foo" itself, so if I write any preferences there, they are not persisted.
  • Any nodes further down the tree are managed directly by the system, and passed to my load/save methods already flattened into a Properties object with relative path-based keys (e.g. key "a/b/c" for a property "c" in node "/foo/bar/a/b").


These are implementation choices that are fine, even if I might not find them all desirable. However, they are not sufficiently clear to me in the documentation referenced below, and if I write my APS implementation "to spec" I need to make my class much more complex to deal with mapping the possible internal nodes - which per the implementation will never exist, and the actual code has not changed much since Juno.

Thus, my question is: can the documentation in AbstractPreferenceStore be clarified so that implementors can trust the points noted above? Or do I have to account for possible future changes that would require me to consider deeper paths in the childrenNames, load and save methods?

References:
Re: API question for AbstractPreferenceStore [message #1849476 is a reply to message #1849463] Fri, 21 January 2022 04:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
In the https://git.eclipse.org/c/platform/eclipse.platform.runtime.git/tree/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/internal/preferences/TestNodeStorage3.java#n82 test I see the comment "Until we expose load-levels to the user, we will only be called for root children here". I've never used this class but having implemented a model of the entire preference store tree, I know there are so called load levels that determine which nodes are saved as separate "loaded" files versus squashed into a single file. Apparently that's never been "exposed" and it's unlikely ever to be exposed...

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: API question for AbstractPreferenceStore [message #1849482 is a reply to message #1849476] Fri, 21 January 2022 08:16 Go to previous messageGo to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 260
Registered: April 2012
Senior Member
It is still an open-source project, so if needed you could provide the implementation to "expose", any fixes and improvements are always very welcome. Also, w.r.t. the request to update the documentation, it is best to open a bug report (and provide the requested update yourself):
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Equinox&component=Components
Re: API question for AbstractPreferenceStore [message #1849498 is a reply to message #1849482] Fri, 21 January 2022 17:16 Go to previous message
Javier Martin is currently offline Javier MartinFriend
Messages: 2
Registered: January 2022
Junior Member
Okay, I was asking in case there was some documentation that I had missed, or some sort of internal plan w.r.t. these load levels, so I did not want to step on that. Thanks a lot! I can totally prepare a bug report, maybe even with a proposal.
Previous Topic:How does IParameterValues Interface work?
Next Topic:How to install IBM Liberty Developer tools 21.0.0.10 or later in Eclipse
Goto Forum:
  


Current Time: Fri Apr 26 07:04:59 GMT 2024

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

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

Back to the top