Search in sources :

Example 1 with FillStrategy

use of org.whole.lang.actions.model.FillStrategy in project whole by wholeplatform.

the class ActionsE4InterpreterVisitor method visit.

@Override
public void visit(GroupAction entity) {
    IItemContainer<IAction, ImageDescriptor> container = (IItemContainer<IAction, ImageDescriptor>) getBindings().wGetValue("itemContainer");
    String groupName = stringEvaluate(entity.getText());
    IFillMenuStrategy strategy;
    FillStrategy fillStrategy = entity.getFillStrategy();
    if (Matcher.match(Hierarchical, fillStrategy))
        strategy = createFillMenuStrategy((Hierarchical) fillStrategy, groupName);
    else
        strategy = FlatFillMenuStrategy.instance(groupName);
    if (EntityUtils.hasParent(entity) && Matcher.match(SeparatedAction, entity.wGetParent()))
        container.addSeparator(groupName);
    else
        container.addGroupMarker(groupName);
    getBindings().wEnterScope();
    getBindings().wDefValue("fillMenuStrategy", strategy);
    lazyEvaluate(entity.getActions());
    getBindings().wExitScope();
    setResult(null);
}
Also used : FillStrategy(org.whole.lang.actions.model.FillStrategy) IAction(org.eclipse.jface.action.IAction) IItemContainer(org.whole.lang.ui.menu.IItemContainer) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFillMenuStrategy(org.whole.lang.ui.menu.IFillMenuStrategy)

Example 2 with FillStrategy

use of org.whole.lang.actions.model.FillStrategy in project whole by wholeplatform.

the class ActionsE4InterpreterVisitor method visit.

@Override
public void visit(SubgroupAction entity) {
    IItemContainer<IAction, ImageDescriptor> container = (IItemContainer<IAction, ImageDescriptor>) getBindings().wGetValue("itemContainer");
    String groupName = stringEvaluate(entity.getText());
    IFillMenuStrategy strategy;
    FillStrategy fillStrategy = entity.getFillStrategy();
    if (Matcher.match(Hierarchical, fillStrategy))
        strategy = createFillMenuStrategy((Hierarchical) fillStrategy);
    else
        strategy = FlatFillMenuStrategy.instance();
    IItemContainer<IAction, ImageDescriptor> subContainer = container.addIntoSubContainer(groupName, null);
    getBindings().wEnterScope();
    getBindings().wDefValue("itemContainer", subContainer);
    getBindings().wDefValue("fillMenuStrategy", strategy);
    lazyEvaluate(entity.getActions());
    getBindings().wExitScope();
    setResult(null);
}
Also used : FillStrategy(org.whole.lang.actions.model.FillStrategy) IAction(org.eclipse.jface.action.IAction) IItemContainer(org.whole.lang.ui.menu.IItemContainer) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IFillMenuStrategy(org.whole.lang.ui.menu.IFillMenuStrategy)

Aggregations

IAction (org.eclipse.jface.action.IAction)2 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)2 FillStrategy (org.whole.lang.actions.model.FillStrategy)2 IFillMenuStrategy (org.whole.lang.ui.menu.IFillMenuStrategy)2 IItemContainer (org.whole.lang.ui.menu.IItemContainer)2