Assign actions a menu group based on class
The scenario is that many classes based on a superclass has Class actions that all should have the same Menu Group.
This OCL will list all classes with a named superclass and list the class actions and their Menu Group
Class.allInstances->select(c|c.AllSuperClassesAndSelf->includes(Class.allInstances->select(c|c.Name='PeWork')->first)).ClassActions->collect(ca|ca.Name, ca.MenuGroup.Name)
Replace 'PeWork' in the example above to the class or superclass you want to find
The EAL code will update the Menu Group to a named one.
Class.allInstances->select(c|c.AllSuperClassesAndSelf->includes(Class.allInstances->select(c|c.Name='PeWork')->first)).ClassActions->forEach(ca|ca.MenuGroup := MenuGroup.allInstances->select(mg|mg.Name='PE')->first)
Replace 'PeWork' in the example above to the class or superclass you want to find and 'PE' to the existing Menu group you want to set.
This page was edited more than 8 months ago on 05/02/2024. What links here