Search in sources :

Example 1 with Assign

use of org.whole.lang.workflows.model.Assign in project whole by wholeplatform.

the class ChooseModelsDialog method open.

@Override
public int open() {
    int status = super.open();
    if (status == Dialog.OK) {
        WorkflowsEntityFactory wef = WorkflowsEntityFactory.instance;
        Tuple tuple = QueriesEntityFactory.instance.createTuple(0);
        for (Object element : getResult()) try {
            IEntity model = getPersistenceKit().readModel(new IFilePersistenceProvider((IFile) element));
            tuple.wAdd(createStageUpFragment(QueriesEntityDescriptorEnum.Expression, model));
        } catch (Exception e) {
        }
        Variable variable = wef.createVariable("selectedModels");
        Expression fragment = createSameStageFragment(Expression, tuple);
        Assign assign = wef.createAssign(variable, fragment);
        assignments.wAdd(assign);
    }
    return status;
}
Also used : WorkflowsEntityFactory(org.whole.lang.workflows.factories.WorkflowsEntityFactory) Variable(org.whole.lang.workflows.model.Variable) IEntity(org.whole.lang.model.IEntity) Expression(org.whole.lang.workflows.model.Expression) Expression(org.whole.lang.workflows.reflect.WorkflowsEntityDescriptorEnum.Expression) IFilePersistenceProvider(org.whole.lang.codebase.IFilePersistenceProvider) Assign(org.whole.lang.workflows.model.Assign) Tuple(org.whole.lang.queries.model.Tuple)

Example 2 with Assign

use of org.whole.lang.workflows.model.Assign in project whole by wholeplatform.

the class WorkflowsInterpreterVisitor method define.

public void define(IBindingScope bm, Assignments assignments) {
    IEntity selfEntity = bm.wGet("self");
    for (int i = 0; i < assignments.wSize(); i++) {
        Assign assign = assignments.get(i);
        define(bm, assign);
        if (!assign.getName().getValue().equals("self"))
            resetSelfEntity(selfEntity);
    }
}
Also used : IEntity(org.whole.lang.model.IEntity) Assign(org.whole.lang.workflows.model.Assign)

Example 3 with Assign

use of org.whole.lang.workflows.model.Assign in project whole by wholeplatform.

the class ChangeValueDialogFactory method createDialog.

public Dialog createDialog(Shell shell, String title, String message, Assignments assignments, IBindingManager bindings) {
    Assign assign = (Assign) assignments.wGet(0);
    Expression expression = assign.getExpression();
    IEntity entity = BehaviorUtils.evaluate(expression, 0, bindings);
    assign.wSet(expression, entity);
    IEclipseContext params = EclipseContextFactory.create();
    params.set("dialogTitle", title);
    params.set("dialogMessage", message);
    params.set("dialogEntity", entity);
    IEclipseContext context = (IEclipseContext) bindings.wGetValue("eclipse#eclipseContext");
    IImportAsModelDialogFactory factory = ContextInjectionFactory.make(DisabledImportAsModelDialogFactory.class, context);
    params.set(IImportAsModelDialogFactory.class, factory);
    return ContextInjectionFactory.make(ChangeValueDialog.class, context, params);
}
Also used : Expression(org.whole.lang.workflows.model.Expression) IEntity(org.whole.lang.model.IEntity) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) IImportAsModelDialogFactory(org.whole.lang.ui.dialogs.IImportAsModelDialogFactory) Assign(org.whole.lang.workflows.model.Assign)

Example 4 with Assign

use of org.whole.lang.workflows.model.Assign in project whole by wholeplatform.

the class AssignPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    Assign entity = getModelEntity();
    List<IEntity> children = new ArrayList<IEntity>(2);
    children.add(entity.getName());
    children.add(entity.getExpression());
    return children;
}
Also used : IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) Assign(org.whole.lang.workflows.model.Assign)

Aggregations

IEntity (org.whole.lang.model.IEntity)4 Assign (org.whole.lang.workflows.model.Assign)4 Expression (org.whole.lang.workflows.model.Expression)2 ArrayList (java.util.ArrayList)1 IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)1 IFilePersistenceProvider (org.whole.lang.codebase.IFilePersistenceProvider)1 Tuple (org.whole.lang.queries.model.Tuple)1 IImportAsModelDialogFactory (org.whole.lang.ui.dialogs.IImportAsModelDialogFactory)1 WorkflowsEntityFactory (org.whole.lang.workflows.factories.WorkflowsEntityFactory)1 Variable (org.whole.lang.workflows.model.Variable)1 Expression (org.whole.lang.workflows.reflect.WorkflowsEntityDescriptorEnum.Expression)1