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;
}
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();
}
Aggregations