use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class JDTJavaBuilderPersistenceKit method ensureBuiltProject.
protected void ensureBuiltProject(IPersistenceProvider pp) throws CoreException {
IBindingManager bm = pp.getBindings();
IProject project = (IProject) bm.wGetValue("project");
// perform an incremental build to ensure class files are generated
if (project.hasNature(JavaCore.NATURE_ID))
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, ResourceUtils.getProgressMonitor(bm));
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class GrammarBasedUnparserVisitor method visit.
@Override
public void visit(Literal entity) {
IEntity result;
if (EntityUtils.isFragment(entity)) {
IBindingManager bindings = getBindings();
bindings.wEnterScope();
bindings.wDef("self", model);
result = BehaviorUtils.evaluate(entity, 0, bindings);
bindings.wExitScope();
} else
result = entity;
append(result.wStringValue());
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class WorkflowsDynamicCompilerVisitor method visit.
@Override
public void visit(InvokeJavaClassMethod entity) {
final Variable resultVariable = entity.getResult();
Expressions arguments = entity.getArguments();
int size = arguments.wSize();
IEntityIterator<?>[] runnableIterators = new IEntityIterator<?>[2 + size];
entity.getClassName().accept(this);
runnableIterators[0] = getResultIterator();
entity.getMethod().accept(this);
runnableIterators[1] = getResultIterator();
for (int i = 0; i < size; i++) {
arguments.get(i).accept(this);
runnableIterators[2 + i] = getResultIterator();
}
setResultIterator(IteratorFactory.multiValuedRunnableIterator(new AbstractWorkflowsRunnable() {
public void run(IEntity selfEntity, IBindingManager bm, IEntity... argsEntities) {
String className = argsEntities[0].wStringValue();
IEntity methodData = argsEntities[1];
Method method;
if (DataTypeUtils.getDataKind(methodData).isString())
method = JavaReflectUtils.getMethod(className, methodData.wStringValue(), ReflectionFactory.getClassLoader(bm));
else
method = (Method) methodData.wGetValue();
Object[] arguments = toArguments(method.getParameterTypes(), method.isVarArgs(), argsEntities);
Object resultValue = JavaReflectUtils.invokeMethod(null, method, arguments);
setResult(bm, resultVariable, resultValue, method.getReturnType());
}
}, runnableIterators).withSourceEntity(entity));
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class PojoMappingUtils method getModel.
public static Model getModel(Library library) {
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
PathExpression pojoModelToModels = new PojoModelToModelsQuery().create();
Library normalizedLibrary = NormalizerOperation.normalize(EntityUtils.clone(library));
Model model = BehaviorUtils.<Model>evaluateFirstResult(pojoModelToModels, normalizedLibrary, bindings);
Matcher.removeVars(model, true);
return model;
}
use of org.whole.lang.bindings.IBindingManager in project whole by wholeplatform.
the class ArtifactsSynchronizerVisitor method initialize.
private IArtifactsEntity initialize(IArtifactsEntity entity) {
IEntity model;
if (isLoading) {
if (entity == null) {
// build from scratch
model = createFilesystemModel(entity, null, false);
this.compareToEntityStack.push(cloneArtifact(model));
} else {
IEntity basePath = createBasePath(entity);
model = createFilesystemModel(entity, basePath, false);
this.compareToEntityStack.push(EntityUtils.clone(entity));
}
} else {
IEntity basePath = createBasePath(entity);
if (basePath != null) {
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
model = EntityUtils.clone(basePath);
IEntityIterator<IEntity> i = IteratorFactory.childIterator();
i.reset(getChildren(entity));
for (IEntity child : i) {
bindings.wDef(SUB_TREE_ROOT, EntityUtils.clone(child));
Matcher.substitute(model, bindings, false);
}
Matcher.removeVars(model, true);
} else
model = EntityUtils.clone(entity);
// initialize the synchronization model
IEntity filesystemModel = createFilesystemModel(entity, basePath, true);
this.compareToEntityStack.push(filesystemModel);
}
return (IArtifactsEntity) model;
}
Aggregations