I wanted to run a bat file in which it can import preferences from a location (which was exported manually). I searched for the command which would import preferences but, could not find any.
问题:
回答1:
There is no existing code to do this. You would have to write an Eclipse headless application that does something like this:
IPreferencesService service = Platform.getPreferencesService();
IExportedPreferences prefs = service.readPreferences(file input stream);
// TODO create IPreferenceFilter array to filter what you want
service.applyPreferences(prefs, filter array);
See the source of the import preferences page org.eclipse.ui.internal.wizards.preferences.WizardPreferencesImportPage1
for an example.
回答2:
Backstory: I was looking for something similar and, a few tabs back, I've stumbled on a "half-an-answer"/alternative solution. Even if the thread is old might still turn in handy ...
In this page the author talks about using -pluginCustomization
parameter inside the eclipse.ini
file
-pluginCustomization
plugin_customization.ini
-startup
plugins/org.eclipse....
The plugin_customization.ini
file is similar to the *.epf
file, same variables minus the /instance/
prefix (maybe because this way they are interpreted/applied at product(eclipse) level and not as per-workspace preferences).