We are having a view, with pulldownmenu items (Group by, Grouped by). 'Group by' has sub-menu which are the columns in the views. When any of the submenu is selected, THe view entries will be grouped with the column and also there will be a entry added to 'Group by' Menu.
We are having a util method of signature:
public static void clickPullDownMenuItem(String viewID, String menu){
display.asyncExec(new Runnable() {
@Override
public void run() {
IViewPart viewPart = getView(viewID);
MenuManager mainMenuManager = (MenuManager) viewPart.getViewSite().getActionBars().getMenuManager();
IContributionItem[] items = mainMenuManager.getItems();
//iterate to through the items and invoke the action of the item.
}
Thread.sleep(2000);
}
I use the below calls to simulate the same.
1. clickPullDownMenuItem(viewID, "Group by/Resource")
2. clickPullDownMenuItem(viewID, "Grouped by/Resource")
After the first statement is executed I am able to see the 'Resource' entry in the 'Grouped by' menu. But, when the second statement is being executed, I'm getting no items under 'Grouped by' in the above method.
The thing I don't understand is the submenu is present in the UI (I'm able to see it). But, when I try to access it programmatically, I'm not getting that submenu.