Personalización avanzada > Business Logic Customization > Customizing Part Structure Browser > Customizing Part Structure Browser Actions Toolbar
  
Customizing Part Structure Browser Actions Toolbar
Custom actions, or tasks, can be added to the Actions toolbar in the Product Structure Browser. The action is defined in the —action.xml file, the display information is defined in an rbInfo file, and the position of the action buttons is defined in the actionmodel.xml file, where the RibbonInfo tag defines the key characteristics of the action.
To add custom actions in the Product Structure Browser, perform the following procedure:
1. Define the custom action in the custom-actions.xml file or in the appropriate -actions.xml file, such as the psb-actions.xml file. In the following example, a custom action called customActionGWT is created in the custom-actions.xml file with its resource bundle, URL, parameters, and the supported types:
<listofactions>
<!-- Custom GWT Action for PSB GWT RIBBON -->
<!-- Default resourceBundle="com.ptc.windchill.enterprise.part.psb.psbActionsRB -->
<objecttype resourceBundle="ext.associativity.reconciliation.part.psbCustomActionsRB" name="psb">

<action name="CustomActionGroupGWT" ajax="component">
<!-- Defines the GWT action group for PSB ribbon -->
<command class="com.ptc.cat.ui.client.action.NoAction"
</action>

<action name="customActionGWT" ajax="component">
<command class="com.ptc.cat.ui.client.action.LaunchURLAction" method="execute"
url="/ptc1/psb/customAction" windowType="popup"/>
<supportedTypes>
<type value="wt.part.WTPart"/>
<type value="wt.part.WTPartUsageLink"/>
<type value="wt.part.PartUsesOccurrence"/>
<type value="wt.part.RTPartPathOccurrence"/>
</supportedTypes>
</action>

<action name="customActionGWTTest" ajax="component">
<command class="com.ptc.cat.ui.client.action.LaunchURLAction" windowType="popup" url="/ptc1/psb/customAction" method="execute" />
<supportedTypes>
<type value="wt.part.WTPart" />
<type value="wt.part.WTPartUsageLink"/>
<type value="wt.part.PartUsesOccurrence"/>
<type value="wt.part.RTPartPathOccurrence"/>
</supportedTypes>
</action>

<action name="customURLActionGWT" ajax="component">
<command class="com.ptc.cat.ui.client.action.LaunchCustomURLAction" windowType="popup" url="/ptc1/psb/customURLAction" method="execute"/>
<supportedTypes>
<type value="wt.part.WTPart"/>
<type value="wt.part.WTPartUsageLink"/>
<type value="wt.part.PartUsesOccurrence"/>
<type value="wt.part.RTPartPathOccurrence"/>
</supportedTypes>
</action>
</objecttype>
</listofactions>
In this file, the name of the action, URL, parameter, and supported types must be modified as required for customization. The psbRelatedPartsTreeToolBar model must to be overridden to add the ribbon to the Part Structure Browser toolbar.
* 
Only GWT actions can be added to the Actions toolbar.
Any customizations in the psb-actions.xml must be reviewed and reapplied with each software update.
2. Add the display value for the action in the rbInfo file defined on the resourceBundle parameter.
3. Add the model definition in the appropriate custom-actionmodels.xml file. The RibbonInfo tag used in the actionmodel.xml file defines the key characteristics about the action in the Actions toolbar. For more information about the action definition RibbonInfo attributes, see the “RibbonInfo Attributes” section below. The following is an example of adding customActionGWT to the Part Structure Browser toolbar:
<model name="psbRelatedPartsTreeToolBar">
<!--Custom GWT Group-->
<action name="CustomActionGroupGWT" type="psb" >
<ribbonInfo columnCount="1" buttonType="group"/>
</action>

<action name="customActionGWT" type="psb">
<ribbonInfo buttonType="button" buttonScale="small"/>
</action>

<action name="customURLActionGWT" type="psb">
<ribbonInfo buttonType="button" buttonScale="small"/>
</action>

<action name="customActionGWTTest" type="psb">
<ribbonInfo buttonType="menuitem"/>
</action>

<!-- Custom GWT actions ends -->
</model>
Apart from the custom actions, the out-of-the-box actions for this model are also available in the psb-actionmodel.xml file.
4. After making the changes, restart the Method Server.
RibbonInfo Attributes
The following are the attributes of the RibbonInfo tag:
buttonType: Button type can have different values such as button, menu, text_menu, submenu, toggle, custommenu, split, check, subcheck, menuitem, submenuitem, and group:
Button: Plain button that executes the action.
Menu: Button with a drop-down menu of actions. There is no action for the button.
Split: Button that is both an action button and a menu button.
Toggle: Sticky button indicating an on or off state.
Text_Menu: Displays only text without any icon. It ignores the preference that toggles the toolbar text. For example, used for an Action button.
Custom_Menu: Provides a way for menu plug-in that handles all the menu items, actions, and events within.
Menu Items: The following are the allowed menu items:
Menu_Item: An action on a menu. Action and label are required but the icon is optional.
Check: A menu item that indicates on or off state with a check mark instead of an icon. For a group of actions, this turns into a radio button and becomes exclusive with other check menu items with the same group name.
Sub-menu: A menu item that has a fly-out submenu. No action is associated with it.
Sub-menu Item: A menu item for a submenu.
SearchWidget: A button with a menu or action and an auto-suggest entry. For a search widget, a label is required, however an icon is optional. The default orientation is horizontal. For more details, see Adding a Custom Auto-Suggest Search Widget Component.
Orientation: Specifies the layout of the search widget components — vertical or horizontal.
buttonScale: This can have small, medium, or large values. The default value is small. This denotes the size that corresponds to icon sizes that GXT accepts: 16x16, 24x24, and 32x32.
columnCount: This is used only for button groups to indicate the number of button columns present in the group for layout.
groupName: Specifies a visual grouping of button on a ribbon toolbar.