use of org.eclipse.scout.rt.client.ui.action.IActionVisitor in project scout.rt by eclipse.
the class TreeContextMenu method handleOwnerEnabledChanged.
protected void handleOwnerEnabledChanged() {
ITree container = getContainer();
if (container != null) {
final boolean enabled = container.isEnabled();
acceptVisitor(new IActionVisitor() {
@Override
public int visit(IAction action) {
if (action instanceof IMenu) {
IMenu menu = (IMenu) action;
if (!menu.hasChildActions() && menu.isInheritAccessibility()) {
menu.setEnabledInheritAccessibility(enabled);
}
}
return CONTINUE;
}
});
}
}
use of org.eclipse.scout.rt.client.ui.action.IActionVisitor in project scout.rt by eclipse.
the class TreeContextMenu method calculateEnableState.
/**
* @param ownerSelection
*/
protected void calculateEnableState(Collection<? extends ITreeNode> ownerSelection) {
boolean enabled = true;
for (ITreeNode node : ownerSelection) {
if (!node.isEnabled()) {
enabled = false;
break;
}
}
final boolean inheritedEnability = enabled;
acceptVisitor(new IActionVisitor() {
@Override
public int visit(IAction action) {
if (action instanceof IMenu) {
IMenu menu = (IMenu) action;
if (!menu.hasChildActions() && menu.isInheritAccessibility()) {
menu.setEnabledInheritAccessibility(inheritedEnability);
}
}
return CONTINUE;
}
});
}
use of org.eclipse.scout.rt.client.ui.action.IActionVisitor in project scout.rt by eclipse.
the class AbstractMenu method afterChildMenusAdd.
protected void afterChildMenusAdd(Collection<? extends IMenu> newChildMenus) {
if (CollectionUtility.hasElements(newChildMenus)) {
final Object ownerValue = m_ownerValue;
IActionVisitor visitor = new IActionVisitor() {
@Override
public int visit(IAction action) {
if (action instanceof IMenu) {
IMenu menu = (IMenu) action;
try {
if (ObjectUtility.notEquals(menu.getOwnerValue(), ownerValue)) {
menu.handleOwnerValueChanged(ownerValue);
}
} catch (RuntimeException e) {
LOG.error("error during handle owner value changed.", e);
}
}
return CONTINUE;
}
};
for (IMenu m : newChildMenus) {
m.acceptVisitor(visitor);
}
}
}
Aggregations