Search in sources :

Example 11 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class ArtifactsUtils method createPattern.

private static IEntity createPattern(IEntity child) {
    IEntity pattern = EntityUtils.clone(child);
    EntityDescriptor<?> ed = pattern.wGetEntityDescriptor();
    for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) {
        if (!name.equals(fd))
            pattern.wSet(fd, CommonsEntityAdapterFactory.createVariable(fd.getEntityDescriptor(), fd.getName()));
    }
    return pattern;
}
Also used : IEntity(org.whole.lang.model.IEntity) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 12 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class SemanticsUtils method createTerm.

public static IEntity createTerm(String edUri, FreshNameGenerator nameGenerator) {
    EntityDescriptor<?> ed = CommonsDataTypePersistenceParser.getEntityDescriptor(edUri, false, null);
    if (ed == null || (!EntityUtils.isSimple(ed) && !EntityUtils.isFragment(ed)))
        return SemanticsEntityFactory.instance.createEntityType(edUri);
    int size = ed.featureSize();
    IEntity[] values = new IEntity[size];
    SemanticsEntityFactory sf = SemanticsEntityFactory.instance;
    for (int i = 0; i < size; i++) {
        FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
        values[i] = sf.buildTypedVariable().set(SemanticsFeatureDescriptorEnum.variable, sf.createVariable(nameGenerator.nextFreshName(fd.getName()))).set(SemanticsFeatureDescriptorEnum.signature, sf.createEntityType(fd.getEntityDescriptor().toString())).getResult();
    }
    return CommonsEntityFactory.instance.createStageUpFragment(GenericEntityFactory.instance.create(ed, values).wGetAdapter(CommonsEntityDescriptorEnum.Any));
}
Also used : IEntity(org.whole.lang.model.IEntity) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) SemanticsEntityFactory(org.whole.lang.semantics.factories.SemanticsEntityFactory)

Example 13 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class MappingStrategyUtils method getElementNCName.

public static String getElementNCName(IEntity entity) {
    EntityDescriptor<?> context;
    FeatureDescriptor fd;
    IEntity parent = entity.wGetParent();
    if (EntityUtils.isNull(parent)) {
        context = CommonsEntityDescriptorEnum.RootFragment;
        fd = CommonsFeatureDescriptorEnum.rootEntity;
    } else {
        context = parent.wGetEntityDescriptor();
        fd = parent.wGetFeatureDescriptor(entity);
    }
    IMappingStrategy strategy = getMappingStrategy(context.getLanguageKit().getURI());
    return strategy == null ? null : strategy.getElementNCName(context, entity.wGetEntityDescriptor(), fd);
}
Also used : IMappingStrategy(org.whole.lang.xsd.codebase.IMappingStrategy) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) IEntity(org.whole.lang.model.IEntity)

Example 14 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class MappingStrategyUtils method getAttributeNCName.

public static String getAttributeNCName(IEntity entity) {
    EntityDescriptor<?> context;
    FeatureDescriptor fd;
    IEntity parent = entity.wGetParent();
    if (EntityUtils.isNull(parent)) {
        context = CommonsEntityDescriptorEnum.RootFragment;
        fd = CommonsFeatureDescriptorEnum.rootEntity;
    } else {
        context = parent.wGetEntityDescriptor();
        fd = parent.wGetFeatureDescriptor(entity);
    }
    IMappingStrategy strategy = getMappingStrategy(context.getLanguageKit().getURI());
    return strategy == null ? null : strategy.getAttributeNCName(context, entity.wGetEntityDescriptor(), fd);
}
Also used : IMappingStrategy(org.whole.lang.xsd.codebase.IMappingStrategy) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) IEntity(org.whole.lang.model.IEntity)

Example 15 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class JDTTransformerVisitor method setAnnotations.

private void setAnnotations(IEntity annotations, List<?> jdtAnnotations) {
    IEntity parent = annotations.wGetParent();
    FeatureDescriptor fd = parent.wGetFeatureDescriptor(annotations);
    for (Iterator<?> i = jdtAnnotations.iterator(); i.hasNext(); ) {
        Annotation annotation = (Annotation) i.next();
        acceptChild((Annotation) annotation);
        parent.wGet(fd).wAdd(exp);
    }
}
Also used : IEntity(org.whole.lang.model.IEntity) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) MarkerAnnotation(org.eclipse.jdt.core.dom.MarkerAnnotation) NormalAnnotation(org.eclipse.jdt.core.dom.NormalAnnotation) SingleMemberAnnotation(org.eclipse.jdt.core.dom.SingleMemberAnnotation) Annotation(org.eclipse.jdt.core.dom.Annotation)

Aggregations

FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)100 IEntity (org.whole.lang.model.IEntity)43 InternalIEntity (org.whole.lang.model.InternalIEntity)6 ILanguageKit (org.whole.lang.reflect.ILanguageKit)6 HashSet (java.util.HashSet)5 IContributionItem (org.eclipse.jface.action.IContributionItem)5 ActionsVisibleWhen (org.whole.lang.e4.ui.expressions.ActionsVisibleWhen)5 VisibilityExpression (org.whole.lang.e4.ui.expressions.VisibilityExpression)5 ActionsCompositeContributionItem (org.whole.lang.e4.ui.menu.ActionsCompositeContributionItem)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 HashMap (java.util.HashMap)3 IBindingManager (org.whole.lang.bindings.IBindingManager)3 ITransactionScope (org.whole.lang.bindings.ITransactionScope)3 IdentityRequestEventHandler (org.whole.lang.events.IdentityRequestEventHandler)3 IMappingStrategy (org.whole.lang.xsd.codebase.IMappingStrategy)3 IEntityFactory (org.whole.lang.factories.IEntityFactory)2 ArrayType (org.whole.lang.pojo.model.ArrayType)2 CollectionType (org.whole.lang.pojo.model.CollectionType)2 MapType (org.whole.lang.pojo.model.MapType)2