Search in sources :

Example 1 with NameWithExtension

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;
}
Also used : NameWithExtension(org.whole.lang.artifacts.model.NameWithExtension) IArtifactsEntity(org.whole.lang.artifacts.model.IArtifactsEntity) ArrayList(java.util.ArrayList)

Example 2 with NameWithExtension

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);
}
Also used : NameWithExtension(org.whole.lang.artifacts.model.NameWithExtension) IFile(org.eclipse.core.resources.IFile) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot)

Aggregations

NameWithExtension (org.whole.lang.artifacts.model.NameWithExtension)2 ArrayList (java.util.ArrayList)1 IFile (org.eclipse.core.resources.IFile)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 IArtifactsEntity (org.whole.lang.artifacts.model.IArtifactsEntity)1