Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] Migrate key preferences to new version of plugin when command ID has changed

Hello everyone,

I help to develop an Eclipse plugin, whose internal package structure has changed due to refactorings. Now, I also want to change the name of command IDs in the plugin.xml whose current name scheme is similar to the old package structure. Changing the command IDs is not the problem, but our plugin takes preferences+key bindings, which should not be lost after the migration is done.

What I did so far is that I build a migration manager that can copy the value of the old command ID when a user has changed it and stores it as the value of the new command ID. This works fine so far.

For the key bindings I did this by accessing the 'IBindingService', which has a method 'savePreference' that takes all bindings to save (this method is a bit awkward to use because it overwrites all bindings. I didn't find a better way so far to just add a new binding).

But I noticed that the old command IDs + bindings still exist. I could unbind the old binding by simply not passing it to the method 'savePreference', but that does not remove the command, which is annoying because the key store of Eclipse now shows double entries, where one entry is unbound (an unused).

I assume when I remove the old command from the workbench that the old key binding is removed as well. My question now is how can I remove old commands from the workbench? I looked into 'ICommandService', but it doesn't provide a way to do this. Is it possible?

Thanks,
Simon


Back to the top