cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How can I dynamically control display of menu items in Windchill?

ptc-4428645
1-Newbie

How can I dynamically control display of menu items in Windchill?

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.

2 REPLIES 2

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.

Announcements

Top Tags