Project: Eclipse_Platform_UI
Bug 120523 [Commands] parameters: support serializing and deserializing of ParameterizedCommands
Reported: 2005-12-13 03:33:02 | Status: verified fixed

UA wants to be able to store a ParameterizedCommand as a String in documents like Help, Cheatsheets and Intro parts. The stored commands will be shown as links and when the user clicks the link we will deserialize from String back to ParameterizedCommand and execute it. The informational content of a ParameterizedCommand amounts to the command id and the ids and values of each of the parameters. We'd like to propose a standard serialization format and offer API for (de)serializing so that others can use it as well as us. The serialization format we have looks like this: commandId?param1Id=value1&param2Id=value2 Breaking it up, looks like this: commandId '?' param1Id '=' value1 '&' param2Id '=' value2 ... The commandId, paramIds and values are UTF-8 encoded to allow arbitrary characters to appear in them. I'm going to attach 2 patches for this. The first patch implements this functionality. It has changes to org.eclipse.core.commands and org.eclipse.ui.workbench The second patch is some JUnit tests to add to org.eclipse.ui.tests.

Files changed in fix:
bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/CommandManager.java bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/ParameterizedCommand.java bundles/org.eclipse.core.commands/src/org/eclipse/core/commands/SerializationException.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/commands/ICommandService.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandSerializationTest.java tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/CommandsTestSuite.java