Defining Individual Actions in an Action Set
Each action data object in a set is a data object of type com.vmware.actionsfw.ActionSpec. You must create an ActionSpec data object for every action you want to add to the action set.
You create each ActionSpec data object using a <com.vmware.actionsfw.ActionInfo> XML element. Inside this element, you set the properties for the action. ActionInfo Extension Object Properties lists the properties that you set for each ActionInfo object.
The unique identifier of the action. Using namespace style is a best practice, such as com.mySolution.myPlugin.chassis.chassisPowerAction.
A string containing the text label for the action, suitable for a button or context menu in the vSphere Web Client user interface.
A boolean value. If you set this value to true, the action can be made available when the user has selected multiple vSphere objects. This property is optional.
The name of a boolean property on the target vSphere or custom object. You can use the value of the property specified to define whether the action is available on the target object. For example, you can specify a boolean property on a Virtual Machine object, and make your action available only when that property is true. This property is optional.
The command class for the action. The command class contains a method annotated to handle the event that the vSphere Web Client generates when the user invokes your action. The handler method must then perform the actual action operation on the vSphere environment. See Handling Actions Using Command Classes.
Example: Example Action Set Extension shows an example extension definition for an action set extension. In the example, the extension adds a set of two actions to the vSphere Web Client Actions Framework. The actions are associated with a custom object type called a Chassis.
Example: Example Action Set Extension
<extension id=”mySolution.myPlugin.myActionSet”>
<extendedPoint>vise.actions.sets</extendedPoint>
<object>
<actions>
<!-- first action -->
<com.vmware.actionsfw.ActionSpec>
<uid>com.mySolution.myPlugin.chassis.createChassis</uid>
<label>Create Chassis</label>
<description>Create a Chassis object.</description>
<icon>#{myPluginImages:sample1}</icon>
<acceptsMultipleTargets>false</acceptsMultipleTargets>
<command className=”com.mySolution.myPlugin.ChassisCommand”/>
</com.vmware.actionsfw.ActionSpec>
<!-- second action -->
<com.vmware.actionsfw.ActionSpec>
<uid>com.mySolution.myPlugin.chassis.editChassis</uid>
<label>Edit Chassis</label>
<description>Edit a Chassis object.</description>
<icon>#{myPluginImages:sample2}</icon>
<acceptsMultipleTargets>true</acceptsMultipleTargets>
<conditionalProperty>actions.isEditAvailable</conditionalProperty>
<command className=”com.mySolution.myPlugin.ChassisCommand”/>
</com.vmware.actionsfw.ActionSpec>
</actions>
</object>
<metadata>
<!-- filters the actions in the set to be visible only for Chassis -->
<objectType>samples:Chassis</objectType>
</metadata>
</extension>