Customization > Customization Tutorial > Getting Started With Windchill Customization > Update the Action Model to Add Custom Actions
Update the Action Model to Add Custom Actions
Objective
Incrementally add new actions to create and view Acme parts in the existing Folder Contents toolbar.
Solution
1. Create a custom action model file AcmePartClient-actionmodels.xml at the location <customizationRootDirectory>\<Acme_WizardModule>\main\resources\<Acme-actions>.
2. Customize the existing action model folderbrowser_toolbar_actions to include the new actions:
<model name="folderbrowser_toolbar_actions" incremental="">
<!-- Injects new action at position 6 and 7 respectively.-->
<action name="createCustomPartWizard" type="custompart"
shortcut="true" insertAt="6" />
<action name="viewCustomParts" type="custompart"
shortcut="true" insertAt="7" />
</model>
3. Create a new custom actions file AcmePartClient-actions.xml at the location <customizationRootDirectory>\<Acme_WizardModule>\main\resources\<Acme-actions> and specify the new action definition for the Create Acme Part and Acme Parts actions.
<?xml version="1.0"?>
<!DOCTYPE listofactions SYSTEM '../customActions.dtd'>
<listofactions>
<objecttype name="custompart" class="wt.part.WTPart"
resourceBundle="com.ptc.windchill.enterprise.part.partResource">
<action name="createCustomPartWizard" ajax="row"
resourceBundle="com.acme.custompart.CustomPartResource">
<command class="com.acme.custompart.forms.CreateCustomPartFormProcessor"
method="execute"
url="/ptc1/custom/custompart/createCustomPartWizard?revisionMode=create&showNewCADDocStep=true&hideAssociatePart=true"
onClick="validateCreateLocation(event)"
windowType="popup" />
</action>
<action name="viewCustomParts" ajax="row"
resourceBundle="com.acme.custompart.CustomPartResource">
<component name="com.example.newui.table"
windowType="page" />
</action>
</objecttype>
</listofactions>
4. Register AcmePartClient-actions.xml and AcmePartClient-actionmodels.xml in custom.site.xconf.
Refer to the following example:
<AddToProperty name="com.ptc.netmarkets.util.misc.customActions"
value="Acme-actions/AcmePartClient-actions.xml"/>
<AddToProperty name="com.ptc.netmarkets.util.misc.customActionModels"
value="Acme-actions/AcmePartClient-actionmodels.xml"/>
5. Specify the action labels in the custom resource bundle file CustomPartResource.java at the location <customizationRootDirectory>\<Acme_WizardModule>\main\src\com\<acme>\<custompart>.
@RBEntry("Create Acme Part")
public static final String CUSTOM_PART_LABEL = "custompart.createCustomPartWizard.description";
@RBEntry("Create Acme Part")
public static final String PRIVATE_CONSTANT_43 = "custompart.createCustomPartWizard.tooltip";
@RBEntry("part_variant_new.png")
public static final String PRIVATE_CONSTANT_44 = "custompart.createCustomPartWizard.icon";
@RBEntry("Create Acme Part")
public static final String PRIVATE_CONSTANT_45 = "custompart.createCustomPartWizard.title";
Deploy Customization on Development Environment
For information on the CCD process for deployment, see Deploy Your Customizations on Your Development Environment
Prepare CCD Package for Promotion
For information on the CCD process for promotion, see Deploying Code and Configuration Package.
After the customization is compiled and deployed, the new actions—Create Acme Part and Acme Parts—are displayed in the Folder Contents toolbar. In the highlighted part of the image, the icon on the left represents Create Acme Part and the icon on the right represents Acme Parts.
Was this helpful?