Search in sources :

Example 51 with FeatureDescriptor

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

the class QueriesInterpreterVisitor method visit.

@Override
public void visit(FeatureStep entity) {
    IEntity self = getSelfEntity(entity);
    String featureName = entity.getValue();
    FeatureDescriptor fd = self.wGetLanguageKit().getFeatureDescriptorEnum().valueOf(featureName);
    if (fd == null || !self.wContains(fd))
        visit((Expression) entity);
    else
        setResult(self.wGet(fd));
}
Also used : IEntity(org.whole.lang.model.IEntity) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) Expression(org.whole.lang.queries.model.Expression)

Example 52 with FeatureDescriptor

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

the class WholeNodeEditPolicy method getConnectionCompleteCommand.

protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    FeatureDescriptor fd = getNodeEditPart().getTargetConnectionFeature(request);
    if (fd == null)
        return UnexecutableCommand.INSTANCE;
    ConnectionCreateCommand cmd = (ConnectionCreateCommand) request.getStartCommand();
    if (cmd == null)
        return UnexecutableCommand.INSTANCE;
    cmd.setConnection((IEntity) request.getNewObject());
    cmd.setTarget(getNode());
    cmd.setTargetFeature(fd);
    return cmd;
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) ConnectionCreateCommand(org.whole.lang.ui.commands.ConnectionCreateCommand)

Example 53 with FeatureDescriptor

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

the class XmlSpecific2XsiBuilderAdapter method mixedStructuralEntity_.

protected MappingContext mixedStructuralEntity_(EntityDescriptor<?> context) {
    if (!hasMixedStructuralMapping(context))
        return null;
    FeatureDescriptor fd = getMixedStructuralFeature(context);
    EntityDescriptor<?> ed = getMixedStructuralType(context);
    builder.wFeature(fd);
    builder.wEntity_(ed);
    return MappingContext.create(ed, fd, true, true);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 54 with FeatureDescriptor

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

the class XmlSpecific2XsiBuilderAdapter method elementEntity_.

protected MappingContext elementEntity_(EntityDescriptor<?> context, QName name, Attributes attributes) {
    // TODO test!!!
    // EntityDescriptor<?> ed = ap.hasExplicitType() ? ap.getExplicitType() : getElementEntityMapping(context, name);
    EntityDescriptor<?> ed = getElementEntityMapping(context, name);
    if (SchemaUtils.isAnyType(ed))
        ed = getElementEntityMapping(CommonsEntityDescriptorEnum.RootFragment, name);
    if (ed == null)
        throw new IllegalStateException("missing mapping");
    FeatureDescriptor fd = calculateFeatureDescriptor(context, name);
    if (!EntityUtils.isComposite(context))
        builder.wFeature(fd);
    // FIXME abstract/union types
    if (!EntityUtils.isData(ed) && !(ed.isAbstract() && ed.isPolymorphic())) {
        // was getConcreteSubtypesInLanguage().size() > 1)) {
        ;
        builder.wEntity_(ed);
        attributeEntities(ed, attributes);
    }
    return MappingContext.create(ed, fd, false);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 55 with FeatureDescriptor

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

the class XmlSpecific2XsiBuilderAdapter method calculateFeatureDescriptor.

protected FeatureDescriptor calculateFeatureDescriptor(EntityDescriptor<?> context, QName name) {
    Collection<FeatureDescriptor> fds = getElementFeatureMappings(context, name);
    if (fds.size() > 1) {
        List<FeatureDescriptor> contextFeatures = context.getEntityFeatureDescriptors();
        FeatureDescriptor contextFeature;
        int index = builder.wCurrentIndexOf();
        while (index < contextFeatures.size() && !fds.contains(contextFeature = contextFeatures.get(index)) && contextFeature.isOptional()) index++;
        return context.getEntityFeatureDescriptor(index);
    } else
        return fds.iterator().next();
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

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