Bug 220477 - Provide AbstractUIPlugin.getPreferenceStore()
Summary: Provide AbstractUIPlugin.getPreferenceStore()
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: Workbench (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 1.1 M3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on: 220476
Blocks:
  Show dependency tree
 
Reported: 2008-02-26 17:24 EST by Elias Volanakis CLA
Modified: 2008-09-24 06:17 EDT (History)
1 user (show)

See Also:


Attachments
Session Scope Preferences v1 (52.91 KB, text/plain)
2008-03-10 23:32 EDT, Elias Volanakis CLA
no flags Details
Test Project (9.79 KB, application/x-zip-compressed)
2008-03-11 02:35 EDT, Elias Volanakis CLA
no flags Details
Session Scope Preferences v2 (58.19 KB, patch)
2008-03-11 19:41 EDT, Elias Volanakis CLA
no flags Details | Diff
Test Project v2 (10.69 KB, application/x-zip-compressed)
2008-03-11 19:42 EDT, Elias Volanakis CLA
no flags Details
Sample Project v2 (18.38 KB, application/x-zip-compressed)
2008-03-11 19:43 EDT, Elias Volanakis CLA
ruediger.herrmann: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Volanakis CLA 2008-02-26 17:24:39 EST
This will require a ScopedPreferenceStore with "session" scope, as well as a mechanism for persisting session specific key-value pairs through RWT. 

(More details will be possibly added once I start working on this...)
Comment 1 Elias Volanakis CLA 2008-03-10 23:32:55 EDT
Created attachment 92115 [details]
Session Scope Preferences v1

This patch adds support for AbstractUIPlugin.getPreferenceStore().

A few things to discuss:

1. I use an internal class from org.eclipse.core for Base64 decoding / encoding. This is needed by the spec. Is it ok to have this reference? The alternative is copying the class from org.eclipse.core.

2. Currently there is no notification to preference listeners when one does a SettingStore.loadById() in RWT. Should we change that? I've investigated the possibilities and I'm not sure if this is worth the complexity.

3. Currently only the preference values are per session. The node structure is global. I was not aware of this until today :-o. For "normal" use via getPreferenceStore this is not a problem. However for more advanced use, for example via SessionScope.node( "..." ).remove() this could have unintended consequences.

Let's discuss 2 and 3 in the next sync up call.

Elias.
Comment 2 Elias Volanakis CLA 2008-03-11 02:35:02 EDT
Created attachment 92124 [details]
Test Project

This project contains tests for the session scoped preferences. To run launch the enclosed RAP Application.
Comment 3 Elias Volanakis CLA 2008-03-11 19:41:03 EDT
Created attachment 92250 [details]
Session Scope Preferences v2

This patch addresses the concerns from comment #1 with regard to point 2. A SessionPreferenceNodeCore servers as the glue between RWT and the session preference node. It will forward change events to the preference change listeners, once loadById(...) is called in RWT.

As discussed points 1 + 3 are ok.
Comment 4 Elias Volanakis CLA 2008-03-11 19:42:29 EDT
Created attachment 92251 [details]
Test Project v2
Comment 5 Elias Volanakis CLA 2008-03-11 19:43:30 EDT
Created attachment 92252 [details]
Sample Project v2

This project is a joint example for RWT Setting Stores (Bug #220476) and this bug.
Comment 6 Frank Appel CLA 2008-03-14 08:18:00 EDT
The implementation is now available in CVS-HEAD.

There was still a problem with sessions and the global usage of ScopedPreferenceStore. I've changed the ScopedePreferenceStore implementation to work properly using SessionScope and non SessionScope contexts. Elias could you please verify that this doesn't conflict with any other use cases. I also refactored some package names due to the rule that RAP provides a subset of RCP.
Comment 7 Elias Volanakis CLA 2008-03-14 16:51:24 EDT
Adjusted target milestone.
Comment 8 Elias Volanakis CLA 2008-03-14 17:18:12 EDT
Frank, 

1. I looked at your changes. We now have a unique node hierarchy "per session", meaning that all nodes starting from "/session" will be session specific.  This is ok from my POV, as it makes the whole mechanism easier to explain: not only the attribute values are session specific but the nodes too. I currently do not see any conflicting use cases.

2. I noticed you copied Base64 from org.eclipse.ui.core.internal.preferences. I thought we wanted to avoid this (?). 

Elias.
Comment 9 Frank Appel CLA 2008-03-16 08:59:51 EDT
in reply to comment #8, 2:
I copied Base64 from the original workbench plug-in codebase. Personally I would have prefered to use the internal reference to avoid the code duplication as agreed on, but as I detected that the RCP workbench plug-in also has its own version I copied this just to have the reference in place for import statements in case we adapt the rest of the package and to keep as much as possible in sync with the original workbench stuff. Still I'm not convinced that using the copy and paste approach is better than the usage of the internal version, since now at least 3 copies of the Base64 class exist.
Comment 10 Frank Appel CLA 2008-04-01 09:27:17 EDT
As the implementation is available in CVS-Head and as it seems to work reasonable a change the resolve-state to fixed.