Search in sources :

Example 1 with FeatureDescriptor

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

the class AdaptiveEntityPart method propertyChangeUI.

@Override
protected void propertyChangeUI(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals("notation#rebuild")) {
        rebuild();
        return;
    }
    FeatureDescriptor fd = getModelEntity().wGetEntityDescriptor().getFeatureDescriptorEnum().valueOf(evt.getPropertyName());
    if (typeFeature.equals(fd)) {
        entityStyling = null;
        rebuild();
        return;
    }
    super.propertyChangeUI(evt);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 2 with FeatureDescriptor

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

the class StyledTreePartFactory method getFeaturesStyling.

public static IFeatureStyling[] getFeaturesStyling(List<FeatureDescriptor> efDescriptors) {
    IFeatureStyling[] featuresStyling = new IFeatureStyling[efDescriptors.size()];
    int i = 0;
    for (FeatureDescriptor fd : efDescriptors) featuresStyling[i++] = new FeatureStyling(fd.getName(), !fd.getEntityDescriptor().getDataKind().isNotAData(), true, getAlignment(fd.getEntityDescriptor()));
    return featuresStyling;
}
Also used : IFeatureStyling(org.whole.lang.ui.notations.styledtree.styling.IFeatureStyling) FeatureStyling(org.whole.lang.ui.notations.styledtree.styling.FeatureStyling) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) IFeatureStyling(org.whole.lang.ui.notations.styledtree.styling.IFeatureStyling)

Example 3 with FeatureDescriptor

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

the class AbstractConnectionCommand method getConnectionConnectedFeature.

protected FeatureDescriptor getConnectionConnectedFeature(IEntity node) {
    FeatureDescriptor fd = null;
    IEntityIterator<IEntity> i = IteratorFactory.childIterator();
    i.reset(node);
    for (IEntity child : i) if ((EntityUtils.isComposite(child) && child.wContains(getConnection())) || (EntityUtils.isSimple(child) && child.wEquals(getConnection())))
        fd = node.wGetFeatureDescriptor(child);
    return fd;
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) IEntity(org.whole.lang.model.IEntity)

Example 4 with FeatureDescriptor

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

the class SimpleEntityTreeFigure method createFeaturesOutline.

protected IFigure createFeaturesOutline(EntityDescriptor<?> ed, ActionListener linkListener) {
    int featureNum = ed.childFeatureSize();
    IFigure featuresOutline = new EntityFigure(new ColumnLayout().withAutoresizeWeight(1.0f).withMarginBottom(2).withMinorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING));
    featureToggles = new Toggle[featureNum];
    for (int i = 0; i < featureNum; i++) {
        FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
        EntityFigure feature = new EntityFigure(new RowLayout().withSpacing(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
        feature.addLabel(fd.getName());
        featureToggles[i] = createFoldingToggle(new EntityToggle(WholeImages.ROUND_EXPAND, WholeImages.ROUND_COLLAPSE), i);
        feature.add(featureToggles[i]);
        featuresOutline.add(feature);
    }
    for (int i = featureNum, size = ed.featureSize(); i < size; i++) {
        FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
        EntityFigure feature = new EntityFigure(new RowLayout().withMarginLeft(3).withMarginRight(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
        EntityLabel createLabel = feature.addLabel(fd.getName(), WholeImages.LINK);
        createLabel.setTextPlacement(isRightToLeft() ? PositionConstants.EAST : PositionConstants.WEST);
        createLabel.setBorder(new MarginBorder(3));
        feature.add(new EntityButton(createLabel, linkListener, i));
        featuresOutline.add(feature);
    }
    return featuresOutline;
}
Also used : EntityFigure(org.whole.lang.ui.figures.EntityFigure) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) EntityButton(org.whole.lang.ui.figures.EntityButton) ColumnLayout(org.whole.lang.ui.layout.ColumnLayout) RowLayout(org.whole.lang.ui.layout.RowLayout) MarginBorder(org.eclipse.draw2d.MarginBorder) EntityToggle(org.whole.lang.ui.figures.EntityToggle) EntityLabel(org.whole.lang.ui.figures.EntityLabel) Point(org.eclipse.draw2d.geometry.Point) IFigure(org.eclipse.draw2d.IFigure)

Example 5 with FeatureDescriptor

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

the class ConnectionReconnectCommand method canExecute.

public boolean canExecute() {
    if (!canConnect(newNode, newNodeFeature))
        return false;
    oldNode = getConnection().wGet(getConnectionFeature(isSourceCommand() ? "source" : "target"));
    if (oldNode.equals(newNode))
        return false;
    IEntity otherNode = getOtherEndpoint();
    FeatureDescriptor otherFeature = getConnectionConnectedFeature(otherNode);
    if (isSourceCommand())
        return !connectionExists(newNode, newNodeFeature, otherNode, otherFeature);
    else
        return !connectionExists(otherNode, otherFeature, newNode, newNodeFeature);
}
Also used : IEntity(org.whole.lang.model.IEntity) 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