Reputation: 3773
I have a multiple user/location RCP application that currently utilizes several user configurable options. Some preferences are for specific to the station, some are specific to the user.
The options are from a preference store which saves the *.prefs files to "workspace.metadata.plugins\org.eclipse.core.runtime.settings".
This would be fine if we were only using a single machine/user. But if a user were to go to another station, then the user would be using whatever preferences were setup for that station.
Is it possible to specify another form for persistence (not files)?
Upvotes: 13
Views: 11559
Reputation: 51
You should read about multi-user installs
In our case we have separated the per-user preferences from the application configuration by setting the config.ini to include the following:
[email protected]/Application Data/earthrise
[email protected]/Local Settings/Application Data/earthrise/144/configuration
osgi.sharedConfiguration.area=c:/program files/earthrise/configuration
osgi.configuration.cascaded=true
The result of this is that any preferences set by the user are stored in their roaming profile, but application specific configuration data is stored in the Local Settings.
This doesn't solve the problem of having user preferences specific to a particular workstation, but does allow to have each user to have their own preferences.
A catch with this is that the eclipse error log file will be stored in the instance area and get carried around in their roaming profile - not really what you want. You can code around this in the plug-in. See the workaround at eclipse bugzilla - search for 256502
Upvotes: 5
Reputation: 1209
Just a thought!
Since the load() method of PreferenceStore does:
public void load() throws IOException {
FileInputStream in = new FileInputStream(filename);
load(in);
in.close();
}
and you can either create a PreferenceStore
PreferenceStore(String filename)
or set its file name
public void setFilename(String name) {
filename = name;
}
you might be able to "hack" the file name to some place on a shared server (or the users shared home folder perhaps)...
Upvotes: 0
Reputation: 1506
It sounds like you need to store your preferences at a central location that all users/machines can reach. This means you have to implement your own IPersistentPreferencesStore
. Then you can override org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
to use it.
The bigger question is how to implement that central preferences store, but that depends on the technologies you are using. In general, if your project uses a central server, you probably should store your preferences there. For example, if your project already uses a relational database, one solution would be to create appropriate database tables and implement IPersistentPreferencesStore
to access those tables via JDBC.
Upvotes: 8
Reputation: 1324347
According the the eclipse wiki, the preferences are file-based, and stored:
<eclipse_home>/eclipse/configuration/.settings/
..prefs
extension.<workspace>/.metadata/.plugin/org.eclipse.core.runtime/.settings
..prefs
extension..settings
sub-directory of your project folder So if the file option is here to stay, you may need to:
HKEY_CURRENT_USER/Software/MyRCP/...
) at the exit of the application, and .prefs
files in the local workspace.metadata.plugins\org.eclipse.core.runtime.settings
directoryUpvotes: 9