What is the ID of a Command in Eclipse 4 used for? Can it be a random user-selected string, or must it specify some sort of ID/package/class/etc.?
The id is used when you define Handlers, Key Bindings, Handled Menu and Toolbar Items for the command or when you want to reference the command from Java code.
The id should be a unique value in your application. The id is not related to Java packages but conventionally has a similar format.
There are a small number of command ids which are known to the core Eclipse code (such as the org.eclipse.ui.file.exit
command you show) and need to use that exact value.