use of org.whole.lang.artifacts.util.WorkspaceResourceOperations in project whole by wholeplatform.
the class WorkflowsIDEInterpreterVisitor method createArtifactsBindings.
@Override
protected IBindingManager createArtifactsBindings(String resource, ResourceKind resourceKind) {
if (!ResourceKindEnum.WORKSPACE.equals(resourceKind.getValue()))
return super.createArtifactsBindings(resource, resourceKind);
try {
IBindingManager bindings = BindingManagerFactory.instance.createBindingManager();
IResource rootResource = ResourcesPlugin.getWorkspace().getRoot().findMember(resource);
if (rootResource == null)
throw new IllegalArgumentException("root resource does not exist");
bindings.wDefValue("artifactsOperations", new WorkspaceResourceOperations());
bindings.wDefValue("rootResource", rootResource);
IContainer container = rootResource.getParent();
if (container != null) {
int type = container.getType();
switch(type) {
case IResource.PROJECT:
bindings.wDefValue("project", container);
break;
case IResource.FOLDER:
bindings.wDefValue("folder", container);
break;
default:
break;
}
}
return bindings;
} catch (Exception e) {
throw new IllegalArgumentException("Cannot find the specified resource", e);
}
}
Aggregations