Advanced Customization > Business Logic Customization > Customizing the Product Structure Explorer (PSE) > Disabling Actions by Object Type
  
Disabling Actions by Object Type
To disable an action in PSE by object type, follow these instructions:
1. Edit the ExplorerStructures.xml file.
Create a <TypeDefinition> element for the type(s) you will disable the action(s) for. For example, for the types org.my.MyTypeA , org.my.MyTypeB and org.my.MyTypeD which are children of WTPart you would define the following elements:
<TypeDefinition id="com.my.MyTypeATD"
typeId="WCTYPE|wt.part.WTPart|org.my.MyTypeA"/>

<TypeDefinition id="com.my.MyTypeBTD"
typeId="WCTYPE|wt.part.WTPart|org.my.MyTypeB"/>

<TypeDefinition id="com.my.MyTypeDTD"
typeId="WCTYPE|wt.part.WTPart|org.my.MyTypeD"/>
2. Edit the ExplorerValidators.xml file.
Create a <ValidatorDefinition> element for the group of types you wish to disable actions for. This will return false if the the type of the selected part matches one of the types referenced in the validator definition. For example, for the three types above, you would define a validator as follows:
<ValidatorDefinition id="com.my.IsNotEqualToTypesABDVAL"
validatorClass="com.ptc.windchill.explorer.structureexplorer.
validators.IsValidTypeValidator" inverted="true">
<Import id="com.my.MyTypeATD"/>
<Import id="com.my.MyTypeBTD"/>
<Import id="com.my.MyTypeDTD"/>
</ValidatorDefinition>
* 
It is important that the value for the validatorClass attribute of ValidatorDefinition be the exact class listed above, and that the the inverted attribute be set to “true”.
3. Edit the ExplorerActions.xml file.
Add a <ValidatorEntry> element to the actions you wish to have disabled for the specified types.
<ActionDefinition id="ptc.wnc.exp.EditCommonAttrsAction" ... >
...
<ValidatorEntry>
<Import id="com.my.IsNotEqualToTypesABDVAL"/>
</ValidatorEntry>
...
</ActionDefinition>
This configuration will disable the Edit Common Attributes action in the PSE application whenever an part of type A, B or D is selected.
Validator isValidTypeValidator
The validator isValidTypeValidator is implemented by the class: com.ptc.windchill.explorer.structureexplorer.validators.IsValidTypeValidator. For a given set of type definitions, this validator will return ‘true’ if the type of the currently selected part is in the aformentioned set. For example, if an instance of this validator is defined with type definitions for types A, B and D. When a part of type A, B or D is selected, the validator will return true. If a part of any other type, e.g. C, is selected, it will return false.
A <ValidatorDefinition> which would return true if the selected type is A, B or D would be defined in the following way:
<ValidatorDefinition id="com.my.IsEqualToOneOfTypesABDVAL"
validatorClass="com.ptc.windchill.explorer.structureexplorer.vali
dators.IsValidTypeValidator">
<Import id="com.my.MyTypeATD"/>
<Import id="com.my.MyTypeBTD"/>
<Import id="com.my.MyTypeDTD"/>
</ValidatorDefinition>
Conversely, a <ValidatorDefinition> which would return false if the selected type is A, B or D would be defined in the following way (note the inclusion of the ‘inverted’ attribute):
<ValidatorDefinition id="com.my.IsNotEqualToTypesABDVAL"
validatorClass="com.ptc.windchill.explorer.structureexplorer.vali
dators.IsValidTypeValidator" inverted="true">
<Import id="com.my.MyTypeATD"/>
<Import id="com.my.MyTypeBTD"/>
<Import id="com.my.MyTypeDTD"/>
</ValidatorDefinition>
The <Import> elements refer to <TypeDefinition> elements which would be defined as follows (assuming that each type is a direct child of WTPart):
<TypeDefinition id="com.my.MyTypeATD"
typeId="WCTYPE|wt.part.WTPart|org.my.MyTypeA"/>

<TypeDefinition id="com.my.MyTypeBTD"
typeId="WCTYPE|wt.part.WTPart|org.my.MyTypeB"/>

<TypeDefinition id="com.my.MyTypeDTD"
typeId="WCTYPE|wt.part.WTPart|org.my.MyTypeD"/>