protected void populateSubMenus( Menu subMenu, final Object node, ITreeContentProvider provider, final boolean isRunTo) { if (provider.hasChildren(node)) { /* * this is a submenu mark */ MenuItem header = new MenuItem(subMenu, SWT.CASCADE); header.setText(node.toString()); Menu newSubMenu = new Menu(header); header.setMenu(newSubMenu); for (Object child : provider.getChildren(node)) populateSubMenus(newSubMenu, child, provider, isRunTo); } else { /** lone item, this is a runner. */ ITimeBasedAction action = new TimeBasedAction(this, node, isRunTo); action.setText( String.format("%s %s", isRunTo ? "Skip to " : "Run for ", _labelProvider.getText(node))); _allActions.add(action); ActionContributionItem aci = new ActionContributionItem(action); aci.fill(subMenu, -1); } }
public void refresh() { for (ITimeBasedAction action : _allActions) action.update(_controller.getCurrentTime()); }