Search in sources :

Example 1 with WorkspaceTemplate

use of org.whole.lang.artifacts.templates.WorkspaceTemplate in project whole by wholeplatform.

the class WizardArtifactsModelImportPage1 method buildModel.

// private IArtifactsEntity getContextEntity(String name, IEntity model) {
// //TODO only for testing purpose
// IArtifactsEntity pattern = ArtifactsEntityFactory.instance.createFolderArtifact(
// GenericEntityFactory.instance.create(ArtifactsEntityDescriptorEnum.Name, name),
// CommonsEntityAdapterFactory.createVariable(ArtifactsEntityDescriptorEnum.Metadata, "metadata"),
// CommonsEntityAdapterFactory.createVariable(ArtifactsEntityDescriptorEnum.Artifacts, "artifacts"));
// IArtifactsEntity entity = Matcher.find(pattern, model, false);
// if (entity == null)
// entity = (IArtifactsEntity) model;
// Metadata metadata = ArtifactsEntityFactory.instance.createMetadata();
// metadata.wSet(ArtifactsFeatureDescriptorEnum.persistenceKitId,
// GenericEntityFactory.instance.create(ArtifactsEntityDescriptorEnum.PersistenceKitId,
// "org.whole.lang.text.codebase.TextSourcePersistenceKit"));
// entity.wSet(ArtifactsFeatureDescriptorEnum.metadata, metadata);
// return entity;
// }
@Override
protected IEntity buildModel() {
    ModelBuilderOperation op = new ModelBuilderOperation();
    IResource resource = (IResource) ((IStructuredSelection) resourceChooser.getSelection()).getFirstElement();
    WorkspaceTemplate template = new WorkspaceTemplate(resource);
    template.apply(op);
    IEntity model = op.wGetResult();
    // }
    return model;
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) IEntity(org.whole.lang.model.IEntity) WorkspaceTemplate(org.whole.lang.artifacts.templates.WorkspaceTemplate) IResource(org.eclipse.core.resources.IResource)

Example 2 with WorkspaceTemplate

use of org.whole.lang.artifacts.templates.WorkspaceTemplate in project whole by wholeplatform.

the class WorkspaceResourceOperations method toArtifactsModel.

public IEntity toArtifactsModel(IResource resource) {
    ModelBuilderOperation mbo = new ModelBuilderOperation();
    WorkspaceTemplate resourceTemplate = new WorkspaceTemplate(resource, false);
    resourceTemplate.apply(mbo);
    return mbo.wGetResult();
}
Also used : ModelBuilderOperation(org.whole.lang.builders.ModelBuilderOperation) WorkspaceTemplate(org.whole.lang.artifacts.templates.WorkspaceTemplate)

Aggregations

WorkspaceTemplate (org.whole.lang.artifacts.templates.WorkspaceTemplate)2 ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)2 IResource (org.eclipse.core.resources.IResource)1 IEntity (org.whole.lang.model.IEntity)1