依物件類型停用動作
欲依物件類型停用 PSE 中的某個動作,請遵循下列指示:
1. 編輯 ExplorerStructures.xml 檔案。
針對您將停用動作的類型建立 <TypeDefinition> 元素。例如,針對屬於 WTPart 子項的類型 org.my.MyTypeA、org.my.MyTypeB 和 org.my.MyTypeD,您應定義下列元素:
<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. 編輯 ExplorerValidators.xml 檔案。
針對您欲停用動作的類型群組建立 <ValidatorDefinition> 元素。若所選零件的類型與驗證器定義中參照的其中一種類型相符,即會傳回 false。例如,應針對上述三種類型定義如下所示的驗證器:
<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>
|
ValidatorDefinition 的 validatorClass 屬性值務必與上列類別完全相同,且必須將反轉屬性值設定為 "true"。
|
3. 編輯 ExplorerActions.xml 檔案。
將 <ValidatorEntry> 元素新增至您欲針對指定類型停用的動作。
<ActionDefinition id="ptc.wnc.exp.EditCommonAttrsAction" ... >
...
<ValidatorEntry>
<Import id="com.my.IsNotEqualToTypesABDVAL"/>
</ValidatorEntry>
...
</ActionDefinition>
只要選取類型 A、B 或 D 的零件,此組態即會禁用 PSE 應用程式中的「編輯通用屬性」動作。