use of org.whole.lang.e4.ui.actions.ActionFactory in project whole by wholeplatform.
the class ActionsE4InterpreterVisitor method createAction.
protected IAction createAction(Value kind, IEnablerPredicate enablerPredicate, IEntityTransformer transformer, IEntity prototype, String text) {
// FIXME transformer always passed as null
IEclipseContext context = (IEclipseContext) getBindings().wGetValue("context");
ActionFactory actionRegistry = new ActionFactory(context);
QueriesEntityFactory qf = QueriesEntityFactory.instance;
IEntity predicate = enablerPredicate instanceof OpaqueEnablerPredicate ? ((OpaqueEnablerPredicate) enablerPredicate).value : qf.createBooleanLiteral(true);
switch(kind.getOrdinal()) {
case ActionKindEnum.REPLACE_ord:
return actionRegistry.createReplaceFragmentAction(text, predicate, prototype);
case ActionKindEnum.INSERT_ord:
return actionRegistry.createAddFragmentAction(text, predicate, prototype);
case ActionKindEnum.WRAP_ord:
IEntity behavior = qf.createPointwiseUpdate(qf.createVariableRefStep("focusEntity"), CommonsEntityAdapterFactory.createStageUpFragment(QueriesEntityDescriptorEnum.Expression, prototype));
return actionRegistry.createPerformAction(text, WRAP_ICON_URI, predicate, behavior);
case ActionKindEnum.PERFORM_ord:
return actionRegistry.createPerformAction(text, WRAP_ICON_URI, predicate, prototype);
default:
throw new IllegalArgumentException("not implemented yet");
}
}
Aggregations