Search in sources :

Example 1 with TemplateAction

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

the class ActionsUIContentAssistVisitor method createReplaceTemplateAction.

protected TemplateAction createReplaceTemplateAction(IEntity prototype, String label, ImageDescriptor icon) {
    ActionsEntityFactory aef = ActionsEntityFactory.instance;
    TemplateAction action = aef.createTemplateAction();
    action.getKind().setValue(ActionKindEnum.REPLACE);
    action.getText().setValue(label);
    if (icon != null)
        action.getIcon().setValue(icon);
    action.setEnablerPredicate(createStageUpFragment(Predicate, createNotEqualsQuery(prototype)));
    action.setTransformation(createStageUpFragment(Transformation, EntityUtils.clone(prototype)));
    return action;
}
Also used : TemplateAction(org.whole.lang.actions.model.TemplateAction) ActionsEntityFactory(org.whole.lang.actions.factories.ActionsEntityFactory)

Example 2 with TemplateAction

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

the class ActionsUIEntityFactory method createTemplateAction.

public TemplateAction createTemplateAction(ActionKindEnum.Value kind, IEntity prototype, String label, ImageDescriptor icon, boolean differentPredicate) {
    ActionsEntityFactory aef = ActionsEntityFactory.instance;
    TemplateAction action = aef.createTemplateAction();
    action.getKind().setValue(kind);
    action.getText().setValue(label);
    if (icon != null)
        action.getIcon().setValue(icon);
    if (differentPredicate && kind == ActionKindEnum.REPLACE)
        action.setEnablerPredicate(createStageUpFragment(Predicate, createNotEqualsPredicate(prototype)));
    action.setTransformation(createStageUpFragment(Transformation, EntityUtils.cloneIfParented(prototype)));
    return action;
}
Also used : TemplateAction(org.whole.lang.actions.model.TemplateAction) ActionsEntityFactory(org.whole.lang.actions.factories.ActionsEntityFactory)

Aggregations

ActionsEntityFactory (org.whole.lang.actions.factories.ActionsEntityFactory)2 TemplateAction (org.whole.lang.actions.model.TemplateAction)2