use of org.whole.lang.artifacts.model.NameWithExtension in project whole by wholeplatform.
the class NameWithExtensionPart method getModelSpecificChildren.
protected List getModelSpecificChildren() {
NameWithExtension entity = getModelEntity();
List<IArtifactsEntity> list = new ArrayList<IArtifactsEntity>(2);
list.add(entity.getName());
list.add(entity.getExtension());
return list;
}
use of org.whole.lang.artifacts.model.NameWithExtension in project whole by wholeplatform.
the class ArtifactsWorkspaceUtils method bindFile.
private static void bindFile(FileArtifact fileEntity, IBindingManager bindings, boolean force) {
bindings.wEnterScope();
if (!Matcher.matchImplAndBind(ArtifactsEntityDescriptorEnum.Name, fileEntity.getName(), bindings, "fileName")) {
NameWithExtension name = (NameWithExtension) fileEntity.getName();
if (!Matcher.matchImplAndBind(ArtifactsEntityDescriptorEnum.Name, name.getName(), bindings, "fileName"))
throw new IllegalArgumentException("No File name");
if (!Matcher.matchImplAndBind(ArtifactsEntityDescriptorEnum.Extension, name.getExtension(), bindings, "extension"))
throw new IllegalArgumentException("No File name");
}
bindMetadata(fileEntity.getMetadata(), bindings);
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IFile file = workspaceRoot.getFile(getParentPath(bindings).append(bindings.wIsSet("extension") ? bindings.wStringValue("fileName") + '.' + bindings.wStringValue("extension") : bindings.wStringValue("fileName")));
bindings.wDefValue("file", file);
if (!file.exists() && !force)
throw new IllegalArgumentException("Missing File: " + bindings.wStringValue("fileName"));
bindings.wExitScope(true);
}
Aggregations