contextmenueclipse-scout

Eclipse Scout Table Menu depend on table context


What is the best way to do "context aware" menu for table in Eclipse scout.

For example, lets assume that table has boolean row "Additional", and we want :

if Additional is true show menu :

Edit
Add
Additional

if false

Edit 
Add
Delete

How to do this ?


Solution

  • From Eclipse Scout 4 and newer: What you want is to override execOwnerValueChanged(Object) on your menu items. You will be passed a List<ITableRow> as argument with which you can decide if the menu item should be visible/enabled.

    I'd suggest you create 2 menu items for Delete and Additional and then implement the solution above.

    See also the wiki page in the Scout Eclipsepedia.