public void fillMenu(Menu menu) {
List menuItems = getItems();
for (int i = 0; i < menuItems.size(); i++) {
Object object = menuItems.get(i);
if (object instanceof IAction) {
ActionContributionItem item = new ActionContributionItem((IAction) object);
item.fill(menu, -1);
} else {
IContributionItem item = (IContributionItem) object;
item.fill(menu, -1);
}
}
// create working set action only for add menu
if(add) {
IContributionItem item = null;
if (menu.getItemCount() > 0) {
item = new Separator();
item.fill(menu, -1);
}
item = new ActionContributionItem(new NewWorkingSetAction());
item.fill(menu, -1);
}
}