The parameter passed called targets is an array of parts, but it always has one item: the part that is selected on the UIPartsTree. Notice that IntentAPI is available. At the end of the method, the ExecuteComplete() method must be called. This notifies the UITools that the action is complete, and the UI can be updated.
These settings work for most actions. The ServerAction property is an exception. To update the UI after the action is complete, set it to UpdateModel. Otherwise, set it to ReturnResult.