Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hello,
I am developing a custom application for Windchill 10.
My code is started by clicking a custom menu item that is defined using the custom-actions.xml file.
The menu item belongs to the context menu for objects of type EPMDocument.
Now, I need to show this menu item only for assemblies (docType = CADASSEMBLY), but not for
other types of EPM documents (i. e. drawings, CAD parts, etc.).
I found out that it was possible to define an "includeFilter" (a special Java class) that can be used
to dynamically show or hide a menu item.
My testing filter class looks as follows:
import com.ptc.cat.ui.client.action.ActionFilter;
public class MyActionFilter implements ActionFilter {
@Override
public boolean test(List<StructureModel> structureModels, View view) {
// Decide whether the menu item shall be displayed and return true or false.
return false;
}
}
The filter must be registered as a Windchill service, so that it can be called.
My problem is, that I do not know how to register it. My filter never gets called.
Has anyone got any experience in this area?
Thanks in advance
mp.
hi,
you should register in site.xconf file
and run xconfmanager and propagate changes.
If the object type is one that is defined in your Windchill environment such that you can create an instance of that type, you can include supportedTypes or nonSupportedTypes tags in your action definition:
<action name="myAction">
<description>My New Action</description>
<command url="netmarkets/jsp/part/myAction.jsp" />
<supportedTypes>
<type value="WCTYPE|wt.part.WTPart|com.company.www.PartOne"/>
</supportedTypes>
<nonSupportedTypes>
<type value="WCTYPE|wt.part.WTPart|com.company.www.PartTwo"/>
<type value="WCTYPE|wt.part.WTPart|com.company.www.PartThree"/>
</nonSupportedTypes>
</action>
If you use supportedTypes/nonSupportedTypes tags, you have to list the types individually, not the parent.